gant-core 2.0.2 → 2.0.4

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/bin/index.js +21 -1
  3. package/bin/styletext-loader.mjs +30 -0
  4. package/lib/cli/config/index.js +155 -2
  5. package/lib/cli/config/index.mjs +3 -0
  6. package/lib/cli/copyfiles/index.js +33 -2
  7. package/lib/cli/copyfiles/index.mjs +3 -0
  8. package/lib/cli/create/config/index.js +1226 -4
  9. package/lib/cli/create/config/index.mjs +11 -0
  10. package/lib/cli/create/index.js +4 -2
  11. package/lib/cli/create/index.mjs +3 -0
  12. package/lib/cli/create/module/index.js +33214 -2
  13. package/lib/cli/create/module/index.mjs +3 -0
  14. package/lib/cli/i18n/index.js +22179 -3
  15. package/lib/cli/i18n/index.mjs +10 -0
  16. package/lib/cli/i18n/utils.js +180 -2
  17. package/lib/cli/i18n/utils.mjs +3 -0
  18. package/lib/cli/index.js +3655 -2
  19. package/lib/cli/index.mjs +3 -0
  20. package/lib/cli/routes/index.js +75 -2
  21. package/lib/cli/routes/index.mjs +3 -0
  22. package/lib/cli/tsconfig/index.js +70 -2
  23. package/lib/cli/tsconfig/index.mjs +3 -0
  24. package/lib/cli/utils/detectPort.js +120 -2
  25. package/lib/cli/utils/detectPort.mjs +3 -0
  26. package/lib/cli/utils/getJavascriptfile.js +14 -2
  27. package/lib/cli/utils/getJavascriptfile.mjs +3 -0
  28. package/lib/cli/utils/index.js +4948 -2
  29. package/lib/cli/utils/index.mjs +3 -0
  30. package/lib/cli/webpack/Webpack.js +60 -2
  31. package/lib/cli/webpack/Webpack.mjs +3 -0
  32. package/lib/cli/webpack/config/analyzer.config.js +17 -2
  33. package/lib/cli/webpack/config/analyzer.config.mjs +3 -0
  34. package/lib/cli/webpack/config/browsers.js +13 -2
  35. package/lib/cli/webpack/config/browsers.mjs +3 -0
  36. package/lib/cli/webpack/config/cssRules.js +80 -2
  37. package/lib/cli/webpack/config/cssRules.mjs +3 -0
  38. package/lib/cli/webpack/config/default.config.js +179 -2
  39. package/lib/cli/webpack/config/default.config.mjs +3 -0
  40. package/lib/cli/webpack/config/development.config.js +45 -2
  41. package/lib/cli/webpack/config/development.config.mjs +3 -0
  42. package/lib/cli/webpack/config/framework/index.js +25 -2
  43. package/lib/cli/webpack/config/framework/index.mjs +3 -0
  44. package/lib/cli/webpack/config/framework/react.js +23 -2
  45. package/lib/cli/webpack/config/framework/react.mjs +3 -0
  46. package/lib/cli/webpack/config/framework/vue.js +33 -2
  47. package/lib/cli/webpack/config/framework/vue.mjs +3 -0
  48. package/lib/cli/webpack/config/index.js +23 -2
  49. package/lib/cli/webpack/config/index.mjs +3 -0
  50. package/lib/cli/webpack/config/production.config.js +74 -2
  51. package/lib/cli/webpack/config/production.config.mjs +3 -0
  52. package/lib/cli/webpack/plugins/copy.js +20 -2
  53. package/lib/cli/webpack/plugins/copy.mjs +3 -0
  54. package/lib/cli/webpack/plugins/index.js +4 -2
  55. package/lib/cli/webpack/plugins/index.mjs +3 -0
  56. package/package.json +2 -2
  57. package/rollup.config.js +5 -4
  58. package/.changeset/README.md +0 -8
  59. package/.changeset/config.json +0 -11
  60. package/lib/cli/acorn.js +0 -3
  61. package/lib/cli/angular.js +0 -3
  62. package/lib/cli/babel.js +0 -3
  63. package/lib/cli/estree.js +0 -3
  64. package/lib/cli/flow.js +0 -3
  65. package/lib/cli/glimmer.js +0 -3
  66. package/lib/cli/graphql.js +0 -3
  67. package/lib/cli/html.js +0 -3
  68. package/lib/cli/markdown.js +0 -3
  69. package/lib/cli/meriyah.js +0 -3
  70. package/lib/cli/msmain.js +0 -65
  71. package/lib/cli/postcss.js +0 -3
  72. package/lib/cli/typescript.js +0 -3
  73. package/lib/cli/yaml.js +0 -3
@@ -1,3 +1,181 @@
1
- #!/usr/bin/env node
2
- "use strict";var t=require("../utils/detectPort.js"),r=require("fs"),e=require("path"),i={exports:{}};const s=r.promises,a=e,o=new Error("skip this directory"),n={withFileTypes:!0},c=t=>t,l=async(t,r,e)=>{let i;if(!e){let r=a.basename(a.resolve(t));(e=await s.lstat(t).catch(c))instanceof Error?i=e:e.name=r}if(i=await r(i,t,e).catch(c),!1===i||o===i)return;if(i instanceof Error)throw i;if(!e.isDirectory())return;let f=await s.readdir(t,n).catch(c);if(f instanceof Error)return r(f,t,e);for(let e of f)await l(a.join(t,e.name),r,e)};var f={walk:l,skipDir:o};const u=r.promises,p=f,m=e,w={withFileTypes:!0},h={},y=t=>t;p.create=function(t){t||(t=h);const r=async(e,i,s)=>{let a,o;if(s||(s=e),"string"==typeof s){let t=m.basename(m.resolve(e));(s=await u.lstat(e).catch(y))instanceof Error?a=s:s.name=t}if(a=await i(a,e,s).catch(y),!1===a||p.skipDir===a)return;if(a instanceof Error)throw a;if(!s||!s.isDirectory())return;t.withFileStats||(o=w);let n=await u.readdir(e,o).catch(y);if(n instanceof Error)return i(n,e,s);t.sort&&(n=t.sort(n));for(let t of n)await r(m.join(e,t.name||t),i,t)};return r};var x=p;i.exports=f,i.exports.create=x.create;var d=i.exports,E=t.getDefaultExportFromCjs(d);exports.getFileList=function(t,r=[]){const e=[...r],i=E.create({sort:t=>t.filter(t=>!e.includes(t.name))});return new Promise(r=>{let e=[];i(t,(t,r,i)=>t?(console.log("err: ",t),e):(!i.isDirectory()&&/\.[j|t]sx?$/.test(i.name)&&e.push(r),Promise.resolve(e))).then(()=>r(e))})},exports.getFileTr=function(t){const e=r.readFileSync(t,"utf8"),i=/\btr\s*\(([^)]*)\)/g;let s;const a={};for(;null!==(s=i.exec(e));){const t=s[1].trim().split(",").map(t=>t.trim())[0].replace(/\'/g,"");a[t]=t}return a};
1
+ 'use strict';
2
+
3
+ var utils_detectPort = require('../utils/detectPort.js');
4
+ var fs$2 = require('fs');
5
+ var path$2 = require('path');
6
+
7
+ var walk$1 = {exports: {}};
8
+
9
+ const fs$1 = fs$2.promises;
10
+ const path$1 = path$2;
11
+
12
+ const skipDir = new Error("skip this directory");
13
+ const _withFileTypes$1 = { withFileTypes: true };
14
+ const pass = (err) => err;
15
+
16
+ // a port of Go's filepath.Walk
17
+ const walk = async (pathname, walkFunc, _dirent) => {
18
+ let err;
19
+
20
+ // special case of the very first run
21
+ if (!_dirent) {
22
+ let _name = path$1.basename(path$1.resolve(pathname));
23
+ _dirent = await fs$1.lstat(pathname).catch(pass);
24
+ if (_dirent instanceof Error) {
25
+ err = _dirent;
26
+ } else {
27
+ _dirent.name = _name;
28
+ }
29
+ }
30
+
31
+ // run the user-supplied function and either skip, bail, or continue
32
+ err = await walkFunc(err, pathname, _dirent).catch(pass);
33
+ if (false === err || skipDir === err) {
34
+ return;
35
+ }
36
+ if (err instanceof Error) {
37
+ throw err;
38
+ }
39
+
40
+ // "walk does not follow symbolic links"
41
+ if (!_dirent.isDirectory()) {
42
+ return;
43
+ }
44
+ let result = await fs$1.readdir(pathname, _withFileTypes$1).catch(pass);
45
+ if (result instanceof Error) {
46
+ return walkFunc(result, pathname, _dirent);
47
+ }
48
+ for (let dirent of result) {
49
+ await walk(path$1.join(pathname, dirent.name), walkFunc, dirent);
50
+ }
51
+ };
52
+
53
+ var walk_1 = {
54
+ walk,
55
+ skipDir,
56
+ };
57
+
58
+ const fs = fs$2.promises;
59
+ const Walk$1 = walk_1;
60
+ const path = path$2;
61
+ const _withFileTypes = { withFileTypes: true };
62
+ const _noopts = {};
63
+ const _pass = (err) => err;
64
+
65
+ // a port of Go's filepath.Walk
66
+ Walk$1.create = function (opts) {
67
+ if (!opts) {
68
+ opts = _noopts;
69
+ }
70
+
71
+ // a port of Go's filepath.Walk
72
+ const _walk = async (pathname, walkFunc, _dirent) => {
73
+ let err;
74
+
75
+ // special case of the very first run
76
+ if (!_dirent) {
77
+ _dirent = pathname;
78
+ }
79
+
80
+ // the first run, or if false === withFileTypes
81
+ if ("string" === typeof _dirent) {
82
+ let _name = path.basename(path.resolve(pathname));
83
+ _dirent = await fs.lstat(pathname).catch(_pass);
84
+ if (_dirent instanceof Error) {
85
+ err = _dirent;
86
+ } else {
87
+ _dirent.name = _name;
88
+ }
89
+ }
90
+
91
+ // run the user-supplied function and either skip, bail, or continue
92
+ err = await walkFunc(err, pathname, _dirent).catch(_pass);
93
+ if (false === err || Walk$1.skipDir === err) {
94
+ return;
95
+ }
96
+ if (err instanceof Error) {
97
+ throw err;
98
+ }
99
+
100
+ // "walk does not follow symbolic links"
101
+ if (!_dirent || !_dirent.isDirectory()) {
102
+ return;
103
+ }
104
+
105
+ // lightweight dirents or full lstat
106
+ let _readdirOpts;
107
+ if (!opts.withFileStats) {
108
+ _readdirOpts = _withFileTypes;
109
+ }
110
+
111
+ // TODO check if the error is "not a directory"
112
+ // (and thus allow false === opts.withFileTypes)
113
+ let result = await fs.readdir(pathname, _readdirOpts).catch(_pass);
114
+ if (result instanceof Error) {
115
+ return walkFunc(result, pathname, _dirent);
116
+ }
117
+ if (opts.sort) {
118
+ result = opts.sort(result);
119
+ }
120
+ for (let entity of result) {
121
+ await _walk(path.join(pathname, entity.name || entity), walkFunc, entity);
122
+ }
123
+ };
124
+
125
+ return _walk;
126
+ };
127
+
128
+ var create = Walk$1;
129
+
130
+ walk$1.exports = walk_1;
131
+ walk$1.exports.create = create.create;
132
+
133
+ var walkExports = walk$1.exports;
134
+ var Walk = /*@__PURE__*/utils_detectPort.getDefaultExportFromCjs(walkExports);
135
+
136
+ /**
137
+ * 获取文件列表
138
+ * @param dirPath
139
+ * @param outRules 排除的规则
140
+ * @return {Promise<string[]>}
141
+ */
142
+ function getFileList(dirPath, outRules = []) {
143
+ const rules = [...outRules];
144
+ const walk = Walk.create({
145
+ sort: (entities) => entities.filter((ent) => !rules.includes(ent.name)),
146
+ });
147
+ return new Promise((resolve) => {
148
+ let files = [];
149
+ walk(dirPath, (err, pathname, dirent) => {
150
+ if (err) {
151
+ console.log('err: ', err);
152
+ return files;
153
+ }
154
+ if (!dirent.isDirectory() && /\.[j|t]sx?$/.test(dirent.name)) {
155
+ files.push(pathname);
156
+ }
157
+ return Promise.resolve(files);
158
+ }).then(() => resolve(files));
159
+ });
160
+ }
161
+ function getFileTr(filePath) {
162
+ const fileContent = fs$2.readFileSync(filePath, 'utf8');
163
+ // 匹配 tr 方法的参数
164
+ const regex = /\btr\s*\(([^)]*)\)/g;
165
+ let matches;
166
+ const results = {};
167
+ while ((matches = regex.exec(fileContent)) !== null) {
168
+ // 匹配到的内容存储在matches数组的第二个元素中
169
+ const parameters = matches[1]
170
+ .trim()
171
+ .split(',')
172
+ .map((param) => param.trim());
173
+ const matchValue = parameters[0].replace(/\'/g, '');
174
+ results[matchValue] = matchValue;
175
+ }
176
+ return results;
177
+ }
178
+
179
+ exports.getFileList = getFileList;
180
+ exports.getFileTr = getFileTr;
3
181
  //# sourceMappingURL=utils.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{g as r}from"../utils/detectPort.mjs";import t from"fs";import e from"path";var i={exports:{}};const a=t.promises,o=e,s=new Error("skip this directory"),n={withFileTypes:!0},c=r=>r,f=async(r,t,e)=>{let i;if(!e){let t=o.basename(o.resolve(r));(e=await a.lstat(r).catch(c))instanceof Error?i=e:e.name=t}if(i=await t(i,r,e).catch(c),!1===i||s===i)return;if(i instanceof Error)throw i;if(!e.isDirectory())return;let l=await a.readdir(r,n).catch(c);if(l instanceof Error)return t(l,r,e);for(let e of l)await f(o.join(r,e.name),t,e)};var l={walk:f,skipDir:s};const m=t.promises,p=l,u=e,w={withFileTypes:!0},h={},y=r=>r;p.create=function(r){r||(r=h);const t=async(e,i,a)=>{let o,s;if(a||(a=e),"string"==typeof a){let r=u.basename(u.resolve(e));(a=await m.lstat(e).catch(y))instanceof Error?o=a:a.name=r}if(o=await i(o,e,a).catch(y),!1===o||p.skipDir===o)return;if(o instanceof Error)throw o;if(!a||!a.isDirectory())return;r.withFileStats||(s=w);let n=await m.readdir(e,s).catch(y);if(n instanceof Error)return i(n,e,a);r.sort&&(n=r.sort(n));for(let r of n)await t(u.join(e,r.name||r),i,r)};return t};var d=p;i.exports=l,i.exports.create=d.create;var v=r(i.exports);function x(r,t=[]){const e=[...t],i=v.create({sort:r=>r.filter(r=>!e.includes(r.name))});return new Promise(t=>{let e=[];i(r,(r,t,i)=>r?(console.log("err: ",r),e):(!i.isDirectory()&&/\.[j|t]sx?$/.test(i.name)&&e.push(t),Promise.resolve(e))).then(()=>t(e))})}function E(r){const e=t.readFileSync(r,"utf8"),i=/\btr\s*\(([^)]*)\)/g;let a;const o={};for(;null!==(a=i.exec(e));){const r=a[1].trim().split(",").map(r=>r.trim())[0].replace(/\'/g,"");o[r]=r}return o}export{E as a,x as g};
3
+ //# sourceMappingURL=utils.mjs.map