@weapp-core/init 6.0.3 → 6.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.
- package/dist/index.d.ts +4 -55
- package/dist/index.js +22 -107
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ interface Context {
|
|
|
75
75
|
viteConfig: ContextDocument<string>;
|
|
76
76
|
tsconfig: ContextDocument<TsConfigData>;
|
|
77
77
|
tsconfigApp: ContextDocument<TsConfigData>;
|
|
78
|
+
tsconfigServer: ContextDocument<TsConfigData>;
|
|
78
79
|
tsconfigNode: ContextDocument<TsConfigData>;
|
|
79
80
|
dts: ContextDocument<string>;
|
|
80
81
|
}
|
|
@@ -89,61 +90,9 @@ declare function initTsJsonFiles(options: SharedUpdateOptions): Promise<{
|
|
|
89
90
|
}[];
|
|
90
91
|
files: never[];
|
|
91
92
|
};
|
|
92
|
-
tsconfigApp:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
target: string;
|
|
96
|
-
lib: string[];
|
|
97
|
-
jsx: string;
|
|
98
|
-
module: string;
|
|
99
|
-
moduleResolution: string;
|
|
100
|
-
moduleDetection: string;
|
|
101
|
-
baseUrl: string;
|
|
102
|
-
paths: {
|
|
103
|
-
'@/*': string[];
|
|
104
|
-
};
|
|
105
|
-
resolveJsonModule: boolean;
|
|
106
|
-
types: string[];
|
|
107
|
-
allowImportingTsExtensions: boolean;
|
|
108
|
-
allowJs: boolean;
|
|
109
|
-
allowSyntheticDefaultImports: boolean;
|
|
110
|
-
esModuleInterop: boolean;
|
|
111
|
-
isolatedModules: boolean;
|
|
112
|
-
strict: boolean;
|
|
113
|
-
noFallthroughCasesInSwitch: boolean;
|
|
114
|
-
noUnusedLocals: boolean;
|
|
115
|
-
noUnusedParameters: boolean;
|
|
116
|
-
noEmit: boolean;
|
|
117
|
-
verbatimModuleSyntax: boolean;
|
|
118
|
-
noUncheckedSideEffectImports: boolean;
|
|
119
|
-
erasableSyntaxOnly: boolean;
|
|
120
|
-
skipLibCheck: boolean;
|
|
121
|
-
};
|
|
122
|
-
include: string[];
|
|
123
|
-
};
|
|
124
|
-
tsconfigNode: {
|
|
125
|
-
compilerOptions: {
|
|
126
|
-
tsBuildInfoFile: string;
|
|
127
|
-
target: string;
|
|
128
|
-
lib: string[];
|
|
129
|
-
module: string;
|
|
130
|
-
moduleResolution: string;
|
|
131
|
-
moduleDetection: string;
|
|
132
|
-
types: string[];
|
|
133
|
-
allowImportingTsExtensions: boolean;
|
|
134
|
-
resolveJsonModule: boolean;
|
|
135
|
-
verbatimModuleSyntax: boolean;
|
|
136
|
-
strict: boolean;
|
|
137
|
-
noFallthroughCasesInSwitch: boolean;
|
|
138
|
-
noUnusedLocals: boolean;
|
|
139
|
-
noUnusedParameters: boolean;
|
|
140
|
-
noEmit: boolean;
|
|
141
|
-
noUncheckedSideEffectImports: boolean;
|
|
142
|
-
erasableSyntaxOnly: boolean;
|
|
143
|
-
skipLibCheck: boolean;
|
|
144
|
-
};
|
|
145
|
-
include: string[];
|
|
146
|
-
};
|
|
93
|
+
tsconfigApp: null;
|
|
94
|
+
tsconfigServer: null;
|
|
95
|
+
tsconfigNode: null;
|
|
147
96
|
}>;
|
|
148
97
|
//#endregion
|
|
149
98
|
//#region src/packageJson.d.ts
|
package/dist/index.js
CHANGED
|
@@ -467,6 +467,7 @@ function createContext() {
|
|
|
467
467
|
viteConfig: createDocument(),
|
|
468
468
|
tsconfig: createDocument(),
|
|
469
469
|
tsconfigApp: createDocument(),
|
|
470
|
+
tsconfigServer: createDocument(),
|
|
470
471
|
tsconfigNode: createDocument(),
|
|
471
472
|
dts: createDocument()
|
|
472
473
|
};
|
|
@@ -487,106 +488,26 @@ function resetContext() {
|
|
|
487
488
|
Object.assign(ctx.viteConfig, next.viteConfig);
|
|
488
489
|
Object.assign(ctx.tsconfig, next.tsconfig);
|
|
489
490
|
Object.assign(ctx.tsconfigApp, next.tsconfigApp);
|
|
491
|
+
Object.assign(ctx.tsconfigServer, next.tsconfigServer);
|
|
490
492
|
Object.assign(ctx.tsconfigNode, next.tsconfigNode);
|
|
491
493
|
Object.assign(ctx.dts, next.dts);
|
|
492
494
|
}
|
|
493
495
|
//#endregion
|
|
494
496
|
//#region src/tsconfigJson.ts
|
|
495
|
-
const srcIncludeGlobs = [
|
|
496
|
-
"src/**/*.ts",
|
|
497
|
-
"src/**/*.tsx",
|
|
498
|
-
"src/**/*.js",
|
|
499
|
-
"src/**/*.jsx",
|
|
500
|
-
"src/**/*.mts",
|
|
501
|
-
"src/**/*.cts",
|
|
502
|
-
"src/**/*.vue",
|
|
503
|
-
"src/**/*.json",
|
|
504
|
-
"src/**/*.d.ts",
|
|
505
|
-
"types/**/*.d.ts",
|
|
506
|
-
"env.d.ts"
|
|
507
|
-
];
|
|
508
497
|
/**
|
|
509
498
|
* @description 生成默认 tsconfig.json
|
|
510
499
|
*/
|
|
511
500
|
function getDefaultTsconfigJson() {
|
|
512
501
|
return {
|
|
513
|
-
references: [
|
|
502
|
+
references: [
|
|
503
|
+
{ path: "./.weapp-vite/tsconfig.app.json" },
|
|
504
|
+
{ path: "./.weapp-vite/tsconfig.server.json" },
|
|
505
|
+
{ path: "./.weapp-vite/tsconfig.node.json" },
|
|
506
|
+
{ path: "./.weapp-vite/tsconfig.shared.json" }
|
|
507
|
+
],
|
|
514
508
|
files: []
|
|
515
509
|
};
|
|
516
510
|
}
|
|
517
|
-
/**
|
|
518
|
-
* @description 生成默认 tsconfig.app.json
|
|
519
|
-
*/
|
|
520
|
-
function getDefaultTsconfigAppJson() {
|
|
521
|
-
return {
|
|
522
|
-
compilerOptions: {
|
|
523
|
-
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
524
|
-
target: "ES2023",
|
|
525
|
-
lib: [
|
|
526
|
-
"ES2023",
|
|
527
|
-
"DOM",
|
|
528
|
-
"DOM.Iterable"
|
|
529
|
-
],
|
|
530
|
-
jsx: "preserve",
|
|
531
|
-
module: "ESNext",
|
|
532
|
-
moduleResolution: "bundler",
|
|
533
|
-
moduleDetection: "force",
|
|
534
|
-
baseUrl: ".",
|
|
535
|
-
paths: { "@/*": ["./src/*"] },
|
|
536
|
-
resolveJsonModule: true,
|
|
537
|
-
types: ["miniprogram-api-typings"],
|
|
538
|
-
allowImportingTsExtensions: true,
|
|
539
|
-
allowJs: true,
|
|
540
|
-
allowSyntheticDefaultImports: true,
|
|
541
|
-
esModuleInterop: true,
|
|
542
|
-
isolatedModules: true,
|
|
543
|
-
strict: true,
|
|
544
|
-
noFallthroughCasesInSwitch: true,
|
|
545
|
-
noUnusedLocals: true,
|
|
546
|
-
noUnusedParameters: true,
|
|
547
|
-
noEmit: true,
|
|
548
|
-
verbatimModuleSyntax: true,
|
|
549
|
-
noUncheckedSideEffectImports: true,
|
|
550
|
-
erasableSyntaxOnly: true,
|
|
551
|
-
skipLibCheck: true
|
|
552
|
-
},
|
|
553
|
-
include: srcIncludeGlobs
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* @description 生成默认 tsconfig.node.json
|
|
558
|
-
*/
|
|
559
|
-
function getDefaultTsconfigNodeJson(include = []) {
|
|
560
|
-
return {
|
|
561
|
-
compilerOptions: {
|
|
562
|
-
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
563
|
-
target: "ES2023",
|
|
564
|
-
lib: ["ES2023"],
|
|
565
|
-
module: "ESNext",
|
|
566
|
-
moduleResolution: "bundler",
|
|
567
|
-
moduleDetection: "force",
|
|
568
|
-
types: ["node"],
|
|
569
|
-
allowImportingTsExtensions: true,
|
|
570
|
-
resolveJsonModule: true,
|
|
571
|
-
verbatimModuleSyntax: true,
|
|
572
|
-
strict: true,
|
|
573
|
-
noFallthroughCasesInSwitch: true,
|
|
574
|
-
noUnusedLocals: true,
|
|
575
|
-
noUnusedParameters: true,
|
|
576
|
-
noEmit: true,
|
|
577
|
-
noUncheckedSideEffectImports: true,
|
|
578
|
-
erasableSyntaxOnly: true,
|
|
579
|
-
skipLibCheck: true
|
|
580
|
-
},
|
|
581
|
-
include: [...new Set([...[
|
|
582
|
-
"vite.config.ts",
|
|
583
|
-
"vite.config.*.ts",
|
|
584
|
-
"*.config.ts",
|
|
585
|
-
"config/**/*.ts",
|
|
586
|
-
"scripts/**/*.ts"
|
|
587
|
-
], ...include])]
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
511
|
//#endregion
|
|
591
512
|
//#region src/tsDts.ts
|
|
592
513
|
/**
|
|
@@ -717,38 +638,32 @@ async function initTsJsonFiles(options) {
|
|
|
717
638
|
const { root, dest, write = true } = options;
|
|
718
639
|
const tsJsonFilename = ctx.tsconfig.name = "tsconfig.json";
|
|
719
640
|
const tsJsonFilePath = ctx.tsconfig.path = posix.resolve(root, tsJsonFilename);
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
641
|
+
ctx.tsconfigApp.name = ".weapp-vite/tsconfig.app.json";
|
|
642
|
+
ctx.tsconfigApp.path = posix.resolve(root, ctx.tsconfigApp.name);
|
|
643
|
+
ctx.tsconfigServer.name = ".weapp-vite/tsconfig.server.json";
|
|
644
|
+
ctx.tsconfigServer.path = posix.resolve(root, ctx.tsconfigServer.name);
|
|
645
|
+
ctx.tsconfigNode.name = ".weapp-vite/tsconfig.node.json";
|
|
646
|
+
ctx.tsconfigNode.path = posix.resolve(root, ctx.tsconfigNode.name);
|
|
724
647
|
const tsconfig = getDefaultTsconfigJson();
|
|
725
|
-
const tsconfigApp = getDefaultTsconfigAppJson();
|
|
726
|
-
const tsconfigNode = getDefaultTsconfigNodeJson(ctx.viteConfig.name ? [ctx.viteConfig.name] : []);
|
|
727
648
|
ctx.tsconfig.value = tsconfig;
|
|
728
|
-
ctx.tsconfigApp.value =
|
|
729
|
-
ctx.
|
|
649
|
+
ctx.tsconfigApp.value = null;
|
|
650
|
+
ctx.tsconfigServer.value = null;
|
|
651
|
+
ctx.tsconfigNode.value = null;
|
|
730
652
|
if (write) {
|
|
731
653
|
const tsconfigOutputPath = resolveOutputPath(root, dest, tsJsonFilePath);
|
|
732
|
-
const tsconfigAppOutputPath = resolveOutputPath(root, dest, tsAppJsonFilePath);
|
|
733
|
-
const tsconfigNodeOutputPath = resolveOutputPath(root, dest, tsNodeJsonFilePath);
|
|
734
654
|
await writeJsonFile(tsconfigOutputPath, tsconfig);
|
|
735
|
-
|
|
736
|
-
await writeJsonFile(tsconfigNodeOutputPath, tsconfigNode);
|
|
737
|
-
logger.log(`✨ 写入 ${[
|
|
738
|
-
posix.relative(root, tsconfigOutputPath),
|
|
739
|
-
posix.relative(root, tsconfigAppOutputPath),
|
|
740
|
-
posix.relative(root, tsconfigNodeOutputPath)
|
|
741
|
-
].join(", ")} 成功!`);
|
|
655
|
+
logger.log(`✨ 写入 ${posix.relative(root, tsconfigOutputPath)} 成功!`);
|
|
742
656
|
}
|
|
743
657
|
return {
|
|
744
658
|
tsconfig,
|
|
745
|
-
tsconfigApp,
|
|
746
|
-
|
|
659
|
+
tsconfigApp: null,
|
|
660
|
+
tsconfigServer: null,
|
|
661
|
+
tsconfigNode: null
|
|
747
662
|
};
|
|
748
663
|
}
|
|
749
664
|
//#endregion
|
|
750
665
|
//#region ../../packages/weapp-vite/package.json
|
|
751
|
-
var version = "6.
|
|
666
|
+
var version = "6.11.1";
|
|
752
667
|
//#endregion
|
|
753
668
|
//#region src/npm.ts
|
|
754
669
|
/**
|