@dimina/compiler 1.0.12-beta.5 → 1.0.12-beta.6
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 +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/core/view-compiler.cjs +21 -5
- package/dist/core/view-compiler.js +21 -5
- package/package.json +2 -1
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.6";
|
|
9
9
|
const pack = {
|
|
10
10
|
version
|
|
11
11
|
};
|
package/dist/bin/index.js
CHANGED
|
@@ -6,6 +6,7 @@ const node_worker_threads = require("node:worker_threads");
|
|
|
6
6
|
const babel = require("@babel/core");
|
|
7
7
|
const _traverse = require("@babel/traverse");
|
|
8
8
|
const types = require("@babel/types");
|
|
9
|
+
const pluginTransformArrowFunctions = require("@babel/plugin-transform-arrow-functions");
|
|
9
10
|
const compilerSfc = require("@vue/compiler-sfc");
|
|
10
11
|
const cheerio = require("cheerio");
|
|
11
12
|
const esbuild = require("esbuild");
|
|
@@ -359,7 +360,10 @@ function compileModule(module2, isComponent, scriptRes) {
|
|
|
359
360
|
insertWxsToRenderAst(ast, instruction.scriptModule, scriptRes);
|
|
360
361
|
code2 = babel.transformFromAstSync(ast, "", {
|
|
361
362
|
comments: false,
|
|
362
|
-
sourceType: "script"
|
|
363
|
+
sourceType: "script",
|
|
364
|
+
plugins: [
|
|
365
|
+
pluginTransformArrowFunctions
|
|
366
|
+
]
|
|
363
367
|
}).code;
|
|
364
368
|
tplComponents += `'${tm.path}':${cleanCompiledCode(code2)},`;
|
|
365
369
|
}
|
|
@@ -368,7 +372,10 @@ function compileModule(module2, isComponent, scriptRes) {
|
|
|
368
372
|
insertWxsToRenderAst(tplAst, instruction.scriptModule, scriptRes);
|
|
369
373
|
const { code: transCode } = babel.transformFromAstSync(tplAst, "", {
|
|
370
374
|
comments: false,
|
|
371
|
-
sourceType: "script"
|
|
375
|
+
sourceType: "script",
|
|
376
|
+
plugins: [
|
|
377
|
+
pluginTransformArrowFunctions
|
|
378
|
+
]
|
|
372
379
|
});
|
|
373
380
|
const code = `Module({
|
|
374
381
|
path: '${module2.path}',
|
|
@@ -501,7 +508,10 @@ function processWxsContent(wxsContent, wxsFilePath, scriptModule, workPath, file
|
|
|
501
508
|
});
|
|
502
509
|
return babel.transformFromAstSync(wxsAst, "", {
|
|
503
510
|
comments: false,
|
|
504
|
-
sourceType: "script"
|
|
511
|
+
sourceType: "script",
|
|
512
|
+
plugins: [
|
|
513
|
+
pluginTransformArrowFunctions
|
|
514
|
+
]
|
|
505
515
|
}).code;
|
|
506
516
|
}
|
|
507
517
|
function isWxsModuleByContent(moduleCode, modulePath = "") {
|
|
@@ -576,7 +586,10 @@ function compileModuleWithAllWxs(module2, scriptRes, allScriptModules) {
|
|
|
576
586
|
insertWxsToRenderAst(ast, allScriptModules, scriptRes);
|
|
577
587
|
code2 = babel.transformFromAstSync(ast, "", {
|
|
578
588
|
comments: false,
|
|
579
|
-
sourceType: "script"
|
|
589
|
+
sourceType: "script",
|
|
590
|
+
plugins: [
|
|
591
|
+
pluginTransformArrowFunctions
|
|
592
|
+
]
|
|
580
593
|
}).code;
|
|
581
594
|
tplComponents += `'${tm.path}':${cleanCompiledCode(code2)},`;
|
|
582
595
|
}
|
|
@@ -585,7 +598,10 @@ function compileModuleWithAllWxs(module2, scriptRes, allScriptModules) {
|
|
|
585
598
|
insertWxsToRenderAst(tplAst, allScriptModules, scriptRes);
|
|
586
599
|
const { code: transCode } = babel.transformFromAstSync(tplAst, "", {
|
|
587
600
|
comments: false,
|
|
588
|
-
sourceType: "script"
|
|
601
|
+
sourceType: "script",
|
|
602
|
+
plugins: [
|
|
603
|
+
pluginTransformArrowFunctions
|
|
604
|
+
]
|
|
589
605
|
});
|
|
590
606
|
const code = `Module({
|
|
591
607
|
path: '${module2.path}',
|
|
@@ -4,6 +4,7 @@ import { isMainThread, parentPort } from "node:worker_threads";
|
|
|
4
4
|
import babel from "@babel/core";
|
|
5
5
|
import _traverse from "@babel/traverse";
|
|
6
6
|
import types from "@babel/types";
|
|
7
|
+
import pluginTransformArrowFunctions from "@babel/plugin-transform-arrow-functions";
|
|
7
8
|
import { compileTemplate } from "@vue/compiler-sfc";
|
|
8
9
|
import * as cheerio from "cheerio";
|
|
9
10
|
import { transform } from "esbuild";
|
|
@@ -339,7 +340,10 @@ function compileModule(module, isComponent, scriptRes) {
|
|
|
339
340
|
insertWxsToRenderAst(ast, instruction.scriptModule, scriptRes);
|
|
340
341
|
code2 = babel.transformFromAstSync(ast, "", {
|
|
341
342
|
comments: false,
|
|
342
|
-
sourceType: "script"
|
|
343
|
+
sourceType: "script",
|
|
344
|
+
plugins: [
|
|
345
|
+
pluginTransformArrowFunctions
|
|
346
|
+
]
|
|
343
347
|
}).code;
|
|
344
348
|
tplComponents += `'${tm.path}':${cleanCompiledCode(code2)},`;
|
|
345
349
|
}
|
|
@@ -348,7 +352,10 @@ function compileModule(module, isComponent, scriptRes) {
|
|
|
348
352
|
insertWxsToRenderAst(tplAst, instruction.scriptModule, scriptRes);
|
|
349
353
|
const { code: transCode } = babel.transformFromAstSync(tplAst, "", {
|
|
350
354
|
comments: false,
|
|
351
|
-
sourceType: "script"
|
|
355
|
+
sourceType: "script",
|
|
356
|
+
plugins: [
|
|
357
|
+
pluginTransformArrowFunctions
|
|
358
|
+
]
|
|
352
359
|
});
|
|
353
360
|
const code = `Module({
|
|
354
361
|
path: '${module.path}',
|
|
@@ -481,7 +488,10 @@ function processWxsContent(wxsContent, wxsFilePath, scriptModule, workPath, file
|
|
|
481
488
|
});
|
|
482
489
|
return babel.transformFromAstSync(wxsAst, "", {
|
|
483
490
|
comments: false,
|
|
484
|
-
sourceType: "script"
|
|
491
|
+
sourceType: "script",
|
|
492
|
+
plugins: [
|
|
493
|
+
pluginTransformArrowFunctions
|
|
494
|
+
]
|
|
485
495
|
}).code;
|
|
486
496
|
}
|
|
487
497
|
function isWxsModuleByContent(moduleCode, modulePath = "") {
|
|
@@ -556,7 +566,10 @@ function compileModuleWithAllWxs(module, scriptRes, allScriptModules) {
|
|
|
556
566
|
insertWxsToRenderAst(ast, allScriptModules, scriptRes);
|
|
557
567
|
code2 = babel.transformFromAstSync(ast, "", {
|
|
558
568
|
comments: false,
|
|
559
|
-
sourceType: "script"
|
|
569
|
+
sourceType: "script",
|
|
570
|
+
plugins: [
|
|
571
|
+
pluginTransformArrowFunctions
|
|
572
|
+
]
|
|
560
573
|
}).code;
|
|
561
574
|
tplComponents += `'${tm.path}':${cleanCompiledCode(code2)},`;
|
|
562
575
|
}
|
|
@@ -565,7 +578,10 @@ function compileModuleWithAllWxs(module, scriptRes, allScriptModules) {
|
|
|
565
578
|
insertWxsToRenderAst(tplAst, allScriptModules, scriptRes);
|
|
566
579
|
const { code: transCode } = babel.transformFromAstSync(tplAst, "", {
|
|
567
580
|
comments: false,
|
|
568
|
-
sourceType: "script"
|
|
581
|
+
sourceType: "script",
|
|
582
|
+
plugins: [
|
|
583
|
+
pluginTransformArrowFunctions
|
|
584
|
+
]
|
|
569
585
|
});
|
|
570
586
|
const code = `Module({
|
|
571
587
|
path: '${module.path}',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimina/compiler",
|
|
3
|
-
"version": "1.0.12-beta.
|
|
3
|
+
"version": "1.0.12-beta.6",
|
|
4
4
|
"description": "星河编译工具",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@babel/core": "^7.28.5",
|
|
51
|
+
"@babel/plugin-transform-arrow-functions": "^7.27.1",
|
|
51
52
|
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
|
|
52
53
|
"@babel/traverse": "^7.28.5",
|
|
53
54
|
"@babel/types": "^7.28.5",
|