mirror of
https://gitee.com/openharmony/developtools_ace_js2bundle
synced 2024-11-23 07:20:22 +00:00
合规处理 Signed-off-by: houhaoyu <houhaoyu@huawei.com> Change-Id: Ief90befb5d50c540c0f0de0815f51ee2a97b9b72
This commit is contained in:
parent
13d8f6be58
commit
3be0f5e8b8
1
OAT.xml
1
OAT.xml
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -1,8 +0,0 @@
|
||||
# developtools_ace-js2bundle
|
||||
|
||||
#### 介绍
|
||||
Provides syntax compilation conversion, syntax validation, rich and friendly syntax error tips.
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. Run `npm install` under `ace-loader` directory.
|
@ -1,8 +1,8 @@
|
||||
# developtools_ace-js2bundle
|
||||
|
||||
#### 介绍
|
||||
提供类Web范式的语法编译转换、语法验证,丰富友好的语法报错提示。
|
||||
#### Introduction
|
||||
Provides syntax compilation conversion, syntax validation, rich and friendly syntax error tips.
|
||||
|
||||
#### 安装教程
|
||||
#### Tutorial
|
||||
|
||||
1. 在ace-loader目录下执行`npm install`
|
||||
Run `npm install` under `ace-loader` directory.
|
8
README_zh.md
Normal file
8
README_zh.md
Normal file
@ -0,0 +1,8 @@
|
||||
# developtools_ace-js2bundle
|
||||
|
||||
#### 介绍
|
||||
提供类Web范式的语法编译转换、语法验证,丰富友好的语法报错提示。
|
||||
|
||||
#### 安装教程
|
||||
|
||||
在ace-loader目录下执行`npm install`
|
@ -39,7 +39,8 @@ function loader(source) {
|
||||
output += 'var card_template =' + getRequireString(this, jsonLoaders('template'), resourcePath)
|
||||
const styleInfo = findStyleFile(fileName)
|
||||
if (styleInfo.extStyle == true) {
|
||||
output += 'var card_style =' + getRequireString(this, jsonLoaders('style', customLang[styleInfo.type]), styleInfo.styleFileName)
|
||||
output += 'var card_style =' +
|
||||
getRequireString(this, jsonLoaders('style', customLang[styleInfo.type]), styleInfo.styleFileName)
|
||||
}
|
||||
output = addJson(this, output, fileName, '')
|
||||
|
||||
@ -89,7 +90,8 @@ function loader(source) {
|
||||
compResourcepath + `?${customElementName}#${fileName}`)
|
||||
const compStyleInfo = findStyleFile(compFileName)
|
||||
if (compStyleInfo.extStyle == true) {
|
||||
output += `var card_element_style_${elementLastName} =` + getRequireString(this, jsonLoaders('style', customLang[compStyleInfo.type]),
|
||||
output += `var card_element_style_${elementLastName} =` +
|
||||
getRequireString(this, jsonLoaders('style', customLang[compStyleInfo.type]),
|
||||
compStyleInfo.styleFileName + `?${customElementName}#${fileName}`)
|
||||
}
|
||||
output = addJson(this, output, compFileName, `?${customElementName}#${fileName}`, elementLastName)
|
||||
|
@ -48,8 +48,8 @@ function sourceChange(key, assets, compilation) {
|
||||
const jsonOut = {};
|
||||
const source = assets[key].source();
|
||||
const str = source.match(/card_start((\s||\S)*)card_end/)[1];
|
||||
const arrary = str.split('\n');
|
||||
arrary.forEach(element => {
|
||||
const array = str.split('\n');
|
||||
array.forEach(element => {
|
||||
elementChange(element, source, jsonOut);
|
||||
});
|
||||
const assetReplace = {};
|
||||
|
@ -64,9 +64,9 @@ function validatorCustomTag(rules) {
|
||||
!isType.isObject(value),
|
||||
`The value of '${key}' is incorrect, it should be an object.`,
|
||||
);
|
||||
const childs = Object.keys(value);
|
||||
for (let j = 0; j < childs.length; j++) {
|
||||
const child = childs[j];
|
||||
const children = Object.keys(value);
|
||||
for (let j = 0; j < children.length; j++) {
|
||||
const child = children[j];
|
||||
throwError(
|
||||
child != 'attrs',
|
||||
`'${key}' object can only contain 'attrs' attributes`,
|
||||
|
@ -31,8 +31,8 @@ class SnapshotPlugin {
|
||||
this.options = options;
|
||||
}
|
||||
/**
|
||||
* Find all javacript file paths in the directory.
|
||||
* @param {Object} assets the object of javacript file path.
|
||||
* Find all javascript file paths in the directory.
|
||||
* @param {Object} assets the object of javascript file path.
|
||||
* @param {String} buildPath The path of build folder.
|
||||
* @return {Array} Image path array.
|
||||
*/
|
||||
@ -46,7 +46,7 @@ class SnapshotPlugin {
|
||||
return pathArray;
|
||||
};
|
||||
/**
|
||||
* Convert javacript file asynchronously. If an error occurs, print an error message.
|
||||
* Convert javascript file asynchronously. If an error occurs, print an error message.
|
||||
* @param {Object} compiler API specification, all configuration information of Webpack environment.
|
||||
*/
|
||||
apply(compiler) {
|
||||
|
@ -31,7 +31,7 @@ const {
|
||||
|
||||
/**
|
||||
* Split style into id Selectors and classSelectors.
|
||||
* @param {Obejct} value Preliminary compilation results of css files.
|
||||
* @param {Object} value Preliminary compilation results of css files.
|
||||
* @return {String} String result stylesheet.
|
||||
*/
|
||||
function transformStyle(value) {
|
||||
@ -70,8 +70,8 @@ function transformStyle(value) {
|
||||
|
||||
/**
|
||||
* keyFrame style special compilation.
|
||||
* @param {Obejct} obj Preliminary compilation results of keyFrame style.
|
||||
* @return {Obejct} keyFrame style obejct.
|
||||
* @param {Object} obj Preliminary compilation results of keyFrame style.
|
||||
* @return {Object} keyFrame style object.
|
||||
*/
|
||||
function keyFrameFormat(obj) {
|
||||
for (const key of Object.keys(obj)) {
|
||||
@ -190,8 +190,8 @@ const rules = [
|
||||
|
||||
/**
|
||||
* Loop and format style, There are two rules defined here, types of number+px and color convert to number 16777215.
|
||||
* @param {Obejct} obj Preliminary compilation results of style object.
|
||||
* @return {Obejct} style obejct.
|
||||
* @param {Object} obj Preliminary compilation results of style object.
|
||||
* @return {Object} style object.
|
||||
*/
|
||||
function styleFormat(obj) {
|
||||
let value = '';
|
||||
|
@ -132,7 +132,7 @@ const styleRules = [
|
||||
|
||||
/**
|
||||
* Compile the ast object into an executable function.
|
||||
* @param {Obejct} value template object compiled ast.
|
||||
* @param {Object} value template object compiled ast.
|
||||
* @return {String} template string.
|
||||
*/
|
||||
function transformTemplate(value) {
|
||||
@ -148,7 +148,7 @@ function transformTemplate(value) {
|
||||
|
||||
/**
|
||||
* Divided into if\for\ordinary three kinds node transform.
|
||||
* @param {Obejct} node template object compiled ast.
|
||||
* @param {Object} node template object compiled ast.
|
||||
* @return {String} template string.
|
||||
*/
|
||||
function transformNode(node) {
|
||||
@ -163,7 +163,7 @@ function transformNode(node) {
|
||||
|
||||
/**
|
||||
* Divide node into type/child/data three parts and compiled separately.
|
||||
* @param {Obejct} node ordinary node.
|
||||
* @param {Object} node ordinary node.
|
||||
* @return {String} ordinary node string.
|
||||
*/
|
||||
function transformNodeDetail(node) {
|
||||
@ -175,8 +175,8 @@ function transformNodeDetail(node) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile node all key-value datas.
|
||||
* @param {Obejct} node ordinary node.
|
||||
* Compile node all key-value data.
|
||||
* @param {Object} node ordinary node.
|
||||
* @return {String} ordinary node attributes string.
|
||||
*/
|
||||
function transformOptions(node) {
|
||||
@ -358,7 +358,7 @@ function formatForString(value) {
|
||||
|
||||
/**
|
||||
* compile "for" direct, return the _l function.
|
||||
* @param {Object} node node obejct with "for" directive.
|
||||
* @param {Object} node node object with "for" directive.
|
||||
* @return {String} string of _l function.
|
||||
*/
|
||||
function transformFor(node) {
|
||||
@ -379,7 +379,7 @@ function transformFor(node) {
|
||||
|
||||
/**
|
||||
* compile "if" direct, return the _i function.
|
||||
* @param {Object} node node obejct with "if" directive.
|
||||
* @param {Object} node node object with "if" directive.
|
||||
* @return {String} string of _i function.
|
||||
*/
|
||||
function transformIf(node) {
|
||||
|
Loading…
Reference in New Issue
Block a user