@dimina/compiler 1.0.12-beta.5 → 1.0.12-beta.7
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/dist/bin/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const process = require("node:process");
|
|
|
5
5
|
const chokidar = require("chokidar");
|
|
6
6
|
const commander = require("commander");
|
|
7
7
|
const index = require("../index.cjs");
|
|
8
|
-
const version = "1.0.12-beta.
|
|
8
|
+
const version = "1.0.12-beta.7";
|
|
9
9
|
const pack = {
|
|
10
10
|
version
|
|
11
11
|
};
|
package/dist/bin/index.js
CHANGED
|
@@ -11,6 +11,14 @@ const ts = require("typescript");
|
|
|
11
11
|
const transformModulesCommonjs = require("@babel/plugin-transform-modules-commonjs");
|
|
12
12
|
const env = require("../env-Cmen1qwy.cjs");
|
|
13
13
|
const traverse = _traverse.default ? _traverse.default : _traverse;
|
|
14
|
+
const BABEL_TRANSFORM_CONFIG = {
|
|
15
|
+
comments: false,
|
|
16
|
+
configFile: false,
|
|
17
|
+
plugins: [
|
|
18
|
+
// 将 ES6 import/export 转换为 CommonJS
|
|
19
|
+
transformModulesCommonjs
|
|
20
|
+
]
|
|
21
|
+
};
|
|
14
22
|
const processedModules = /* @__PURE__ */ new Set();
|
|
15
23
|
if (!node_worker_threads.isMainThread) {
|
|
16
24
|
node_worker_threads.parentPort.on("message", async ({ pages, storeInfo }) => {
|
|
@@ -237,13 +245,7 @@ function buildJSByPath(packageName, module2, compileRes, mainCompileRes, addExtr
|
|
|
237
245
|
}
|
|
238
246
|
}
|
|
239
247
|
});
|
|
240
|
-
const { code } = babel.transformFromAstSync(ast, "",
|
|
241
|
-
comments: false,
|
|
242
|
-
plugins: [
|
|
243
|
-
// 将 ES6 import/export 转换为 CommonJS
|
|
244
|
-
transformModulesCommonjs
|
|
245
|
-
]
|
|
246
|
-
});
|
|
248
|
+
const { code } = babel.transformFromAstSync(ast, "", BABEL_TRANSFORM_CONFIG);
|
|
247
249
|
compileInfo.code = code;
|
|
248
250
|
processedModules.add(packageName + currentPath);
|
|
249
251
|
}
|
|
@@ -9,6 +9,14 @@ import ts from "typescript";
|
|
|
9
9
|
import transformModulesCommonjs from "@babel/plugin-transform-modules-commonjs";
|
|
10
10
|
import { r as resetStoreInfo, g as getTargetPath, i as hasCompileInfo, b as getContentByPath, j as getAppConfigInfo, a as getComponent, d as getWorkPath } from "../env-Csj3AHY4.js";
|
|
11
11
|
const traverse = _traverse.default ? _traverse.default : _traverse;
|
|
12
|
+
const BABEL_TRANSFORM_CONFIG = {
|
|
13
|
+
comments: false,
|
|
14
|
+
configFile: false,
|
|
15
|
+
plugins: [
|
|
16
|
+
// 将 ES6 import/export 转换为 CommonJS
|
|
17
|
+
transformModulesCommonjs
|
|
18
|
+
]
|
|
19
|
+
};
|
|
12
20
|
const processedModules = /* @__PURE__ */ new Set();
|
|
13
21
|
if (!isMainThread) {
|
|
14
22
|
parentPort.on("message", async ({ pages, storeInfo }) => {
|
|
@@ -235,13 +243,7 @@ function buildJSByPath(packageName, module, compileRes, mainCompileRes, addExtra
|
|
|
235
243
|
}
|
|
236
244
|
}
|
|
237
245
|
});
|
|
238
|
-
const { code } = babel.transformFromAstSync(ast, "",
|
|
239
|
-
comments: false,
|
|
240
|
-
plugins: [
|
|
241
|
-
// 将 ES6 import/export 转换为 CommonJS
|
|
242
|
-
transformModulesCommonjs
|
|
243
|
-
]
|
|
244
|
-
});
|
|
246
|
+
const { code } = babel.transformFromAstSync(ast, "", BABEL_TRANSFORM_CONFIG);
|
|
245
247
|
compileInfo.code = code;
|
|
246
248
|
processedModules.add(packageName + currentPath);
|
|
247
249
|
}
|
|
@@ -137,6 +137,11 @@ function parseBindings(bindings) {
|
|
|
137
137
|
}
|
|
138
138
|
const traverse = _traverse.default ? _traverse.default : _traverse;
|
|
139
139
|
const fileType = [".wxml", ".ddml"];
|
|
140
|
+
const BABEL_TRANSFORM_CONFIG = {
|
|
141
|
+
comments: false,
|
|
142
|
+
sourceType: "script",
|
|
143
|
+
configFile: false
|
|
144
|
+
};
|
|
140
145
|
const compileResCache = /* @__PURE__ */ new Map();
|
|
141
146
|
const wxsModuleRegistry = /* @__PURE__ */ new Set();
|
|
142
147
|
const wxsFilePathMap = /* @__PURE__ */ new Map();
|
|
@@ -357,19 +362,13 @@ function compileModule(module2, isComponent, scriptRes) {
|
|
|
357
362
|
});
|
|
358
363
|
const ast = babel.parseSync(code2);
|
|
359
364
|
insertWxsToRenderAst(ast, instruction.scriptModule, scriptRes);
|
|
360
|
-
code2 = babel.transformFromAstSync(ast, "",
|
|
361
|
-
comments: false,
|
|
362
|
-
sourceType: "script"
|
|
363
|
-
}).code;
|
|
365
|
+
code2 = babel.transformFromAstSync(ast, "", BABEL_TRANSFORM_CONFIG).code;
|
|
364
366
|
tplComponents += `'${tm.path}':${cleanCompiledCode(code2)},`;
|
|
365
367
|
}
|
|
366
368
|
tplComponents += "}";
|
|
367
369
|
const tplAst = babel.parseSync(tplCode.code);
|
|
368
370
|
insertWxsToRenderAst(tplAst, instruction.scriptModule, scriptRes);
|
|
369
|
-
const { code: transCode } = babel.transformFromAstSync(tplAst, "",
|
|
370
|
-
comments: false,
|
|
371
|
-
sourceType: "script"
|
|
372
|
-
});
|
|
371
|
+
const { code: transCode } = babel.transformFromAstSync(tplAst, "", BABEL_TRANSFORM_CONFIG);
|
|
373
372
|
const code = `Module({
|
|
374
373
|
path: '${module2.path}',
|
|
375
374
|
id: '${module2.id}',
|
|
@@ -499,10 +498,7 @@ function processWxsContent(wxsContent, wxsFilePath, scriptModule, workPath, file
|
|
|
499
498
|
}
|
|
500
499
|
}
|
|
501
500
|
});
|
|
502
|
-
return babel.transformFromAstSync(wxsAst, "",
|
|
503
|
-
comments: false,
|
|
504
|
-
sourceType: "script"
|
|
505
|
-
}).code;
|
|
501
|
+
return babel.transformFromAstSync(wxsAst, "", BABEL_TRANSFORM_CONFIG).code;
|
|
506
502
|
}
|
|
507
503
|
function isWxsModuleByContent(moduleCode, modulePath = "") {
|
|
508
504
|
if (!moduleCode || typeof moduleCode !== "string") {
|
|
@@ -574,19 +570,13 @@ function compileModuleWithAllWxs(module2, scriptRes, allScriptModules) {
|
|
|
574
570
|
});
|
|
575
571
|
const ast = babel.parseSync(code2);
|
|
576
572
|
insertWxsToRenderAst(ast, allScriptModules, scriptRes);
|
|
577
|
-
code2 = babel.transformFromAstSync(ast, "",
|
|
578
|
-
comments: false,
|
|
579
|
-
sourceType: "script"
|
|
580
|
-
}).code;
|
|
573
|
+
code2 = babel.transformFromAstSync(ast, "", BABEL_TRANSFORM_CONFIG).code;
|
|
581
574
|
tplComponents += `'${tm.path}':${cleanCompiledCode(code2)},`;
|
|
582
575
|
}
|
|
583
576
|
tplComponents += "}";
|
|
584
577
|
const tplAst = babel.parseSync(tplCode.code);
|
|
585
578
|
insertWxsToRenderAst(tplAst, allScriptModules, scriptRes);
|
|
586
|
-
const { code: transCode } = babel.transformFromAstSync(tplAst, "",
|
|
587
|
-
comments: false,
|
|
588
|
-
sourceType: "script"
|
|
589
|
-
});
|
|
579
|
+
const { code: transCode } = babel.transformFromAstSync(tplAst, "", BABEL_TRANSFORM_CONFIG);
|
|
590
580
|
const code = `Module({
|
|
591
581
|
path: '${module2.path}',
|
|
592
582
|
id: '${module2.id}',
|
|
@@ -117,6 +117,11 @@ function parseBindings(bindings) {
|
|
|
117
117
|
}
|
|
118
118
|
const traverse = _traverse.default ? _traverse.default : _traverse;
|
|
119
119
|
const fileType = [".wxml", ".ddml"];
|
|
120
|
+
const BABEL_TRANSFORM_CONFIG = {
|
|
121
|
+
comments: false,
|
|
122
|
+
sourceType: "script",
|
|
123
|
+
configFile: false
|
|
124
|
+
};
|
|
120
125
|
const compileResCache = /* @__PURE__ */ new Map();
|
|
121
126
|
const wxsModuleRegistry = /* @__PURE__ */ new Set();
|
|
122
127
|
const wxsFilePathMap = /* @__PURE__ */ new Map();
|
|
@@ -337,19 +342,13 @@ function compileModule(module, isComponent, scriptRes) {
|
|
|
337
342
|
});
|
|
338
343
|
const ast = babel.parseSync(code2);
|
|
339
344
|
insertWxsToRenderAst(ast, instruction.scriptModule, scriptRes);
|
|
340
|
-
code2 = babel.transformFromAstSync(ast, "",
|
|
341
|
-
comments: false,
|
|
342
|
-
sourceType: "script"
|
|
343
|
-
}).code;
|
|
345
|
+
code2 = babel.transformFromAstSync(ast, "", BABEL_TRANSFORM_CONFIG).code;
|
|
344
346
|
tplComponents += `'${tm.path}':${cleanCompiledCode(code2)},`;
|
|
345
347
|
}
|
|
346
348
|
tplComponents += "}";
|
|
347
349
|
const tplAst = babel.parseSync(tplCode.code);
|
|
348
350
|
insertWxsToRenderAst(tplAst, instruction.scriptModule, scriptRes);
|
|
349
|
-
const { code: transCode } = babel.transformFromAstSync(tplAst, "",
|
|
350
|
-
comments: false,
|
|
351
|
-
sourceType: "script"
|
|
352
|
-
});
|
|
351
|
+
const { code: transCode } = babel.transformFromAstSync(tplAst, "", BABEL_TRANSFORM_CONFIG);
|
|
353
352
|
const code = `Module({
|
|
354
353
|
path: '${module.path}',
|
|
355
354
|
id: '${module.id}',
|
|
@@ -479,10 +478,7 @@ function processWxsContent(wxsContent, wxsFilePath, scriptModule, workPath, file
|
|
|
479
478
|
}
|
|
480
479
|
}
|
|
481
480
|
});
|
|
482
|
-
return babel.transformFromAstSync(wxsAst, "",
|
|
483
|
-
comments: false,
|
|
484
|
-
sourceType: "script"
|
|
485
|
-
}).code;
|
|
481
|
+
return babel.transformFromAstSync(wxsAst, "", BABEL_TRANSFORM_CONFIG).code;
|
|
486
482
|
}
|
|
487
483
|
function isWxsModuleByContent(moduleCode, modulePath = "") {
|
|
488
484
|
if (!moduleCode || typeof moduleCode !== "string") {
|
|
@@ -554,19 +550,13 @@ function compileModuleWithAllWxs(module, scriptRes, allScriptModules) {
|
|
|
554
550
|
});
|
|
555
551
|
const ast = babel.parseSync(code2);
|
|
556
552
|
insertWxsToRenderAst(ast, allScriptModules, scriptRes);
|
|
557
|
-
code2 = babel.transformFromAstSync(ast, "",
|
|
558
|
-
comments: false,
|
|
559
|
-
sourceType: "script"
|
|
560
|
-
}).code;
|
|
553
|
+
code2 = babel.transformFromAstSync(ast, "", BABEL_TRANSFORM_CONFIG).code;
|
|
561
554
|
tplComponents += `'${tm.path}':${cleanCompiledCode(code2)},`;
|
|
562
555
|
}
|
|
563
556
|
tplComponents += "}";
|
|
564
557
|
const tplAst = babel.parseSync(tplCode.code);
|
|
565
558
|
insertWxsToRenderAst(tplAst, allScriptModules, scriptRes);
|
|
566
|
-
const { code: transCode } = babel.transformFromAstSync(tplAst, "",
|
|
567
|
-
comments: false,
|
|
568
|
-
sourceType: "script"
|
|
569
|
-
});
|
|
559
|
+
const { code: transCode } = babel.transformFromAstSync(tplAst, "", BABEL_TRANSFORM_CONFIG);
|
|
570
560
|
const code = `Module({
|
|
571
561
|
path: '${module.path}',
|
|
572
562
|
id: '${module.id}',
|