@rsmax/shared 1.3.14 → 2.0.0-canary.91
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/cjs/index.d.ts +0 -5
- package/cjs/index.js +0 -12
- package/cjs/path.js +1 -2
- package/cjs/unique.js +1 -2
- package/esm/index.d.ts +0 -5
- package/esm/index.js +0 -5
- package/package.json +3 -3
- package/cjs/nativeComponent/getAssets.d.ts +0 -2
- package/cjs/nativeComponent/getAssets.js +0 -23
- package/cjs/nativeComponent/helpers.d.ts +0 -6
- package/cjs/nativeComponent/helpers.js +0 -59
- package/cjs/nativeComponent/jsHelper.d.ts +0 -2
- package/cjs/nativeComponent/jsHelper.js +0 -83
- package/cjs/nativeComponent/json.d.ts +0 -1
- package/cjs/nativeComponent/json.js +0 -14
- package/cjs/nativeComponent/modules.d.ts +0 -2
- package/cjs/nativeComponent/modules.js +0 -78
- package/cjs/nativeComponent/style.d.ts +0 -3
- package/cjs/nativeComponent/style.js +0 -38
- package/cjs/nativeComponent/template.d.ts +0 -3
- package/cjs/nativeComponent/template.js +0 -61
- package/cjs/nativeComponent/usingComponents.d.ts +0 -2
- package/cjs/nativeComponent/usingComponents.js +0 -46
- package/esm/nativeComponent/getAssets.d.ts +0 -2
- package/esm/nativeComponent/getAssets.js +0 -17
- package/esm/nativeComponent/helpers.d.ts +0 -6
- package/esm/nativeComponent/helpers.js +0 -27
- package/esm/nativeComponent/jsHelper.d.ts +0 -2
- package/esm/nativeComponent/jsHelper.js +0 -54
- package/esm/nativeComponent/json.d.ts +0 -1
- package/esm/nativeComponent/json.js +0 -11
- package/esm/nativeComponent/modules.d.ts +0 -2
- package/esm/nativeComponent/modules.js +0 -49
- package/esm/nativeComponent/style.d.ts +0 -3
- package/esm/nativeComponent/style.js +0 -30
- package/esm/nativeComponent/template.d.ts +0 -3
- package/esm/nativeComponent/template.js +0 -30
- package/esm/nativeComponent/usingComponents.d.ts +0 -2
- package/esm/nativeComponent/usingComponents.js +0 -40
package/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
export * from './path';
|
|
2
2
|
export * from './unique';
|
|
3
|
-
export { isNativeComponent, getNativeEntryAssetOutputPath } from './nativeComponent/helpers';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated getNativeComponentAssets 在新版本里面废弃了
|
|
6
|
-
*/
|
|
7
|
-
export { default as getNativeComponentAssets } from './nativeComponent/getAssets';
|
package/cjs/index.js
CHANGED
|
@@ -13,18 +13,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.getNativeComponentAssets = exports.getNativeEntryAssetOutputPath = exports.isNativeComponent = void 0;
|
|
21
17
|
__exportStar(require("./path"), exports);
|
|
22
18
|
__exportStar(require("./unique"), exports);
|
|
23
|
-
var helpers_1 = require("./nativeComponent/helpers");
|
|
24
|
-
Object.defineProperty(exports, "isNativeComponent", { enumerable: true, get: function () { return helpers_1.isNativeComponent; } });
|
|
25
|
-
Object.defineProperty(exports, "getNativeEntryAssetOutputPath", { enumerable: true, get: function () { return helpers_1.getNativeEntryAssetOutputPath; } });
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated getNativeComponentAssets 在新版本里面废弃了
|
|
28
|
-
*/
|
|
29
|
-
var getAssets_1 = require("./nativeComponent/getAssets");
|
|
30
|
-
Object.defineProperty(exports, "getNativeComponentAssets", { enumerable: true, get: function () { return __importDefault(getAssets_1).default; } });
|
package/cjs/path.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.slash =
|
|
3
|
+
exports.slash = slash;
|
|
4
4
|
function slash(path) {
|
|
5
5
|
if (!path) {
|
|
6
6
|
return path;
|
|
7
7
|
}
|
|
8
8
|
return /^\\\\\?\\/.test(path) ? path : path.replace(/\\/g, '/');
|
|
9
9
|
}
|
|
10
|
-
exports.slash = slash;
|
package/cjs/unique.js
CHANGED
package/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
export * from './path';
|
|
2
2
|
export * from './unique';
|
|
3
|
-
export { isNativeComponent, getNativeEntryAssetOutputPath } from './nativeComponent/helpers';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated getNativeComponentAssets 在新版本里面废弃了
|
|
6
|
-
*/
|
|
7
|
-
export { default as getNativeComponentAssets } from './nativeComponent/getAssets';
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
export * from './path';
|
|
2
2
|
export * from './unique';
|
|
3
|
-
export { isNativeComponent, getNativeEntryAssetOutputPath } from './nativeComponent/helpers';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated getNativeComponentAssets 在新版本里面废弃了
|
|
6
|
-
*/
|
|
7
|
-
export { default as getNativeComponentAssets } from './nativeComponent/getAssets';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsmax/shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-canary.91+5982cbe",
|
|
4
4
|
"description": "Rsmax Shared",
|
|
5
5
|
"homepage": "https://remax.wdchiphop.cn",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"resolve": "^1.12.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@rsmax/types": "
|
|
29
|
+
"@rsmax/types": "2.0.0-canary.91+5982cbe",
|
|
30
30
|
"@types/babel__traverse": "^7.0.8",
|
|
31
31
|
"@types/htmlparser2": "^3.10.1",
|
|
32
32
|
"@types/lodash": "^4.14.135",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "5982cbe3e1e3a3bf52fa41d0c31bfb043277f669"
|
|
47
47
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsHelper_1 = __importDefault(require("./jsHelper"));
|
|
7
|
-
const json_1 = __importDefault(require("./json"));
|
|
8
|
-
const modules_1 = __importDefault(require("./modules"));
|
|
9
|
-
const style_1 = __importDefault(require("./style"));
|
|
10
|
-
const template_1 = __importDefault(require("./template"));
|
|
11
|
-
const usingComponents_1 = __importDefault(require("./usingComponents"));
|
|
12
|
-
function getAssets(platformConfig, resourcePath, options) {
|
|
13
|
-
const assets = [
|
|
14
|
-
...(0, modules_1.default)(options, resourcePath),
|
|
15
|
-
...(0, jsHelper_1.default)(platformConfig, resourcePath),
|
|
16
|
-
...(0, style_1.default)(platformConfig, resourcePath),
|
|
17
|
-
...(0, json_1.default)(resourcePath),
|
|
18
|
-
...(0, template_1.default)(platformConfig, options, resourcePath),
|
|
19
|
-
...(0, usingComponents_1.default)(resourcePath, options).reduce((acc, id) => [...acc, ...getAssets(platformConfig, id, options)], []),
|
|
20
|
-
];
|
|
21
|
-
return assets;
|
|
22
|
-
}
|
|
23
|
-
exports.default = getAssets;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const isNativeComponent: (sourcePath: string | null) => boolean;
|
|
2
|
-
export declare const getPath: (from: string, to: string) => string;
|
|
3
|
-
export declare function getNativeEntryAssetOutputPath(sourcePath: string, options: {
|
|
4
|
-
cwd: string;
|
|
5
|
-
rootDir: string;
|
|
6
|
-
}): string;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getNativeEntryAssetOutputPath = exports.getPath = exports.isNativeComponent = void 0;
|
|
30
|
-
const fs = __importStar(require("node:fs"));
|
|
31
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
32
|
-
const path_1 = require("../path");
|
|
33
|
-
const isNativeComponent = (sourcePath) => {
|
|
34
|
-
if (!sourcePath) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
if (node_path_1.default.extname(sourcePath) !== '.js') {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
const sourceJsonPath = sourcePath.replace(/\.js$/, '.json');
|
|
41
|
-
if (!fs.existsSync(sourceJsonPath)) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
return require(sourceJsonPath).component;
|
|
45
|
-
};
|
|
46
|
-
exports.isNativeComponent = isNativeComponent;
|
|
47
|
-
const getPath = (from, to) => {
|
|
48
|
-
return (0, path_1.slash)(node_path_1.default.resolve(node_path_1.default.dirname(from), to));
|
|
49
|
-
};
|
|
50
|
-
exports.getPath = getPath;
|
|
51
|
-
const NATIVE_COMPONENT_OUTPUT_DIR = 'remaxVendors';
|
|
52
|
-
function getNativeEntryAssetOutputPath(sourcePath, options) {
|
|
53
|
-
return `${NATIVE_COMPONENT_OUTPUT_DIR}/${(0, path_1.slash)(sourcePath)
|
|
54
|
-
.replace(`${(0, path_1.slash)(options.cwd)}/`, '')
|
|
55
|
-
.replace(`${(0, path_1.slash)(options.rootDir)}/`, '')
|
|
56
|
-
.replace(/@/g, '_')
|
|
57
|
-
.replace(/node_modules/g, 'npm')}`;
|
|
58
|
-
}
|
|
59
|
-
exports.getNativeEntryAssetOutputPath = getNativeEntryAssetOutputPath;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
30
|
-
const babelParser = __importStar(require("@babel/parser"));
|
|
31
|
-
const traverse_1 = __importDefault(require("@babel/traverse"));
|
|
32
|
-
const htmlparser2 = __importStar(require("htmlparser2"));
|
|
33
|
-
const lodash_1 = require("lodash");
|
|
34
|
-
const helpers_1 = require("./helpers");
|
|
35
|
-
const walk = (jsHelperPath, jsHelpers) => {
|
|
36
|
-
const jsHelperContent = node_fs_1.default.readFileSync(jsHelperPath).toString();
|
|
37
|
-
const ast = babelParser.parse(jsHelperContent, {
|
|
38
|
-
sourceType: 'module',
|
|
39
|
-
});
|
|
40
|
-
const extract = ({ node }) => {
|
|
41
|
-
const importPath = ((0, lodash_1.get)(node, 'callee.name') === 'require' ? (0, lodash_1.get)(node, 'arguments[0].value') : '') || (0, lodash_1.get)(node, 'source.value');
|
|
42
|
-
if (!importPath) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const absolutePath = (0, helpers_1.getPath)(jsHelperPath, importPath);
|
|
46
|
-
jsHelpers.add(absolutePath);
|
|
47
|
-
walk(absolutePath, jsHelpers);
|
|
48
|
-
};
|
|
49
|
-
(0, traverse_1.default)(ast, {
|
|
50
|
-
CallExpression: extract,
|
|
51
|
-
ImportDeclaration: extract,
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
const parseTemplate = (filePath, jsHelpers, jsHelper) => {
|
|
55
|
-
const parser = new htmlparser2.Parser({});
|
|
56
|
-
const { tag, src } = jsHelper;
|
|
57
|
-
const content = node_fs_1.default.readFileSync(filePath).toString();
|
|
58
|
-
parser._cbs.onopentag = (name, attrs) => {
|
|
59
|
-
if (name === tag && attrs[src]) {
|
|
60
|
-
const jsHelperPath = (0, helpers_1.getPath)(filePath, attrs[src]);
|
|
61
|
-
if (!node_fs_1.default.existsSync(jsHelperPath)) {
|
|
62
|
-
console.error(`文件 ${jsHelperPath} 不存在`);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
walk(jsHelperPath, jsHelpers);
|
|
66
|
-
jsHelpers.add(jsHelperPath);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
parser.reset();
|
|
70
|
-
parser.write(content);
|
|
71
|
-
parser.end();
|
|
72
|
-
};
|
|
73
|
-
function jsHelper(platformConfig, id) {
|
|
74
|
-
const jsHelpers = new Set();
|
|
75
|
-
const { jsHelper, template } = platformConfig;
|
|
76
|
-
if (!jsHelper) {
|
|
77
|
-
return [];
|
|
78
|
-
}
|
|
79
|
-
const templatePath = id.replace(/\.js$/, template.extension);
|
|
80
|
-
parseTemplate(templatePath, jsHelpers, jsHelper);
|
|
81
|
-
return Array.from(jsHelpers);
|
|
82
|
-
}
|
|
83
|
-
exports.default = jsHelper;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function json(id: string): string[];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const node_fs_1 = require("node:fs");
|
|
4
|
-
function json(id) {
|
|
5
|
-
const filePath = id.replace(/\.js$/, '.json');
|
|
6
|
-
const jsonPaths = new Set();
|
|
7
|
-
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
8
|
-
console.error(`文件 ${filePath} 不存在`);
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
jsonPaths.add(filePath);
|
|
12
|
-
return Array.from(jsonPaths);
|
|
13
|
-
}
|
|
14
|
-
exports.default = json;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const fs = __importStar(require("node:fs"));
|
|
30
|
-
const babelParser = __importStar(require("@babel/parser"));
|
|
31
|
-
const traverse_1 = __importDefault(require("@babel/traverse"));
|
|
32
|
-
const lodash_1 = require("lodash");
|
|
33
|
-
const resolve_1 = __importDefault(require("resolve"));
|
|
34
|
-
const helpers_1 = require("./helpers");
|
|
35
|
-
const walk = (jsPath, modules, options) => {
|
|
36
|
-
const jsContent = fs.readFileSync(jsPath).toString();
|
|
37
|
-
const ast = babelParser.parse(jsContent, {
|
|
38
|
-
sourceType: 'module',
|
|
39
|
-
});
|
|
40
|
-
const extract = ({ node }) => {
|
|
41
|
-
let importPath = ((0, lodash_1.get)(node, 'callee.name') === 'require' ? (0, lodash_1.get)(node, 'arguments[0].value') : '') || (0, lodash_1.get)(node, 'source.value');
|
|
42
|
-
if (!importPath) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
// 尝试 resolve,失败跳过
|
|
47
|
-
importPath = resolve_1.default.sync(importPath, { basedir: options.cwd });
|
|
48
|
-
}
|
|
49
|
-
catch (_a) {
|
|
50
|
-
// ignore
|
|
51
|
-
}
|
|
52
|
-
const absoluteId = (0, helpers_1.getPath)(jsPath, importPath);
|
|
53
|
-
let absolutePath = /.js$/.test(absoluteId) ? absoluteId : `${absoluteId}.js`;
|
|
54
|
-
if (!fs.existsSync(absolutePath)) {
|
|
55
|
-
absolutePath = `${absoluteId}/index.js`;
|
|
56
|
-
}
|
|
57
|
-
if (!fs.existsSync(absolutePath)) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
modules.add(absolutePath);
|
|
61
|
-
walk(absolutePath, modules, options);
|
|
62
|
-
};
|
|
63
|
-
(0, traverse_1.default)(ast, {
|
|
64
|
-
CallExpression: extract,
|
|
65
|
-
ImportDeclaration: extract,
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
const parseTemplate = (filePath, modules, options) => {
|
|
69
|
-
walk(filePath, modules, options);
|
|
70
|
-
modules.add(filePath);
|
|
71
|
-
};
|
|
72
|
-
function jsModule(options, id) {
|
|
73
|
-
const templatePath = id;
|
|
74
|
-
const modules = new Set();
|
|
75
|
-
parseTemplate(templatePath, modules, options);
|
|
76
|
-
return Array.from(modules);
|
|
77
|
-
}
|
|
78
|
-
exports.default = jsModule;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.walk = void 0;
|
|
7
|
-
const node_fs_1 = require("node:fs");
|
|
8
|
-
const postcss_1 = __importDefault(require("postcss"));
|
|
9
|
-
const helpers_1 = require("./helpers");
|
|
10
|
-
const walk = (filePath, cssPaths) => {
|
|
11
|
-
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
cssPaths.add(filePath);
|
|
15
|
-
const content = (0, node_fs_1.readFileSync)(filePath);
|
|
16
|
-
const ast = postcss_1.default.parse(content);
|
|
17
|
-
if (!ast.nodes) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
ast.nodes.forEach(node => {
|
|
21
|
-
if (node.type === 'atrule' && node.name === 'import') {
|
|
22
|
-
const file = (0, helpers_1.getPath)(filePath, node.params.replace(/'|"/g, ''));
|
|
23
|
-
if (!(0, node_fs_1.existsSync)(file)) {
|
|
24
|
-
console.error(`文件 ${file} 不存在`);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
(0, exports.walk)(file, cssPaths);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
exports.walk = walk;
|
|
32
|
-
function style(platformConfig, id) {
|
|
33
|
-
const cssPaths = new Set();
|
|
34
|
-
const filePath = id.replace(/\.js$/, platformConfig.style);
|
|
35
|
-
(0, exports.walk)(filePath, cssPaths);
|
|
36
|
-
return Array.from(cssPaths);
|
|
37
|
-
}
|
|
38
|
-
exports.default = style;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.walk = void 0;
|
|
30
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
31
|
-
const htmlparser2 = __importStar(require("htmlparser2"));
|
|
32
|
-
const helpers_1 = require("./helpers");
|
|
33
|
-
function walk(platformConfig, filePath, templatePaths, options) {
|
|
34
|
-
if (!node_fs_1.default.existsSync(filePath)) {
|
|
35
|
-
console.error(`文件 ${filePath} 不存在`, options.notify);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const { tag, src } = platformConfig.template;
|
|
39
|
-
templatePaths.add(filePath);
|
|
40
|
-
const content = node_fs_1.default.readFileSync(filePath).toString();
|
|
41
|
-
const parser = new htmlparser2.Parser({});
|
|
42
|
-
parser._cbs.onopentag = (name, attrs) => {
|
|
43
|
-
if (name === tag && attrs[src]) {
|
|
44
|
-
walk(platformConfig, (0, helpers_1.getPath)(filePath, attrs[src]), templatePaths, options);
|
|
45
|
-
}
|
|
46
|
-
else if (['include', 'import'].includes(name) && attrs.src) {
|
|
47
|
-
walk(platformConfig, (0, helpers_1.getPath)(filePath, attrs.src), templatePaths, options);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
parser.reset();
|
|
51
|
-
parser.write(content);
|
|
52
|
-
parser.end();
|
|
53
|
-
}
|
|
54
|
-
exports.walk = walk;
|
|
55
|
-
function template(platformConfig, options, id) {
|
|
56
|
-
const templatePaths = new Set();
|
|
57
|
-
const filePath = id.replace(/\.js$/, platformConfig.template.extension);
|
|
58
|
-
walk(platformConfig, filePath, templatePaths, options);
|
|
59
|
-
return Array.from(templatePaths);
|
|
60
|
-
}
|
|
61
|
-
exports.default = template;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const node_fs_1 = require("node:fs");
|
|
7
|
-
const resolve_1 = __importDefault(require("resolve"));
|
|
8
|
-
const helpers_1 = require("./helpers");
|
|
9
|
-
const runWalk = (filePath, components, options) => {
|
|
10
|
-
const walk = (filePath) => {
|
|
11
|
-
const { usingComponents = {} } = require(filePath);
|
|
12
|
-
Object.values(usingComponents).forEach(value => {
|
|
13
|
-
let componentJsPath = '';
|
|
14
|
-
let componentJsonPath = '';
|
|
15
|
-
if (!componentJsPath) {
|
|
16
|
-
const componentPath = (0, helpers_1.getPath)(filePath, value);
|
|
17
|
-
componentJsPath = `${componentPath}.js`;
|
|
18
|
-
componentJsonPath = `${componentPath}.json`;
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
componentJsPath = resolve_1.default.sync(value, { basedir: options.cwd });
|
|
22
|
-
componentJsonPath = componentJsPath.replace(/\.js/, '.json');
|
|
23
|
-
}
|
|
24
|
-
catch (_a) {
|
|
25
|
-
// ignore
|
|
26
|
-
}
|
|
27
|
-
if (!(0, node_fs_1.existsSync)(componentJsPath) || !(0, node_fs_1.existsSync)(componentJsonPath)) {
|
|
28
|
-
console.error(`${componentJsPath} 或 ${componentJsonPath} 不存在`);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
components.add(componentJsPath);
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
walk(filePath);
|
|
35
|
-
};
|
|
36
|
-
function usingComponents(id, options) {
|
|
37
|
-
const components = new Set();
|
|
38
|
-
const filePath = id.replace(/\.js$/, '.json');
|
|
39
|
-
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
40
|
-
console.error(`文件 ${filePath} 不存在`);
|
|
41
|
-
return Array.from(components);
|
|
42
|
-
}
|
|
43
|
-
runWalk(filePath, components, options);
|
|
44
|
-
return Array.from(components);
|
|
45
|
-
}
|
|
46
|
-
exports.default = usingComponents;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import jsHelper from './jsHelper';
|
|
2
|
-
import json from './json';
|
|
3
|
-
import jsModule from './modules';
|
|
4
|
-
import style from './style';
|
|
5
|
-
import template from './template';
|
|
6
|
-
import usingComponents from './usingComponents';
|
|
7
|
-
export default function getAssets(platformConfig, resourcePath, options) {
|
|
8
|
-
const assets = [
|
|
9
|
-
...jsModule(options, resourcePath),
|
|
10
|
-
...jsHelper(platformConfig, resourcePath),
|
|
11
|
-
...style(platformConfig, resourcePath),
|
|
12
|
-
...json(resourcePath),
|
|
13
|
-
...template(platformConfig, options, resourcePath),
|
|
14
|
-
...usingComponents(resourcePath, options).reduce((acc, id) => [...acc, ...getAssets(platformConfig, id, options)], []),
|
|
15
|
-
];
|
|
16
|
-
return assets;
|
|
17
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const isNativeComponent: (sourcePath: string | null) => boolean;
|
|
2
|
-
export declare const getPath: (from: string, to: string) => string;
|
|
3
|
-
export declare function getNativeEntryAssetOutputPath(sourcePath: string, options: {
|
|
4
|
-
cwd: string;
|
|
5
|
-
rootDir: string;
|
|
6
|
-
}): string;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { slash } from '../path';
|
|
4
|
-
export const isNativeComponent = (sourcePath) => {
|
|
5
|
-
if (!sourcePath) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
if (path.extname(sourcePath) !== '.js') {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
const sourceJsonPath = sourcePath.replace(/\.js$/, '.json');
|
|
12
|
-
if (!fs.existsSync(sourceJsonPath)) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
return require(sourceJsonPath).component;
|
|
16
|
-
};
|
|
17
|
-
export const getPath = (from, to) => {
|
|
18
|
-
return slash(path.resolve(path.dirname(from), to));
|
|
19
|
-
};
|
|
20
|
-
const NATIVE_COMPONENT_OUTPUT_DIR = 'remaxVendors';
|
|
21
|
-
export function getNativeEntryAssetOutputPath(sourcePath, options) {
|
|
22
|
-
return `${NATIVE_COMPONENT_OUTPUT_DIR}/${slash(sourcePath)
|
|
23
|
-
.replace(`${slash(options.cwd)}/`, '')
|
|
24
|
-
.replace(`${slash(options.rootDir)}/`, '')
|
|
25
|
-
.replace(/@/g, '_')
|
|
26
|
-
.replace(/node_modules/g, 'npm')}`;
|
|
27
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import * as babelParser from '@babel/parser';
|
|
3
|
-
import traverse from '@babel/traverse';
|
|
4
|
-
import * as htmlparser2 from 'htmlparser2';
|
|
5
|
-
import { get } from 'lodash';
|
|
6
|
-
import { getPath } from './helpers';
|
|
7
|
-
const walk = (jsHelperPath, jsHelpers) => {
|
|
8
|
-
const jsHelperContent = fs.readFileSync(jsHelperPath).toString();
|
|
9
|
-
const ast = babelParser.parse(jsHelperContent, {
|
|
10
|
-
sourceType: 'module',
|
|
11
|
-
});
|
|
12
|
-
const extract = ({ node }) => {
|
|
13
|
-
const importPath = (get(node, 'callee.name') === 'require' ? get(node, 'arguments[0].value') : '') || get(node, 'source.value');
|
|
14
|
-
if (!importPath) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const absolutePath = getPath(jsHelperPath, importPath);
|
|
18
|
-
jsHelpers.add(absolutePath);
|
|
19
|
-
walk(absolutePath, jsHelpers);
|
|
20
|
-
};
|
|
21
|
-
traverse(ast, {
|
|
22
|
-
CallExpression: extract,
|
|
23
|
-
ImportDeclaration: extract,
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
const parseTemplate = (filePath, jsHelpers, jsHelper) => {
|
|
27
|
-
const parser = new htmlparser2.Parser({});
|
|
28
|
-
const { tag, src } = jsHelper;
|
|
29
|
-
const content = fs.readFileSync(filePath).toString();
|
|
30
|
-
parser._cbs.onopentag = (name, attrs) => {
|
|
31
|
-
if (name === tag && attrs[src]) {
|
|
32
|
-
const jsHelperPath = getPath(filePath, attrs[src]);
|
|
33
|
-
if (!fs.existsSync(jsHelperPath)) {
|
|
34
|
-
console.error(`文件 ${jsHelperPath} 不存在`);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
walk(jsHelperPath, jsHelpers);
|
|
38
|
-
jsHelpers.add(jsHelperPath);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
parser.reset();
|
|
42
|
-
parser.write(content);
|
|
43
|
-
parser.end();
|
|
44
|
-
};
|
|
45
|
-
export default function jsHelper(platformConfig, id) {
|
|
46
|
-
const jsHelpers = new Set();
|
|
47
|
-
const { jsHelper, template } = platformConfig;
|
|
48
|
-
if (!jsHelper) {
|
|
49
|
-
return [];
|
|
50
|
-
}
|
|
51
|
-
const templatePath = id.replace(/\.js$/, template.extension);
|
|
52
|
-
parseTemplate(templatePath, jsHelpers, jsHelper);
|
|
53
|
-
return Array.from(jsHelpers);
|
|
54
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function json(id: string): string[];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
export default function json(id) {
|
|
3
|
-
const filePath = id.replace(/\.js$/, '.json');
|
|
4
|
-
const jsonPaths = new Set();
|
|
5
|
-
if (!existsSync(filePath)) {
|
|
6
|
-
console.error(`文件 ${filePath} 不存在`);
|
|
7
|
-
return [];
|
|
8
|
-
}
|
|
9
|
-
jsonPaths.add(filePath);
|
|
10
|
-
return Array.from(jsonPaths);
|
|
11
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import * as babelParser from '@babel/parser';
|
|
3
|
-
import traverse from '@babel/traverse';
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
import resolve from 'resolve';
|
|
6
|
-
import { getPath } from './helpers';
|
|
7
|
-
const walk = (jsPath, modules, options) => {
|
|
8
|
-
const jsContent = fs.readFileSync(jsPath).toString();
|
|
9
|
-
const ast = babelParser.parse(jsContent, {
|
|
10
|
-
sourceType: 'module',
|
|
11
|
-
});
|
|
12
|
-
const extract = ({ node }) => {
|
|
13
|
-
let importPath = (get(node, 'callee.name') === 'require' ? get(node, 'arguments[0].value') : '') || get(node, 'source.value');
|
|
14
|
-
if (!importPath) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
// 尝试 resolve,失败跳过
|
|
19
|
-
importPath = resolve.sync(importPath, { basedir: options.cwd });
|
|
20
|
-
}
|
|
21
|
-
catch (_a) {
|
|
22
|
-
// ignore
|
|
23
|
-
}
|
|
24
|
-
const absoluteId = getPath(jsPath, importPath);
|
|
25
|
-
let absolutePath = /.js$/.test(absoluteId) ? absoluteId : `${absoluteId}.js`;
|
|
26
|
-
if (!fs.existsSync(absolutePath)) {
|
|
27
|
-
absolutePath = `${absoluteId}/index.js`;
|
|
28
|
-
}
|
|
29
|
-
if (!fs.existsSync(absolutePath)) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
modules.add(absolutePath);
|
|
33
|
-
walk(absolutePath, modules, options);
|
|
34
|
-
};
|
|
35
|
-
traverse(ast, {
|
|
36
|
-
CallExpression: extract,
|
|
37
|
-
ImportDeclaration: extract,
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
const parseTemplate = (filePath, modules, options) => {
|
|
41
|
-
walk(filePath, modules, options);
|
|
42
|
-
modules.add(filePath);
|
|
43
|
-
};
|
|
44
|
-
export default function jsModule(options, id) {
|
|
45
|
-
const templatePath = id;
|
|
46
|
-
const modules = new Set();
|
|
47
|
-
parseTemplate(templatePath, modules, options);
|
|
48
|
-
return Array.from(modules);
|
|
49
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import postcss from 'postcss';
|
|
3
|
-
import { getPath } from './helpers';
|
|
4
|
-
export const walk = (filePath, cssPaths) => {
|
|
5
|
-
if (!existsSync(filePath)) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
cssPaths.add(filePath);
|
|
9
|
-
const content = readFileSync(filePath);
|
|
10
|
-
const ast = postcss.parse(content);
|
|
11
|
-
if (!ast.nodes) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
ast.nodes.forEach(node => {
|
|
15
|
-
if (node.type === 'atrule' && node.name === 'import') {
|
|
16
|
-
const file = getPath(filePath, node.params.replace(/'|"/g, ''));
|
|
17
|
-
if (!existsSync(file)) {
|
|
18
|
-
console.error(`文件 ${file} 不存在`);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
walk(file, cssPaths);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
export default function style(platformConfig, id) {
|
|
26
|
-
const cssPaths = new Set();
|
|
27
|
-
const filePath = id.replace(/\.js$/, platformConfig.style);
|
|
28
|
-
walk(filePath, cssPaths);
|
|
29
|
-
return Array.from(cssPaths);
|
|
30
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import * as htmlparser2 from 'htmlparser2';
|
|
3
|
-
import { getPath } from './helpers';
|
|
4
|
-
export function walk(platformConfig, filePath, templatePaths, options) {
|
|
5
|
-
if (!fs.existsSync(filePath)) {
|
|
6
|
-
console.error(`文件 ${filePath} 不存在`, options.notify);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const { tag, src } = platformConfig.template;
|
|
10
|
-
templatePaths.add(filePath);
|
|
11
|
-
const content = fs.readFileSync(filePath).toString();
|
|
12
|
-
const parser = new htmlparser2.Parser({});
|
|
13
|
-
parser._cbs.onopentag = (name, attrs) => {
|
|
14
|
-
if (name === tag && attrs[src]) {
|
|
15
|
-
walk(platformConfig, getPath(filePath, attrs[src]), templatePaths, options);
|
|
16
|
-
}
|
|
17
|
-
else if (['include', 'import'].includes(name) && attrs.src) {
|
|
18
|
-
walk(platformConfig, getPath(filePath, attrs.src), templatePaths, options);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
parser.reset();
|
|
22
|
-
parser.write(content);
|
|
23
|
-
parser.end();
|
|
24
|
-
}
|
|
25
|
-
export default function template(platformConfig, options, id) {
|
|
26
|
-
const templatePaths = new Set();
|
|
27
|
-
const filePath = id.replace(/\.js$/, platformConfig.template.extension);
|
|
28
|
-
walk(platformConfig, filePath, templatePaths, options);
|
|
29
|
-
return Array.from(templatePaths);
|
|
30
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import resolve from 'resolve';
|
|
3
|
-
import { getPath } from './helpers';
|
|
4
|
-
const runWalk = (filePath, components, options) => {
|
|
5
|
-
const walk = (filePath) => {
|
|
6
|
-
const { usingComponents = {} } = require(filePath);
|
|
7
|
-
Object.values(usingComponents).forEach(value => {
|
|
8
|
-
let componentJsPath = '';
|
|
9
|
-
let componentJsonPath = '';
|
|
10
|
-
if (!componentJsPath) {
|
|
11
|
-
const componentPath = getPath(filePath, value);
|
|
12
|
-
componentJsPath = `${componentPath}.js`;
|
|
13
|
-
componentJsonPath = `${componentPath}.json`;
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
componentJsPath = resolve.sync(value, { basedir: options.cwd });
|
|
17
|
-
componentJsonPath = componentJsPath.replace(/\.js/, '.json');
|
|
18
|
-
}
|
|
19
|
-
catch (_a) {
|
|
20
|
-
// ignore
|
|
21
|
-
}
|
|
22
|
-
if (!existsSync(componentJsPath) || !existsSync(componentJsonPath)) {
|
|
23
|
-
console.error(`${componentJsPath} 或 ${componentJsonPath} 不存在`);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
components.add(componentJsPath);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
walk(filePath);
|
|
30
|
-
};
|
|
31
|
-
export default function usingComponents(id, options) {
|
|
32
|
-
const components = new Set();
|
|
33
|
-
const filePath = id.replace(/\.js$/, '.json');
|
|
34
|
-
if (!existsSync(filePath)) {
|
|
35
|
-
console.error(`文件 ${filePath} 不存在`);
|
|
36
|
-
return Array.from(components);
|
|
37
|
-
}
|
|
38
|
-
runWalk(filePath, components, options);
|
|
39
|
-
return Array.from(components);
|
|
40
|
-
}
|