weapp-vite 5.6.1 → 5.6.3
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/auto-import-components/resolvers.cjs +5 -5
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-routes.cjs +8 -8
- package/dist/auto-routes.mjs +4 -4
- package/dist/{chunk-JXSGMLN2.mjs → chunk-2SUWUB42.mjs} +1 -1
- package/dist/{chunk-3FNAS3G7.mjs → chunk-7EOV7C3M.mjs} +2 -2
- package/dist/{chunk-WWFEREWV.cjs → chunk-A5DD7GKX.cjs} +2 -2
- package/dist/chunk-FOWFAOSV.cjs +6 -0
- package/dist/{chunk-ZIRGPJR5.cjs → chunk-G6EZVEVT.cjs} +2 -2
- package/dist/{chunk-LWQW2GQC.mjs → chunk-LE4PAGI5.mjs} +627 -686
- package/dist/{chunk-ACNTFTT2.cjs → chunk-MQBCRXCD.cjs} +2 -2
- package/dist/{chunk-DG5WTO5V.mjs → chunk-N463WDOG.mjs} +1 -1
- package/dist/{chunk-6JB3ELRA.cjs → chunk-OQYESMEY.cjs} +975 -1034
- package/dist/{chunk-C5ZVOPAJ.mjs → chunk-SSQGJIB5.mjs} +2 -2
- package/dist/{chunk-BJJOLDPK.cjs → chunk-WYNGNSLK.cjs} +6 -6
- package/dist/{chunk-JMKI52G2.mjs → chunk-ZMX6CFVX.mjs} +1 -1
- package/dist/cli.cjs +70 -70
- package/dist/cli.mjs +33 -33
- package/dist/config.cjs +4 -4
- package/dist/config.mjs +3 -3
- package/dist/index.cjs +8 -8
- package/dist/index.mjs +6 -6
- package/dist/json.cjs +3 -3
- package/dist/json.mjs +2 -2
- package/dist/types.cjs +9 -9
- package/dist/types.mjs +2 -2
- package/dist/volar.cjs +2 -2
- package/dist/volar.mjs +1 -1
- package/package.json +7 -7
- package/dist/chunk-EKHZHEQK.cjs +0 -6
|
@@ -33,11 +33,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
mod
|
|
34
34
|
));
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.14.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js
|
|
37
37
|
import path from "path";
|
|
38
38
|
import { fileURLToPath } from "url";
|
|
39
39
|
var init_esm_shims = __esm({
|
|
40
|
-
"../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.
|
|
40
|
+
"../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.14.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js"() {
|
|
41
41
|
"use strict";
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkOQYESMEYcjs = require('./chunk-OQYESMEY.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkA5DD7GKXcjs = require('./chunk-A5DD7GKX.cjs');
|
|
9
9
|
|
|
10
10
|
// src/createContext.ts
|
|
11
|
-
|
|
11
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
12
12
|
async function createCompilerContext(options) {
|
|
13
13
|
const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.key]), () => ( "default"));
|
|
14
14
|
if (!_optionalChain([options, 'optionalAccess', _2 => _2.key])) {
|
|
15
|
-
|
|
15
|
+
_chunkOQYESMEYcjs.resetCompilerContext.call(void 0, key);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
const ctx =
|
|
17
|
+
_chunkOQYESMEYcjs.setActiveCompilerContextKey.call(void 0, key);
|
|
18
|
+
const ctx = _chunkOQYESMEYcjs.getCompilerContext.call(void 0, key);
|
|
19
19
|
const { configService, scanService, autoRoutesService } = ctx;
|
|
20
20
|
await configService.load(options);
|
|
21
21
|
if (autoRoutesService) {
|
package/dist/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWYNGNSLKcjs = require('./chunk-WYNGNSLK.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,19 +9,19 @@ var _chunkBJJOLDPKcjs = require('./chunk-BJJOLDPK.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkOQYESMEYcjs = require('./chunk-OQYESMEY.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkA5DD7GKXcjs = require('./chunk-A5DD7GKX.cjs');
|
|
16
16
|
|
|
17
17
|
// src/cli.ts
|
|
18
|
-
|
|
18
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
19
19
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
20
20
|
var _init = require('@weapp-core/init');
|
|
21
21
|
var _shared = require('@weapp-core/shared');
|
|
22
22
|
|
|
23
23
|
// ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
24
|
-
|
|
24
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
25
25
|
var _events = require('events');
|
|
26
26
|
function toArr(any) {
|
|
27
27
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -607,7 +607,7 @@ var CAC = class extends _events.EventEmitter {
|
|
|
607
607
|
var cac = (name = "") => new CAC(name);
|
|
608
608
|
|
|
609
609
|
// ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
610
|
-
|
|
610
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
611
611
|
function dashDashArg(agent, agentCommand) {
|
|
612
612
|
return (args) => {
|
|
613
613
|
if (args.length > 1) {
|
|
@@ -746,7 +746,7 @@ var _vite = require('vite');
|
|
|
746
746
|
var _weappidecli = require('weapp-ide-cli');
|
|
747
747
|
|
|
748
748
|
// src/schematics.ts
|
|
749
|
-
|
|
749
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
750
750
|
|
|
751
751
|
var _schematics = require('@weapp-core/schematics');
|
|
752
752
|
|
|
@@ -764,6 +764,36 @@ var defaultExtensions = {
|
|
|
764
764
|
function resolveExtension(extension) {
|
|
765
765
|
return extension ? extension.startsWith(".") ? extension : `.${extension}` : "";
|
|
766
766
|
}
|
|
767
|
+
async function readTemplateFile(templatePath, context) {
|
|
768
|
+
const absolutePath = _pathe2.default.isAbsolute(templatePath) ? templatePath : _pathe2.default.resolve(context.cwd, templatePath);
|
|
769
|
+
return _fsextra2.default.readFile(absolutePath, "utf8");
|
|
770
|
+
}
|
|
771
|
+
async function loadTemplate(template, context) {
|
|
772
|
+
if (template === void 0) {
|
|
773
|
+
return void 0;
|
|
774
|
+
}
|
|
775
|
+
if (typeof template === "function") {
|
|
776
|
+
const result = await template(context);
|
|
777
|
+
return result == null ? void 0 : String(result);
|
|
778
|
+
}
|
|
779
|
+
if (typeof template === "string") {
|
|
780
|
+
return readTemplateFile(template, context);
|
|
781
|
+
}
|
|
782
|
+
if ("content" in template && typeof template.content === "string") {
|
|
783
|
+
return template.content;
|
|
784
|
+
}
|
|
785
|
+
if ("path" in template && typeof template.path === "string") {
|
|
786
|
+
return readTemplateFile(template.path, context);
|
|
787
|
+
}
|
|
788
|
+
return void 0;
|
|
789
|
+
}
|
|
790
|
+
function resolveTemplate(templates, type, fileType) {
|
|
791
|
+
const scoped = _optionalChain([templates, 'optionalAccess', _2 => _2[type], 'optionalAccess', _3 => _3[fileType]]);
|
|
792
|
+
if (scoped !== void 0) {
|
|
793
|
+
return scoped;
|
|
794
|
+
}
|
|
795
|
+
return _optionalChain([templates, 'optionalAccess', _4 => _4.shared, 'optionalAccess', _5 => _5[fileType]]);
|
|
796
|
+
}
|
|
767
797
|
async function generate(options) {
|
|
768
798
|
let { fileName, outDir, extensions, type, cwd, templates } = _shared.defu.call(void 0, options, {
|
|
769
799
|
type: "component",
|
|
@@ -817,45 +847,15 @@ async function generate(options) {
|
|
|
817
847
|
for (const { code, fileName: fileName2 } of files) {
|
|
818
848
|
if (code !== void 0) {
|
|
819
849
|
await _fsextra2.default.outputFile(_pathe2.default.resolve(basepath, fileName2), code, "utf8");
|
|
820
|
-
|
|
850
|
+
_chunkOQYESMEYcjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
|
|
821
851
|
}
|
|
822
852
|
}
|
|
823
853
|
}
|
|
824
|
-
function resolveTemplate(templates, type, fileType) {
|
|
825
|
-
const scoped = _optionalChain([templates, 'optionalAccess', _2 => _2[type], 'optionalAccess', _3 => _3[fileType]]);
|
|
826
|
-
if (scoped !== void 0) {
|
|
827
|
-
return scoped;
|
|
828
|
-
}
|
|
829
|
-
return _optionalChain([templates, 'optionalAccess', _4 => _4.shared, 'optionalAccess', _5 => _5[fileType]]);
|
|
830
|
-
}
|
|
831
|
-
async function loadTemplate(template, context) {
|
|
832
|
-
if (template === void 0) {
|
|
833
|
-
return void 0;
|
|
834
|
-
}
|
|
835
|
-
if (typeof template === "function") {
|
|
836
|
-
const result = await template(context);
|
|
837
|
-
return result == null ? void 0 : String(result);
|
|
838
|
-
}
|
|
839
|
-
if (typeof template === "string") {
|
|
840
|
-
return readTemplateFile(template, context);
|
|
841
|
-
}
|
|
842
|
-
if ("content" in template && typeof template.content === "string") {
|
|
843
|
-
return template.content;
|
|
844
|
-
}
|
|
845
|
-
if ("path" in template && typeof template.path === "string") {
|
|
846
|
-
return readTemplateFile(template.path, context);
|
|
847
|
-
}
|
|
848
|
-
return void 0;
|
|
849
|
-
}
|
|
850
|
-
async function readTemplateFile(templatePath, context) {
|
|
851
|
-
const absolutePath = _pathe2.default.isAbsolute(templatePath) ? templatePath : _pathe2.default.resolve(context.cwd, templatePath);
|
|
852
|
-
return _fsextra2.default.readFile(absolutePath, "utf8");
|
|
853
|
-
}
|
|
854
854
|
|
|
855
855
|
// src/cli.ts
|
|
856
856
|
var cli = cac("weapp-vite");
|
|
857
857
|
try {
|
|
858
|
-
|
|
858
|
+
_chunkOQYESMEYcjs.checkRuntime.call(void 0, {
|
|
859
859
|
bun: "0.0.0",
|
|
860
860
|
deno: "0.0.0",
|
|
861
861
|
node: "20.19.0"
|
|
@@ -873,7 +873,7 @@ async function loadConfig(configFile) {
|
|
|
873
873
|
mode: "development"
|
|
874
874
|
};
|
|
875
875
|
const loaded = await _vite.loadConfigFromFile.call(void 0, configEnv, resolvedConfigFile, cwd);
|
|
876
|
-
const weappConfigFilePath = await
|
|
876
|
+
const weappConfigFilePath = await _chunkOQYESMEYcjs.resolveWeappConfigFile.call(void 0, {
|
|
877
877
|
root: cwd,
|
|
878
878
|
specified: resolvedConfigFile
|
|
879
879
|
});
|
|
@@ -921,15 +921,15 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
921
921
|
const urls = webServer.resolvedUrls;
|
|
922
922
|
const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
|
|
923
923
|
if (candidates.length > 0) {
|
|
924
|
-
|
|
924
|
+
_chunkOQYESMEYcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
925
925
|
for (const url of candidates) {
|
|
926
|
-
|
|
926
|
+
_chunkOQYESMEYcjs.logger_default.info(` \u279C ${url}`);
|
|
927
927
|
}
|
|
928
928
|
} else {
|
|
929
|
-
|
|
929
|
+
_chunkOQYESMEYcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
930
930
|
}
|
|
931
931
|
} else {
|
|
932
|
-
|
|
932
|
+
_chunkOQYESMEYcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
933
933
|
}
|
|
934
934
|
logBuildAppFinishOnlyShowOnce = true;
|
|
935
935
|
return;
|
|
@@ -943,19 +943,19 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
943
943
|
args: ["run", "open"]
|
|
944
944
|
}));
|
|
945
945
|
const devCommand = `${command} ${args.join(" ")}`;
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
946
|
+
_chunkOQYESMEYcjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
|
|
947
|
+
_chunkOQYESMEYcjs.logger_default.info(`\u6267\u884C \`${devCommand}\` \u53EF\u4EE5\u76F4\u63A5\u5728 \`\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\` \u91CC\u6253\u5F00\u5F53\u524D\u5E94\u7528`);
|
|
948
|
+
_chunkOQYESMEYcjs.logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55)\uFF0C\u5373\u53EF\u9884\u89C8\u6548\u679C");
|
|
949
949
|
if (!skipWeb && webServer) {
|
|
950
950
|
const urls = webServer.resolvedUrls;
|
|
951
951
|
const candidates = urls ? [..._nullishCoalesce(urls.local, () => ( [])), ..._nullishCoalesce(urls.network, () => ( []))] : [];
|
|
952
952
|
if (candidates.length > 0) {
|
|
953
|
-
|
|
953
|
+
_chunkOQYESMEYcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8\uFF0C\u6D4F\u89C8\u5668\u8BBF\u95EE\uFF1A");
|
|
954
954
|
for (const url of candidates) {
|
|
955
|
-
|
|
955
|
+
_chunkOQYESMEYcjs.logger_default.info(` \u279C ${url}`);
|
|
956
956
|
}
|
|
957
957
|
} else {
|
|
958
|
-
|
|
958
|
+
_chunkOQYESMEYcjs.logger_default.success("Web \u8FD0\u884C\u65F6\u5DF2\u542F\u52A8");
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
logBuildAppFinishOnlyShowOnce = true;
|
|
@@ -985,11 +985,11 @@ async function openIde() {
|
|
|
985
985
|
try {
|
|
986
986
|
await _weappidecli.parse.call(void 0, ["open", "-p"]);
|
|
987
987
|
} catch (error) {
|
|
988
|
-
|
|
988
|
+
_chunkOQYESMEYcjs.logger_default.error(error);
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
991
|
function logRuntimeTarget(targets) {
|
|
992
|
-
|
|
992
|
+
_chunkOQYESMEYcjs.logger_default.info(`\u76EE\u6807\u5E73\u53F0\uFF1A${targets.label}`);
|
|
993
993
|
}
|
|
994
994
|
function resolveRuntimeTargets(options) {
|
|
995
995
|
const rawPlatform = typeof options.platform === "string" ? options.platform : typeof options.p === "string" ? options.p : void 0;
|
|
@@ -997,17 +997,17 @@ function resolveRuntimeTargets(options) {
|
|
|
997
997
|
return {
|
|
998
998
|
runMini: true,
|
|
999
999
|
runWeb: false,
|
|
1000
|
-
mpPlatform:
|
|
1001
|
-
label:
|
|
1000
|
+
mpPlatform: _chunkOQYESMEYcjs.DEFAULT_MP_PLATFORM,
|
|
1001
|
+
label: _chunkOQYESMEYcjs.DEFAULT_MP_PLATFORM
|
|
1002
1002
|
};
|
|
1003
1003
|
}
|
|
1004
|
-
const normalized =
|
|
1004
|
+
const normalized = _chunkOQYESMEYcjs.normalizeMiniPlatform.call(void 0, rawPlatform);
|
|
1005
1005
|
if (!normalized) {
|
|
1006
1006
|
return {
|
|
1007
1007
|
runMini: true,
|
|
1008
1008
|
runWeb: false,
|
|
1009
|
-
mpPlatform:
|
|
1010
|
-
label:
|
|
1009
|
+
mpPlatform: _chunkOQYESMEYcjs.DEFAULT_MP_PLATFORM,
|
|
1010
|
+
label: _chunkOQYESMEYcjs.DEFAULT_MP_PLATFORM
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
1013
|
if (normalized === "h5" || normalized === "web") {
|
|
@@ -1018,7 +1018,7 @@ function resolveRuntimeTargets(options) {
|
|
|
1018
1018
|
label: normalized === "h5" ? "h5" : "web"
|
|
1019
1019
|
};
|
|
1020
1020
|
}
|
|
1021
|
-
const mpPlatform =
|
|
1021
|
+
const mpPlatform = _chunkOQYESMEYcjs.resolveMiniPlatform.call(void 0, normalized);
|
|
1022
1022
|
if (mpPlatform) {
|
|
1023
1023
|
return {
|
|
1024
1024
|
runMini: true,
|
|
@@ -1027,12 +1027,12 @@ function resolveRuntimeTargets(options) {
|
|
|
1027
1027
|
label: mpPlatform
|
|
1028
1028
|
};
|
|
1029
1029
|
}
|
|
1030
|
-
|
|
1030
|
+
_chunkOQYESMEYcjs.logger_default.warn(`\u672A\u8BC6\u522B\u7684\u5E73\u53F0 "${rawPlatform}"\uFF0C\u5DF2\u56DE\u9000\u5230 ${_chunkOQYESMEYcjs.DEFAULT_MP_PLATFORM}`);
|
|
1031
1031
|
return {
|
|
1032
1032
|
runMini: true,
|
|
1033
1033
|
runWeb: false,
|
|
1034
|
-
mpPlatform:
|
|
1035
|
-
label:
|
|
1034
|
+
mpPlatform: _chunkOQYESMEYcjs.DEFAULT_MP_PLATFORM,
|
|
1035
|
+
label: _chunkOQYESMEYcjs.DEFAULT_MP_PLATFORM
|
|
1036
1036
|
};
|
|
1037
1037
|
}
|
|
1038
1038
|
function createInlineConfig(mpPlatform) {
|
|
@@ -1054,7 +1054,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
|
1054
1054
|
const targets = resolveRuntimeTargets(options);
|
|
1055
1055
|
logRuntimeTarget(targets);
|
|
1056
1056
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1057
|
-
const { buildService, configService, webService } = await
|
|
1057
|
+
const { buildService, configService, webService } = await _chunkWYNGNSLKcjs.createCompilerContext.call(void 0, {
|
|
1058
1058
|
cwd: root,
|
|
1059
1059
|
mode: _nullishCoalesce(options.mode, () => ( "development")),
|
|
1060
1060
|
isDev: true,
|
|
@@ -1069,7 +1069,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
|
1069
1069
|
try {
|
|
1070
1070
|
webServer = await _optionalChain([webService, 'optionalAccess', _15 => _15.startDevServer, 'call', _16 => _16()]);
|
|
1071
1071
|
} catch (error) {
|
|
1072
|
-
|
|
1072
|
+
_chunkOQYESMEYcjs.logger_default.error(error);
|
|
1073
1073
|
throw error;
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
@@ -1097,7 +1097,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
1097
1097
|
const targets = resolveRuntimeTargets(options);
|
|
1098
1098
|
logRuntimeTarget(targets);
|
|
1099
1099
|
const inlineConfig = createInlineConfig(targets.mpPlatform);
|
|
1100
|
-
const { buildService, configService, webService } = await
|
|
1100
|
+
const { buildService, configService, webService } = await _chunkWYNGNSLKcjs.createCompilerContext.call(void 0, {
|
|
1101
1101
|
cwd: root,
|
|
1102
1102
|
mode: _nullishCoalesce(options.mode, () => ( "production")),
|
|
1103
1103
|
configFile,
|
|
@@ -1110,9 +1110,9 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
1110
1110
|
if (targets.runWeb && _optionalChain([webConfig, 'optionalAccess', _17 => _17.enabled])) {
|
|
1111
1111
|
try {
|
|
1112
1112
|
await _optionalChain([webService, 'optionalAccess', _18 => _18.build, 'call', _19 => _19()]);
|
|
1113
|
-
|
|
1113
|
+
_chunkOQYESMEYcjs.logger_default.success(`Web \u6784\u5EFA\u5B8C\u6210\uFF0C\u8F93\u51FA\u76EE\u5F55\uFF1A${configService.relativeCwd(webConfig.outDir)}`);
|
|
1114
1114
|
} catch (error) {
|
|
1115
|
-
|
|
1115
|
+
_chunkOQYESMEYcjs.logger_default.error(error);
|
|
1116
1116
|
throw error;
|
|
1117
1117
|
}
|
|
1118
1118
|
}
|
|
@@ -1129,7 +1129,7 @@ cli.command("init").action(async () => {
|
|
|
1129
1129
|
command: "weapp-vite"
|
|
1130
1130
|
});
|
|
1131
1131
|
} catch (error) {
|
|
1132
|
-
|
|
1132
|
+
_chunkOQYESMEYcjs.logger_default.error(error);
|
|
1133
1133
|
}
|
|
1134
1134
|
});
|
|
1135
1135
|
cli.command("open").action(async () => {
|
|
@@ -1139,7 +1139,7 @@ cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
|
1139
1139
|
try {
|
|
1140
1140
|
await _weappidecli.parse.call(void 0, ["build-npm", "-p"]);
|
|
1141
1141
|
} catch (error) {
|
|
1142
|
-
|
|
1142
|
+
_chunkOQYESMEYcjs.logger_default.error(error);
|
|
1143
1143
|
}
|
|
1144
1144
|
});
|
|
1145
1145
|
cli.command("g [filepath]", "generate component").alias("generate").option("-a, --app", "type app").option("-p, --page", "type app").option("-n, --name <name>", "filename").action(async (filepath, options) => {
|
|
@@ -1154,7 +1154,7 @@ cli.command("g [filepath]", "generate component").alias("generate").option("-a,
|
|
|
1154
1154
|
fileName = "app";
|
|
1155
1155
|
}
|
|
1156
1156
|
if (filepath === void 0) {
|
|
1157
|
-
|
|
1157
|
+
_chunkOQYESMEYcjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
|
|
1158
1158
|
return;
|
|
1159
1159
|
}
|
|
1160
1160
|
if (options.page) {
|
|
@@ -1174,5 +1174,5 @@ cli.command("create [outDir]", "create project").option("-t, --template <type>",
|
|
|
1174
1174
|
await _init.createProject.call(void 0, outDir, options.template);
|
|
1175
1175
|
});
|
|
1176
1176
|
cli.help();
|
|
1177
|
-
cli.version(
|
|
1177
|
+
cli.version(_chunkOQYESMEYcjs.VERSION);
|
|
1178
1178
|
cli.parse();
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7EOV7C3M.mjs";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_MP_PLATFORM,
|
|
6
6
|
VERSION,
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
normalizeMiniPlatform,
|
|
10
10
|
resolveMiniPlatform,
|
|
11
11
|
resolveWeappConfigFile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LE4PAGI5.mjs";
|
|
13
13
|
import {
|
|
14
14
|
init_esm_shims
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SSQGJIB5.mjs";
|
|
16
16
|
|
|
17
17
|
// src/cli.ts
|
|
18
18
|
init_esm_shims();
|
|
@@ -764,6 +764,36 @@ var defaultExtensions = {
|
|
|
764
764
|
function resolveExtension(extension) {
|
|
765
765
|
return extension ? extension.startsWith(".") ? extension : `.${extension}` : "";
|
|
766
766
|
}
|
|
767
|
+
async function readTemplateFile(templatePath, context) {
|
|
768
|
+
const absolutePath = path.isAbsolute(templatePath) ? templatePath : path.resolve(context.cwd, templatePath);
|
|
769
|
+
return fs.readFile(absolutePath, "utf8");
|
|
770
|
+
}
|
|
771
|
+
async function loadTemplate(template, context) {
|
|
772
|
+
if (template === void 0) {
|
|
773
|
+
return void 0;
|
|
774
|
+
}
|
|
775
|
+
if (typeof template === "function") {
|
|
776
|
+
const result = await template(context);
|
|
777
|
+
return result == null ? void 0 : String(result);
|
|
778
|
+
}
|
|
779
|
+
if (typeof template === "string") {
|
|
780
|
+
return readTemplateFile(template, context);
|
|
781
|
+
}
|
|
782
|
+
if ("content" in template && typeof template.content === "string") {
|
|
783
|
+
return template.content;
|
|
784
|
+
}
|
|
785
|
+
if ("path" in template && typeof template.path === "string") {
|
|
786
|
+
return readTemplateFile(template.path, context);
|
|
787
|
+
}
|
|
788
|
+
return void 0;
|
|
789
|
+
}
|
|
790
|
+
function resolveTemplate(templates, type, fileType) {
|
|
791
|
+
const scoped = templates?.[type]?.[fileType];
|
|
792
|
+
if (scoped !== void 0) {
|
|
793
|
+
return scoped;
|
|
794
|
+
}
|
|
795
|
+
return templates?.shared?.[fileType];
|
|
796
|
+
}
|
|
767
797
|
async function generate(options) {
|
|
768
798
|
let { fileName, outDir, extensions, type, cwd, templates } = defu(options, {
|
|
769
799
|
type: "component",
|
|
@@ -821,36 +851,6 @@ async function generate(options) {
|
|
|
821
851
|
}
|
|
822
852
|
}
|
|
823
853
|
}
|
|
824
|
-
function resolveTemplate(templates, type, fileType) {
|
|
825
|
-
const scoped = templates?.[type]?.[fileType];
|
|
826
|
-
if (scoped !== void 0) {
|
|
827
|
-
return scoped;
|
|
828
|
-
}
|
|
829
|
-
return templates?.shared?.[fileType];
|
|
830
|
-
}
|
|
831
|
-
async function loadTemplate(template, context) {
|
|
832
|
-
if (template === void 0) {
|
|
833
|
-
return void 0;
|
|
834
|
-
}
|
|
835
|
-
if (typeof template === "function") {
|
|
836
|
-
const result = await template(context);
|
|
837
|
-
return result == null ? void 0 : String(result);
|
|
838
|
-
}
|
|
839
|
-
if (typeof template === "string") {
|
|
840
|
-
return readTemplateFile(template, context);
|
|
841
|
-
}
|
|
842
|
-
if ("content" in template && typeof template.content === "string") {
|
|
843
|
-
return template.content;
|
|
844
|
-
}
|
|
845
|
-
if ("path" in template && typeof template.path === "string") {
|
|
846
|
-
return readTemplateFile(template.path, context);
|
|
847
|
-
}
|
|
848
|
-
return void 0;
|
|
849
|
-
}
|
|
850
|
-
async function readTemplateFile(templatePath, context) {
|
|
851
|
-
const absolutePath = path.isAbsolute(templatePath) ? templatePath : path.resolve(context.cwd, templatePath);
|
|
852
|
-
return fs.readFile(absolutePath, "utf8");
|
|
853
|
-
}
|
|
854
854
|
|
|
855
855
|
// src/cli.ts
|
|
856
856
|
var cli = cac("weapp-vite");
|
package/dist/config.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMQBCRXCDcjs = require('./chunk-MQBCRXCD.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('./chunk-
|
|
10
|
+
var _chunkG6EZVEVTcjs = require('./chunk-G6EZVEVT.cjs');
|
|
11
|
+
require('./chunk-A5DD7GKX.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -16,4 +16,4 @@ require('./chunk-WWFEREWV.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
exports.defineAppJson =
|
|
19
|
+
exports.defineAppJson = _chunkG6EZVEVTcjs.defineAppJson; exports.defineComponentJson = _chunkG6EZVEVTcjs.defineComponentJson; exports.defineConfig = _chunkMQBCRXCDcjs.defineConfig; exports.definePageJson = _chunkG6EZVEVTcjs.definePageJson; exports.defineSitemapJson = _chunkG6EZVEVTcjs.defineSitemapJson; exports.defineThemeJson = _chunkG6EZVEVTcjs.defineThemeJson;
|
package/dist/config.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N463WDOG.mjs";
|
|
4
4
|
import {
|
|
5
5
|
defineAppJson,
|
|
6
6
|
defineComponentJson,
|
|
7
7
|
definePageJson,
|
|
8
8
|
defineSitemapJson,
|
|
9
9
|
defineThemeJson
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-2SUWUB42.mjs";
|
|
11
|
+
import "./chunk-SSQGJIB5.mjs";
|
|
12
12
|
export {
|
|
13
13
|
defineAppJson,
|
|
14
14
|
defineComponentJson,
|
package/dist/index.cjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkWYNGNSLKcjs = require('./chunk-WYNGNSLK.cjs');
|
|
4
|
+
require('./chunk-OQYESMEY.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkMQBCRXCDcjs = require('./chunk-MQBCRXCD.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
require('./chunk-
|
|
14
|
+
var _chunkG6EZVEVTcjs = require('./chunk-G6EZVEVT.cjs');
|
|
15
|
+
require('./chunk-FOWFAOSV.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkA5DD7GKXcjs = require('./chunk-A5DD7GKX.cjs');
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
|
|
21
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -27,4 +27,4 @@ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
exports.createCompilerContext =
|
|
30
|
+
exports.createCompilerContext = _chunkWYNGNSLKcjs.createCompilerContext; exports.defineAppJson = _chunkG6EZVEVTcjs.defineAppJson; exports.defineComponentJson = _chunkG6EZVEVTcjs.defineComponentJson; exports.defineConfig = _chunkMQBCRXCDcjs.defineConfig; exports.definePageJson = _chunkG6EZVEVTcjs.definePageJson; exports.defineSitemapJson = _chunkG6EZVEVTcjs.defineSitemapJson; exports.defineThemeJson = _chunkG6EZVEVTcjs.defineThemeJson;
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-7EOV7C3M.mjs";
|
|
4
|
+
import "./chunk-LE4PAGI5.mjs";
|
|
5
5
|
import {
|
|
6
6
|
defineConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-N463WDOG.mjs";
|
|
8
8
|
import {
|
|
9
9
|
defineAppJson,
|
|
10
10
|
defineComponentJson,
|
|
11
11
|
definePageJson,
|
|
12
12
|
defineSitemapJson,
|
|
13
13
|
defineThemeJson
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-2SUWUB42.mjs";
|
|
15
|
+
import "./chunk-ZMX6CFVX.mjs";
|
|
16
16
|
import {
|
|
17
17
|
init_esm_shims
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SSQGJIB5.mjs";
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
init_esm_shims();
|
package/dist/json.cjs
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunkG6EZVEVTcjs = require('./chunk-G6EZVEVT.cjs');
|
|
8
|
+
require('./chunk-A5DD7GKX.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
exports.defineAppJson =
|
|
15
|
+
exports.defineAppJson = _chunkG6EZVEVTcjs.defineAppJson; exports.defineComponentJson = _chunkG6EZVEVTcjs.defineComponentJson; exports.definePageJson = _chunkG6EZVEVTcjs.definePageJson; exports.defineSitemapJson = _chunkG6EZVEVTcjs.defineSitemapJson; exports.defineThemeJson = _chunkG6EZVEVTcjs.defineThemeJson;
|
package/dist/json.mjs
CHANGED
package/dist/types.cjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";require('./chunk-
|
|
1
|
+
"use strict";require('./chunk-FOWFAOSV.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkA5DD7GKXcjs = require('./chunk-A5DD7GKX.cjs');
|
|
5
5
|
|
|
6
6
|
// src/types/index.ts
|
|
7
|
-
|
|
7
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
8
8
|
|
|
9
9
|
// src/types/config.ts
|
|
10
|
-
|
|
10
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11
11
|
|
|
12
12
|
// src/types/context.ts
|
|
13
|
-
|
|
13
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
14
14
|
|
|
15
15
|
// src/types/entry.ts
|
|
16
|
-
|
|
16
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
17
17
|
|
|
18
18
|
// src/types/errors.ts
|
|
19
|
-
|
|
19
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
20
20
|
|
|
21
21
|
// src/types/plugin.ts
|
|
22
|
-
|
|
22
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
23
23
|
|
|
24
24
|
// src/types/routes.ts
|
|
25
|
-
|
|
25
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|