efront 4.0.13 → 4.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/#/345/233/275/351/231/205/345/214/226.yml +574 -1
- package/apps/drequest/index.html +10 -0
- package/coms/basic/#loader.js +2 -1
- package/coms/basic/YAML.js +3 -3
- package/coms/basic/parseYML.js +4 -1
- package/coms/basic/parseYML_test.js +3 -1
- package/coms/basic/strings.js +22 -15
- package/coms/basic_/readme-en.md +112 -0
- package/coms/basic_/readme.md +1 -1
- package/coms/compile/common.js +1 -0
- package/coms/compile/downLevel.js +8 -4
- package/coms/compile/translate.js +3 -3
- package/coms/compile/unstruct.js +44 -26
- package/coms/compile/unstruct_test.js +3 -1
- package/coms/docs/helps.js +69 -65
- package/coms/zimoli/data.js +10 -10
- package/coms/zimoli/table.html +4 -4
- package/docs/compare-en.md +327 -0
- package/docs/components.jsp +1 -1
- package/docs/main.xht +18 -18
- package/docs/version-desc.md +11 -0
- package/docs/welcome.jsp +1 -1
- package/docs//345/221/275/344/273/244.xht +12 -6
- package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +54 -53
- package/docs//345/267/245/345/205/267//345/255/227/347/254/246/351/233/206/346/243/200/346/237/245.xht +7 -7
- package/docs//347/273/204/344/273/266.xht +12 -12
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/readme-en.md +168 -0
- package/readme.md +16 -7
package/readme-en.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
|
|
2
|
+
[中文版](./readme.md)
|
|
3
|
+
*efront* is a development tool that can be used independently to develop projects or to use only one of its functions
|
|
4
|
+
# efront ideology
|
|
5
|
+
1. Each file only exports one piece of data, which can be any of boolean, number, string, function, object, bigint, null, undefined
|
|
6
|
+
2. The file name is the variable name. To reference variables exported from the current file in other files, simply use the file name of the current file (without a suffix)
|
|
7
|
+
3. No circular references (mutual invocation: a references b, b references a; head-to-tail reference: a references b, b references... c, c references a)
|
|
8
|
+
4. Reduce the time for asynchronous IO, only load useful code during the application startup process, and wait for user actions while preloading the next step of code after startup is completed
|
|
9
|
+
5. Partial version update, each code loaded asynchronously has an independent version number, and is not loaded repeatedly when there is no change in version information
|
|
10
|
+
|
|
11
|
+
# efront Function List
|
|
12
|
+
|
|
13
|
+
1. Provide a development server that starts in 0 seconds, allowing code to complete asynchronous loading of dependencies in the browser
|
|
14
|
+
2. Provide a compilation environment for 'code referenced by file name', allowing developers to avoid writing statements such as `import` and `require`
|
|
15
|
+
3. Provide loaders with circular check
|
|
16
|
+
4. Automatically recognize and attach preloaded logic
|
|
17
|
+
5. Automatically append check cache logic and generate code version numbers
|
|
18
|
+
6. `efront` server provides cross domain relay function
|
|
19
|
+
7. `efront` compile and export components to extract and encrypt strings and attributes that may cause code to be readable
|
|
20
|
+
|
|
21
|
+
# Basic commands (some commands are applicable to Windows, similar to other systems)
|
|
22
|
+
|
|
23
|
+
## 1. Install
|
|
24
|
+
|
|
25
|
+
`efront` runs on [nodejs](https://nodejs.org/zh-cn/). Please use it after installing [nodejs](https://nodejs.org/zh-cn/)
|
|
26
|
+
|
|
27
|
+
Global installation of efront from NPM
|
|
28
|
+
|
|
29
|
+
```bat
|
|
30
|
+
npm install -g efront
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 2. View Help System
|
|
34
|
+
|
|
35
|
+
The command line help commands are as follows
|
|
36
|
+
|
|
37
|
+
```bat
|
|
38
|
+
efront help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
You can also use the following command to start the document server and view help information using a browser
|
|
42
|
+
|
|
43
|
+
```bat
|
|
44
|
+
efront docs
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 3. Start the development environment server
|
|
48
|
+
|
|
49
|
+
```bat
|
|
50
|
+
efront live
|
|
51
|
+
efront live HTTP_PORT
|
|
52
|
+
efront live HTTP_PORT HTTPS_PORT
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The HTTP_PORT and HTTPS_PORT are number and can be left blank. For more usage options, please refer to the help system. To disable the warning message when the HTTPS service port is opened, you can configure your own SSL certificate path and certificate password.
|
|
56
|
+
|
|
57
|
+
## 4. Compress Compilation Project
|
|
58
|
+
|
|
59
|
+
By default, the compiled Object code will be saved to the `public` directory
|
|
60
|
+
You can publish the code of the `public` directory to any server
|
|
61
|
+
|
|
62
|
+
```bat
|
|
63
|
+
set app=PROJECT_NAME
|
|
64
|
+
set public_path=PUBLIC_PATH
|
|
65
|
+
efront public
|
|
66
|
+
```
|
|
67
|
+
`PUBLIC_PATH` is the publishing path
|
|
68
|
+
|
|
69
|
+
* If you want to publish on the server, it is not recommended to use a method that ends in `.html` and write the asynchronously loaded code to a separate file
|
|
70
|
+
|
|
71
|
+
* If you want to export a project that can be accessed locally without a server, you can set a project name that ends in `.html` and merge the asynchronously loaded code into the homepage file
|
|
72
|
+
|
|
73
|
+
```bat
|
|
74
|
+
set app=PROJECT_NAME.html
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
* If you want to export components, you can set a project name that ends in `. js`
|
|
78
|
+
|
|
79
|
+
```bat
|
|
80
|
+
set app=PROJECT_NAME.js
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
* The current version of efront provides incomplete support for the `require` syntax in commonjs and the `import` syntax in es6 (asynchronous ring calls are not supported). For relevant projects that meet the requirements, they can be compiled and published.
|
|
84
|
+
* If you want to publish a component with the require syntax and want to merge the component and all dependencies for output, you can replace the `efront public` above with `efront publish`
|
|
85
|
+
|
|
86
|
+
* If automatic path recognition is required, directories such as `public` / `dist` / `output` / `release` may be recognized as target paths, and files in these paths may be overwritten. If it is confirmed to be feasible, use `efront build`
|
|
87
|
+
|
|
88
|
+
## 5. Watch mode
|
|
89
|
+
|
|
90
|
+
Monitor file changes, automatically compile updated parts and output them to the specified directory
|
|
91
|
+
|
|
92
|
+
```bat
|
|
93
|
+
set app=PROJECT_NAME
|
|
94
|
+
set public_path=PUBLIC_PATH
|
|
95
|
+
efront watch
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
# Description of configurable items
|
|
99
|
+
|
|
100
|
+
`efront` prioritizes reading configurations from system environment variables, and can also write configuration information to configuration files.
|
|
101
|
+
`efront` defaults to reading the`_envs/`and the `.efront/_envs/` of the user directory to initializes the environment configuration (if you want to modify the path of the default environment configuration, you can set `CONFIG_PATH` in the system environment variable, and multiple directories can be separated by commas in English), where `setup. bat` is the entry of the environment configuration. When you access a subproject `APP` of the Working directory, it will also be automatically read onfiguration in `_envs/app=%APP%.bat`.
|
|
102
|
+
|
|
103
|
+
The current version of `efront` supports quick configuration of environment variables on the command line, such as
|
|
104
|
+
|
|
105
|
+
```bat
|
|
106
|
+
efront watch --APP=kugou --PUBLIC_PATH=... --PAGE_PATH=...
|
|
107
|
+
```
|
|
108
|
+
| configuration item | illustrate |
|
|
109
|
+
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| `APP` | Application name, which affects the final generated application path and default source file path |
|
|
111
|
+
| `PAGE_PATH` | The root path where the page file is stored, defaults to `./apps` |
|
|
112
|
+
| `COMM_PATH` | The root path where the component file is stored. If there are multiple paths, they can be separated by `,`. and `:` can be used to specify the path to the component provided by `efront`. The default is`./coms` |
|
|
113
|
+
| `PUBLIC_PATH` | The target root path for publishing, and the final generated code path is `PUBLIC_PATH/APP`, if this item is specified as `PAGE_PATH`, efront will disable the publishing function. After executing `efront start`, the compressed version of the code can be accessed through a browser |
|
|
114
|
+
| `PUBLIC_EXTT` | The extension of the published logical code, which defaults to `.js` or `.txt` |
|
|
115
|
+
| `PAGE` | The path where the page file is stored, defaults to the application name `APP` |
|
|
116
|
+
| `COMM` | The path where the component files are stored, with the default being the application name and the default component library `APP,zimoli` |
|
|
117
|
+
| `PREFIX` | Specify the component className prefix when publishing, with no prefix by default |
|
|
118
|
+
| `NOPROXY` | Traditional agents are enabled by default in the development environment and disabled in the production environment |
|
|
119
|
+
| `PATH.SSL_PFX` | The path of the SSL certificate, which should be in pfx format的 |
|
|
120
|
+
| `PASSWORD.SSL_PFX` | SSL certificate password |
|
|
121
|
+
| `DIRECT` | If `pathname` is used as the page path for a single page application, this parameter can be configured so that all empty paths point to the path specified by this parameter. If configured as a numerical value, the first few levels of the user path are automatically truncated. If specified as a string, all empty paths return the content under that string path. |
|
|
122
|
+
| `ENTRY_NAME` | `efront` defaults to sequentially searching for the declared `main`, `Main`, `main`, and `<file name>` in the file as the export object (entry). Users can configure this environment variable to make modifications |
|
|
123
|
+
| `EXTRACT` | If the project has multiple entries, `efront` defaults to writing the main program to a separate file. If the project is a single entry, `efront` defaults to incorporating the main program into index.html. If your code has special requirements, you can configure this parameter to specify the behavior of `efront` |
|
|
124
|
+
| `UPLEVEL` | If you do not need to downgrade your code when publishing, you can add this parameter to improve compilation speed |
|
|
125
|
+
| `MSIE` | Starting the server with `efront live --msie` allows for code adaptation of the `ie` series of browsers for dynamic debugging on `ie` |
|
|
126
|
+
| `AUTOEVAL` | The automatic constant switch is on by default when packaging Object code, and off by default in the development environment. You can specify parameters `--no-autoeval` or `--autoeval` to modify the default behavior of `efront` |
|
|
127
|
+
|
|
128
|
+
# Function Options
|
|
129
|
+
|
|
130
|
+
* The server started by efront provides cross domain transfer function by default, and can be set to `window.cross_host = "https://somehost/"` in the header script of `index.html` to specify a specific efront server instance for the cross method to use
|
|
131
|
+
* Efront has disabled the caching function on the homepage by default. If you want to enable it, you can add `window.preventCache=false;` in the header script
|
|
132
|
+
* Efront is disabled from running in iframe by default. If you want to enable it, you can add `window.PREVENT_FRAMEWORK_MODE=false;` in the header script
|
|
133
|
+
* The default initialization script for efront application is `zimoli('/main');`,You can add `main-path=...` as a property of `<body>` to specifies the path to the initialization script
|
|
134
|
+
* efront default the `.ts,.js,.mjs,.cjs,.less,.html,.xht,.vue` files in the path `PAGE_PATH` pointed to are recognized as page files,You can add `<script src='libpath/*' type=deleteoncompile></script>`, where `libpath/*` points to the path of the static file, The `efront` compilation process will recognize and make the correct processing
|
|
135
|
+
* If used only as a cross domain server, the URL of the development environment can be rewritten as follows to include cross domain headers in the returned results:
|
|
136
|
+
1. Forward HTTP using `*` `http://EFRONT_HOST/*BACKEND_HOST/PATHNAME`
|
|
137
|
+
2. Forward HTTPS using `**` `http://EFRONT_HOST/**BACKEND_HOST/PATHNAME`
|
|
138
|
+
|
|
139
|
+
<br/>For example:
|
|
140
|
+
Start the efront server on port 88 of local machine. To access `https://im.qq.com/index`, can request `http://localhost:88/**im.qq.com/index` to get data with cross domain headers
|
|
141
|
+
|
|
142
|
+
# note
|
|
143
|
+
|
|
144
|
+
* When version updating, efront try to be compatible with the old version of the project as much as possible. If there are incompatibilities, you can roll back to the previous version. The project or component published by efront contains the efront version used when publishing the project. If it is a standalone component, the version information is usually in the header of the component file. If it is a project, the version information is in the index. html of the project. The command for the specified version of Anjiang is as follows
|
|
145
|
+
```bat
|
|
146
|
+
npm install -g efront@version
|
|
147
|
+
```
|
|
148
|
+
You can also click on [github](https://github.com/yunxu1019/efront/issues). The issue mentioned above can be in Chinese or English, and other languages are not prohibited, but the author may not be able to fully understand it.
|
|
149
|
+
|
|
150
|
+
* The longer `className` selector generated by efront for the component (including the middle line, such as '.coms-button ') may change. If you want to style the embedded component, you can use the shorter `className` selector generated by efront for it (without the middle line, such as `.button`)
|
|
151
|
+
*
|
|
152
|
+
* efront recognizes the `$` not in the first character position as a shortcut separator, so that modules in multi-level folders can be introduced as variable names. When naming files, do not use the `$` symbol in the middle of the file name
|
|
153
|
+
* The variables in the `with` statement cannot be accurately identified and should not be used. If you must use it in the `efront` environment, please declare the undeclared variables that appear in the `with` statement in advance.
|
|
154
|
+
* If you want to export a serverless project, do not use asynchronous methods to load data from local files
|
|
155
|
+
* Starting from efront 2.5, 'template' will be recognized as an efront Reserved word, which is specifically used to refer to the content of html files with the same name
|
|
156
|
+
* Starting from efront 3.29, the '.xht' file will be recognized as a component file. If no entry is provided in the file, the entry function will be automatically generated and filled in by efront
|
|
157
|
+
|
|
158
|
+
# Related Links
|
|
159
|
+
|
|
160
|
+
[efront Online Documents](http://efront.cc/docs/)
|
|
161
|
+
|
|
162
|
+
[efront Compatibility Description](coms/basic_/readme-en.md)
|
|
163
|
+
[Version Introduction](docs/version-spec.md)
|
|
164
|
+
[Compared to the front-end framework](docs/compare-en.md)
|
|
165
|
+
|
|
166
|
+
[酷酷千百易云音乐](http://efront.cc/kugou/)
|
|
167
|
+
|
|
168
|
+
[白前看图](https://efront.cc/baiplay)
|
package/readme.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
|
|
2
|
+
[English version](./readme-en.md)
|
|
3
|
+
|
|
2
4
|
*efront* 是一个开发工具,可以独立开发项目,也可以仅使用其一项功能
|
|
3
5
|
# efront 思想
|
|
4
6
|
1. 每个文件只导出一份数据,这一份数据可以是 boolean,number,string,function,object,bigint,null,undefined 中的任意一种
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
6. `efront` 服务器提供跨域中转功能
|
|
18
20
|
7. `efront` 编译导出的组件对可能造成代码可读的字符串和属性进行提取和加密
|
|
19
21
|
|
|
20
|
-
# 基本命令(部分命令适用于windows
|
|
22
|
+
# 基本命令(部分命令适用于windows,其他系统类似)
|
|
21
23
|
|
|
22
24
|
## 1. 下载安装
|
|
23
25
|
|
|
@@ -30,19 +32,26 @@ npm install -g efront
|
|
|
30
32
|
|
|
31
33
|
## 2. 查看帮助系统
|
|
32
34
|
|
|
35
|
+
命令行帮助命令如下
|
|
33
36
|
```bat
|
|
34
37
|
efront help
|
|
35
38
|
```
|
|
36
39
|
|
|
40
|
+
也可以用如下命令启动文档服务器,用浏览器查看帮助信息
|
|
41
|
+
|
|
42
|
+
```bat
|
|
43
|
+
efront docs
|
|
44
|
+
```
|
|
45
|
+
|
|
37
46
|
## 3. 启动开发环境服务器
|
|
38
47
|
|
|
39
48
|
```bat
|
|
40
49
|
efront live
|
|
41
|
-
efront live
|
|
42
|
-
efront live
|
|
50
|
+
efront live HTTP端口
|
|
51
|
+
efront live HTTP端口 HTTPS端口
|
|
43
52
|
```
|
|
44
53
|
|
|
45
|
-
|
|
54
|
+
其中`HTTP端口`和`HTTPS端口`为数字,可以不输入,更多使用方案可以查看帮助系统。要禁用https服务端口开启时的警告信息,可以配置自己的ssl证书路径和证书密码。
|
|
46
55
|
|
|
47
56
|
## 4. 压缩编译项目
|
|
48
57
|
|
|
@@ -121,8 +130,8 @@ efront 默认读取当前路径下的`_envs/`和用户目录的`.efront/_envs/`
|
|
|
121
130
|
* efront 启动的服务器,默认提供跨域中转的功能,可以在index.html的头部脚本中设置`window.cross_host='https://somehost/'`指定一个具体的efront服务器实例供cross方法使用
|
|
122
131
|
* efront 默认禁用了首页的缓存功能,如果要启用,可以在头部script中加入 `window.preventCache=false;`
|
|
123
132
|
* efront 默认禁止在iframe中运行,如果要开启,可以在头部script中加入 `window.PREVENT_FRAMEWORK_MODE=false;`
|
|
124
|
-
* efront
|
|
125
|
-
* efront 默认将`page_path`指向的路径中的`.ts,.js,.less,.html`文件识别为页面文件,可以在index.html加上`<script src='libpath/*' type=deleteoncompile></script>`,其中`libpath/*`指向静态文件的路径,efront编译过程将识别并做出正确的处理
|
|
133
|
+
* efront应用的默认初始化脚本是`zimoli('/main');`,可以在body标签上加上`main-path=...`属性指定初始化脚本的路径
|
|
134
|
+
* efront 默认将`page_path`指向的路径中的`.ts,.js,.mjs,.cjs,.less,.html,.xht,.vue`文件识别为页面文件,可以在index.html加上`<script src='libpath/*' type=deleteoncompile></script>`,其中`libpath/*`指向静态文件的路径,efront编译过程将识别并做出正确的处理
|
|
126
135
|
* 如果仅做为跨域服务器使用,可以将开发环境的url改写为如下形式,以使返回结果加上跨域头:
|
|
127
136
|
1. 转发http 用 `*` `http://EFRONT_HOST/*BACKEND_HOST/PATHNAME`
|
|
128
137
|
2. 转发https 用 `**` `http://EFRONT_HOST/**BACKEND_HOST/PATHNAME`
|
|
@@ -132,7 +141,7 @@ efront 默认读取当前路径下的`_envs/`和用户目录的`.efront/_envs/`
|
|
|
132
141
|
|
|
133
142
|
# 注意事项
|
|
134
143
|
|
|
135
|
-
* efront
|
|
144
|
+
* efront版本更新后,尽可能兼容老版本的项目,如果出现不兼容的情况,可以回退到之前的版本。efront发布的项目或组件中含有发布项目时所用的efront版本。如果是独立组件,版本信息一般在组件文件的头部,如果是项目,版本信息在项目的index.html中。安将指定的版本的命令如下
|
|
136
145
|
```bat
|
|
137
146
|
npm install -g efront@版本号
|
|
138
147
|
```
|