weapp-vite 5.1.8 → 5.2.0-alpha.0
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 +9 -10
- package/dist/auto-import-components/resolvers.mjs +5 -6
- package/dist/{chunk-25P7FHKE.mjs → chunk-7MAZ2JUY.mjs} +2 -4
- package/dist/chunk-BT7FLFCC.cjs +29 -0
- package/dist/{chunk-HZDUFKUQ.cjs → chunk-DVVMF6ND.cjs} +2 -4
- package/dist/chunk-FUOZYLBR.mjs +29 -0
- package/dist/{chunk-CFXQW5Z6.mjs → chunk-HVMR6H5Z.mjs} +1 -3
- package/dist/chunk-NANSUN4W.mjs +6 -0
- package/dist/{chunk-PGL7ZN2W.cjs → chunk-OS76JPG2.cjs} +4 -6
- package/dist/{chunk-V5JUVPYM.mjs → chunk-Q43Q3Z2L.mjs} +10622 -20717
- package/dist/chunk-U5ERJUOU.cjs +6 -0
- package/dist/{chunk-TBCCIJBL.cjs → chunk-Y6PWETW7.cjs} +24244 -34339
- package/dist/cli.cjs +131 -128
- package/dist/cli.mjs +113 -110
- package/dist/{config-D8_I48lF.d.cts → config-DZ6sLDPC.d.cts} +188 -181
- package/dist/{config-bZQG-PcY.d.ts → config-jn9VVQXs.d.ts} +188 -181
- package/dist/config.cjs +4 -4
- package/dist/config.d.cts +3 -5
- package/dist/config.d.ts +3 -5
- package/dist/config.mjs +3 -3
- package/dist/index.cjs +7 -9
- package/dist/index.d.cts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.mjs +6 -8
- package/dist/json.cjs +3 -3
- package/dist/json.d.cts +3 -5
- package/dist/json.d.ts +3 -5
- package/dist/json.mjs +2 -2
- package/dist/types.cjs +8 -7
- package/dist/types.d.cts +7 -9
- package/dist/types.d.ts +7 -9
- package/dist/types.mjs +2 -1
- package/dist/volar.cjs +2 -2
- package/dist/volar.mjs +1 -1
- package/package.json +15 -17
- package/dist/chunk-AIYQXRJY.mjs +0 -30
- package/dist/chunk-O47EPGAL.cjs +0 -30
package/dist/cli.mjs
CHANGED
|
@@ -2,16 +2,11 @@ import {
|
|
|
2
2
|
VERSION,
|
|
3
3
|
checkRuntime,
|
|
4
4
|
createCompilerContext,
|
|
5
|
-
logger_default
|
|
6
|
-
|
|
7
|
-
} from "./chunk-V5JUVPYM.mjs";
|
|
8
|
-
import "./chunk-CFXQW5Z6.mjs";
|
|
9
|
-
import "./chunk-AIYQXRJY.mjs";
|
|
5
|
+
logger_default
|
|
6
|
+
} from "./chunk-Q43Q3Z2L.mjs";
|
|
10
7
|
import {
|
|
11
|
-
__name,
|
|
12
|
-
__toESM,
|
|
13
8
|
init_esm_shims
|
|
14
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7MAZ2JUY.mjs";
|
|
15
10
|
|
|
16
11
|
// src/cli.ts
|
|
17
12
|
init_esm_shims();
|
|
@@ -24,12 +19,10 @@ import { EventEmitter } from "events";
|
|
|
24
19
|
function toArr(any) {
|
|
25
20
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
26
21
|
}
|
|
27
|
-
__name(toArr, "toArr");
|
|
28
22
|
function toVal(out, key, val, opts) {
|
|
29
23
|
var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
|
|
30
24
|
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
31
25
|
}
|
|
32
|
-
__name(toVal, "toVal");
|
|
33
26
|
function mri2(args, opts) {
|
|
34
27
|
args = args || [];
|
|
35
28
|
opts = opts || {};
|
|
@@ -118,13 +111,12 @@ function mri2(args, opts) {
|
|
|
118
111
|
}
|
|
119
112
|
return out;
|
|
120
113
|
}
|
|
121
|
-
|
|
122
|
-
var
|
|
123
|
-
var findAllBrackets = /* @__PURE__ */ __name((v) => {
|
|
114
|
+
var removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
|
|
115
|
+
var findAllBrackets = (v) => {
|
|
124
116
|
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
125
117
|
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
126
118
|
const res = [];
|
|
127
|
-
const parse2 =
|
|
119
|
+
const parse2 = (match) => {
|
|
128
120
|
let variadic = false;
|
|
129
121
|
let value = match[1];
|
|
130
122
|
if (value.startsWith("...")) {
|
|
@@ -136,7 +128,7 @@ var findAllBrackets = /* @__PURE__ */ __name((v) => {
|
|
|
136
128
|
value,
|
|
137
129
|
variadic
|
|
138
130
|
};
|
|
139
|
-
}
|
|
131
|
+
};
|
|
140
132
|
let angledMatch;
|
|
141
133
|
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
|
|
142
134
|
res.push(parse2(angledMatch));
|
|
@@ -146,8 +138,8 @@ var findAllBrackets = /* @__PURE__ */ __name((v) => {
|
|
|
146
138
|
res.push(parse2(squareMatch));
|
|
147
139
|
}
|
|
148
140
|
return res;
|
|
149
|
-
}
|
|
150
|
-
var getMriOptions =
|
|
141
|
+
};
|
|
142
|
+
var getMriOptions = (options) => {
|
|
151
143
|
const result = { alias: {}, boolean: [] };
|
|
152
144
|
for (const [index, option] of options.entries()) {
|
|
153
145
|
if (option.names.length > 1) {
|
|
@@ -167,21 +159,21 @@ var getMriOptions = /* @__PURE__ */ __name((options) => {
|
|
|
167
159
|
}
|
|
168
160
|
}
|
|
169
161
|
return result;
|
|
170
|
-
}
|
|
171
|
-
var findLongest =
|
|
162
|
+
};
|
|
163
|
+
var findLongest = (arr) => {
|
|
172
164
|
return arr.sort((a, b) => {
|
|
173
165
|
return a.length > b.length ? -1 : 1;
|
|
174
166
|
})[0];
|
|
175
|
-
}
|
|
176
|
-
var padRight =
|
|
167
|
+
};
|
|
168
|
+
var padRight = (str, length) => {
|
|
177
169
|
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
178
|
-
}
|
|
179
|
-
var camelcase =
|
|
170
|
+
};
|
|
171
|
+
var camelcase = (input) => {
|
|
180
172
|
return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
|
|
181
173
|
return p1 + p2.toUpperCase();
|
|
182
174
|
});
|
|
183
|
-
}
|
|
184
|
-
var setDotProp =
|
|
175
|
+
};
|
|
176
|
+
var setDotProp = (obj, keys, val) => {
|
|
185
177
|
let i = 0;
|
|
186
178
|
let length = keys.length;
|
|
187
179
|
let t = obj;
|
|
@@ -190,8 +182,8 @@ var setDotProp = /* @__PURE__ */ __name((obj, keys, val) => {
|
|
|
190
182
|
x = t[keys[i]];
|
|
191
183
|
t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
|
|
192
184
|
}
|
|
193
|
-
}
|
|
194
|
-
var setByType =
|
|
185
|
+
};
|
|
186
|
+
var setByType = (obj, transforms) => {
|
|
195
187
|
for (const key of Object.keys(transforms)) {
|
|
196
188
|
const transform = transforms[key];
|
|
197
189
|
if (transform.shouldTransform) {
|
|
@@ -201,20 +193,17 @@ var setByType = /* @__PURE__ */ __name((obj, transforms) => {
|
|
|
201
193
|
}
|
|
202
194
|
}
|
|
203
195
|
}
|
|
204
|
-
}
|
|
205
|
-
var getFileName =
|
|
196
|
+
};
|
|
197
|
+
var getFileName = (input) => {
|
|
206
198
|
const m = /([^\\\/]+)$/.exec(input);
|
|
207
199
|
return m ? m[1] : "";
|
|
208
|
-
}
|
|
209
|
-
var camelcaseOptionName =
|
|
200
|
+
};
|
|
201
|
+
var camelcaseOptionName = (name) => {
|
|
210
202
|
return name.split(".").map((v, i) => {
|
|
211
203
|
return i === 0 ? camelcase(v) : v;
|
|
212
204
|
}).join(".");
|
|
213
|
-
}
|
|
205
|
+
};
|
|
214
206
|
var CACError = class extends Error {
|
|
215
|
-
static {
|
|
216
|
-
__name(this, "CACError");
|
|
217
|
-
}
|
|
218
207
|
constructor(message) {
|
|
219
208
|
super(message);
|
|
220
209
|
this.name = this.constructor.name;
|
|
@@ -226,9 +215,6 @@ var CACError = class extends Error {
|
|
|
226
215
|
}
|
|
227
216
|
};
|
|
228
217
|
var Option = class {
|
|
229
|
-
static {
|
|
230
|
-
__name(this, "Option");
|
|
231
|
-
}
|
|
232
218
|
constructor(rawName, description, config) {
|
|
233
219
|
this.rawName = rawName;
|
|
234
220
|
this.description = description;
|
|
@@ -259,9 +245,6 @@ var Option = class {
|
|
|
259
245
|
var processArgs = process.argv;
|
|
260
246
|
var platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
|
|
261
247
|
var Command = class {
|
|
262
|
-
static {
|
|
263
|
-
__name(this, "Command");
|
|
264
|
-
}
|
|
265
248
|
constructor(rawName, description, config = {}, cli2) {
|
|
266
249
|
this.rawName = rawName;
|
|
267
250
|
this.description = description;
|
|
@@ -422,18 +405,12 @@ ${section.body}` : section.body;
|
|
|
422
405
|
}
|
|
423
406
|
};
|
|
424
407
|
var GlobalCommand = class extends Command {
|
|
425
|
-
static {
|
|
426
|
-
__name(this, "GlobalCommand");
|
|
427
|
-
}
|
|
428
408
|
constructor(cli2) {
|
|
429
409
|
super("@@global@@", "", {}, cli2);
|
|
430
410
|
}
|
|
431
411
|
};
|
|
432
412
|
var __assign = Object.assign;
|
|
433
413
|
var CAC = class extends EventEmitter {
|
|
434
|
-
static {
|
|
435
|
-
__name(this, "CAC");
|
|
436
|
-
}
|
|
437
414
|
constructor(name = "") {
|
|
438
415
|
super();
|
|
439
416
|
this.name = name;
|
|
@@ -620,7 +597,7 @@ var CAC = class extends EventEmitter {
|
|
|
620
597
|
return command.commandAction.apply(this, actionArgs);
|
|
621
598
|
}
|
|
622
599
|
};
|
|
623
|
-
var cac =
|
|
600
|
+
var cac = (name = "") => new CAC(name);
|
|
624
601
|
|
|
625
602
|
// ../../node_modules/.pnpm/package-manager-detector@1.3.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
626
603
|
init_esm_shims();
|
|
@@ -633,13 +610,11 @@ function dashDashArg(agent, agentCommand) {
|
|
|
633
610
|
}
|
|
634
611
|
};
|
|
635
612
|
}
|
|
636
|
-
__name(dashDashArg, "dashDashArg");
|
|
637
613
|
function denoExecute() {
|
|
638
614
|
return (args) => {
|
|
639
615
|
return ["deno", "run", `npm:${args[0]}`, ...args.slice(1)];
|
|
640
616
|
};
|
|
641
617
|
}
|
|
642
|
-
__name(denoExecute, "denoExecute");
|
|
643
618
|
var npm = {
|
|
644
619
|
"agent": ["npm", 0],
|
|
645
620
|
"run": dashDashArg("npm", "run"),
|
|
@@ -738,7 +713,6 @@ function resolveCommand(agent, command, args) {
|
|
|
738
713
|
const value = COMMANDS[agent][command];
|
|
739
714
|
return constructCommand(value, args);
|
|
740
715
|
}
|
|
741
|
-
__name(resolveCommand, "resolveCommand");
|
|
742
716
|
function constructCommand(value, args) {
|
|
743
717
|
if (value == null)
|
|
744
718
|
return null;
|
|
@@ -752,7 +726,6 @@ function constructCommand(value, args) {
|
|
|
752
726
|
args: list.slice(1)
|
|
753
727
|
};
|
|
754
728
|
}
|
|
755
|
-
__name(constructCommand, "constructCommand");
|
|
756
729
|
|
|
757
730
|
// src/cli.ts
|
|
758
731
|
import path2 from "pathe";
|
|
@@ -769,7 +742,6 @@ import path from "pathe";
|
|
|
769
742
|
function composePath(outDir, filename) {
|
|
770
743
|
return `${outDir}${outDir ? "/" : ""}${filename}`;
|
|
771
744
|
}
|
|
772
|
-
__name(composePath, "composePath");
|
|
773
745
|
var defaultExtensions = {
|
|
774
746
|
js: "js",
|
|
775
747
|
json: "json",
|
|
@@ -779,48 +751,56 @@ var defaultExtensions = {
|
|
|
779
751
|
function resolveExtension(extension) {
|
|
780
752
|
return extension ? extension.startsWith(".") ? extension : `.${extension}` : "";
|
|
781
753
|
}
|
|
782
|
-
__name(resolveExtension, "resolveExtension");
|
|
783
754
|
async function generate(options) {
|
|
784
|
-
let { fileName, outDir, extensions, type, cwd } = defu(options, {
|
|
785
|
-
// fileName: 'index',
|
|
755
|
+
let { fileName, outDir, extensions, type, cwd, templates } = defu(options, {
|
|
786
756
|
type: "component",
|
|
787
757
|
extensions: {
|
|
788
758
|
...defaultExtensions
|
|
789
759
|
},
|
|
790
|
-
cwd: process2.cwd()
|
|
760
|
+
cwd: process2.cwd(),
|
|
761
|
+
templates: void 0
|
|
791
762
|
});
|
|
792
763
|
if (fileName === void 0) {
|
|
793
764
|
fileName = path.basename(outDir);
|
|
794
765
|
}
|
|
795
766
|
const basepath = path.resolve(cwd, outDir);
|
|
796
|
-
const targetFileTypes = [
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
code = generateWxml(path.join(outDir, fileName));
|
|
813
|
-
} else if (x === "json") {
|
|
814
|
-
code = generateJson(type, ext);
|
|
815
|
-
if (ext === "js" || ext === "ts") {
|
|
816
|
-
ext = `json.${ext}`;
|
|
767
|
+
const targetFileTypes = type === "app" ? ["js", "wxss", "json"] : ["js", "wxss", "json", "wxml"];
|
|
768
|
+
const files = [];
|
|
769
|
+
for (const fileType of targetFileTypes) {
|
|
770
|
+
const configuredExt = extensions[fileType] ?? defaultExtensions[fileType];
|
|
771
|
+
let resolvedExt = configuredExt;
|
|
772
|
+
let defaultCode;
|
|
773
|
+
if (fileType === "js") {
|
|
774
|
+
defaultCode = generateJs(type);
|
|
775
|
+
} else if (fileType === "wxss") {
|
|
776
|
+
defaultCode = generateWxss();
|
|
777
|
+
} else if (fileType === "wxml") {
|
|
778
|
+
defaultCode = generateWxml(path.join(outDir, fileName));
|
|
779
|
+
} else if (fileType === "json") {
|
|
780
|
+
defaultCode = generateJson(type, configuredExt);
|
|
781
|
+
if (configuredExt === "js" || configuredExt === "ts") {
|
|
782
|
+
resolvedExt = `json.${configuredExt}`;
|
|
817
783
|
}
|
|
818
784
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
785
|
+
const context = {
|
|
786
|
+
type,
|
|
787
|
+
fileType,
|
|
788
|
+
fileName,
|
|
789
|
+
outDir,
|
|
790
|
+
extension: resolvedExt,
|
|
791
|
+
cwd,
|
|
792
|
+
defaultCode
|
|
822
793
|
};
|
|
823
|
-
|
|
794
|
+
const template = resolveTemplate(templates, type, fileType);
|
|
795
|
+
const customCode = await loadTemplate(template, context);
|
|
796
|
+
const finalCode = customCode ?? defaultCode;
|
|
797
|
+
if (finalCode !== void 0) {
|
|
798
|
+
files.push({
|
|
799
|
+
fileName: `${fileName}${resolveExtension(resolvedExt)}`,
|
|
800
|
+
code: finalCode
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
}
|
|
824
804
|
for (const { code, fileName: fileName2 } of files) {
|
|
825
805
|
if (code !== void 0) {
|
|
826
806
|
await fs.outputFile(path.resolve(basepath, fileName2), code, "utf8");
|
|
@@ -828,10 +808,38 @@ async function generate(options) {
|
|
|
828
808
|
}
|
|
829
809
|
}
|
|
830
810
|
}
|
|
831
|
-
|
|
811
|
+
function resolveTemplate(templates, type, fileType) {
|
|
812
|
+
const scoped = templates?.[type]?.[fileType];
|
|
813
|
+
if (scoped !== void 0) {
|
|
814
|
+
return scoped;
|
|
815
|
+
}
|
|
816
|
+
return templates?.shared?.[fileType];
|
|
817
|
+
}
|
|
818
|
+
async function loadTemplate(template, context) {
|
|
819
|
+
if (template === void 0) {
|
|
820
|
+
return void 0;
|
|
821
|
+
}
|
|
822
|
+
if (typeof template === "function") {
|
|
823
|
+
const result = await template(context);
|
|
824
|
+
return result == null ? void 0 : String(result);
|
|
825
|
+
}
|
|
826
|
+
if (typeof template === "string") {
|
|
827
|
+
return readTemplateFile(template, context);
|
|
828
|
+
}
|
|
829
|
+
if ("content" in template && typeof template.content === "string") {
|
|
830
|
+
return template.content;
|
|
831
|
+
}
|
|
832
|
+
if ("path" in template && typeof template.path === "string") {
|
|
833
|
+
return readTemplateFile(template.path, context);
|
|
834
|
+
}
|
|
835
|
+
return void 0;
|
|
836
|
+
}
|
|
837
|
+
async function readTemplateFile(templatePath, context) {
|
|
838
|
+
const absolutePath = path.isAbsolute(templatePath) ? templatePath : path.resolve(context.cwd, templatePath);
|
|
839
|
+
return fs.readFile(absolutePath, "utf8");
|
|
840
|
+
}
|
|
832
841
|
|
|
833
842
|
// src/cli.ts
|
|
834
|
-
var import_reflect_metadata = __toESM(require_Reflect(), 1);
|
|
835
843
|
var cli = cac("weapp-vite");
|
|
836
844
|
try {
|
|
837
845
|
checkRuntime({
|
|
@@ -847,18 +855,16 @@ function loadConfig(configFile) {
|
|
|
847
855
|
mode: "development"
|
|
848
856
|
}, configFile, process3.cwd());
|
|
849
857
|
}
|
|
850
|
-
__name(loadConfig, "loadConfig");
|
|
851
858
|
var logBuildAppFinishOnlyShowOnce = false;
|
|
852
859
|
function logBuildAppFinish(configService) {
|
|
853
860
|
if (!logBuildAppFinishOnlyShowOnce) {
|
|
854
|
-
const { command, args } = resolveCommand(
|
|
855
|
-
|
|
856
|
-
|
|
861
|
+
const { command, args } = resolveCommand(
|
|
862
|
+
configService.packageManager.agent,
|
|
863
|
+
"run",
|
|
864
|
+
["open"]
|
|
865
|
+
) ?? {
|
|
857
866
|
command: "npm",
|
|
858
|
-
args: [
|
|
859
|
-
"run",
|
|
860
|
-
"open"
|
|
861
|
-
]
|
|
867
|
+
args: ["run", "open"]
|
|
862
868
|
};
|
|
863
869
|
const devCommand = `${command} ${args.join(" ")}`;
|
|
864
870
|
logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
|
|
@@ -867,7 +873,6 @@ function logBuildAppFinish(configService) {
|
|
|
867
873
|
logBuildAppFinishOnlyShowOnce = true;
|
|
868
874
|
}
|
|
869
875
|
}
|
|
870
|
-
__name(logBuildAppFinish, "logBuildAppFinish");
|
|
871
876
|
function filterDuplicateOptions(options) {
|
|
872
877
|
for (const [key, value] of Object.entries(options)) {
|
|
873
878
|
if (Array.isArray(value)) {
|
|
@@ -875,7 +880,6 @@ function filterDuplicateOptions(options) {
|
|
|
875
880
|
}
|
|
876
881
|
}
|
|
877
882
|
}
|
|
878
|
-
__name(filterDuplicateOptions, "filterDuplicateOptions");
|
|
879
883
|
function resolveConfigFile(options) {
|
|
880
884
|
if (typeof options.config === "string") {
|
|
881
885
|
return options.config;
|
|
@@ -884,29 +888,21 @@ function resolveConfigFile(options) {
|
|
|
884
888
|
return options.c;
|
|
885
889
|
}
|
|
886
890
|
}
|
|
887
|
-
__name(resolveConfigFile, "resolveConfigFile");
|
|
888
891
|
function convertBase(v) {
|
|
889
892
|
if (v === 0) {
|
|
890
893
|
return "";
|
|
891
894
|
}
|
|
892
895
|
return v;
|
|
893
896
|
}
|
|
894
|
-
__name(convertBase, "convertBase");
|
|
895
897
|
async function openIde() {
|
|
896
898
|
try {
|
|
897
|
-
await parse([
|
|
898
|
-
"open",
|
|
899
|
-
"-p"
|
|
900
|
-
]);
|
|
899
|
+
await parse(["open", "-p"]);
|
|
901
900
|
} catch (error) {
|
|
902
901
|
logger_default.error(error);
|
|
903
902
|
}
|
|
904
903
|
}
|
|
905
|
-
__name(openIde, "openIde");
|
|
906
904
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, {
|
|
907
|
-
type: [
|
|
908
|
-
convertBase
|
|
909
|
-
]
|
|
905
|
+
type: [convertBase]
|
|
910
906
|
}).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
|
911
907
|
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).action(async (root, options) => {
|
|
912
908
|
filterDuplicateOptions(options);
|
|
@@ -923,7 +919,16 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
|
923
919
|
await openIde();
|
|
924
920
|
}
|
|
925
921
|
});
|
|
926
|
-
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option(
|
|
922
|
+
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'modules')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option(
|
|
923
|
+
"--sourcemap [output]",
|
|
924
|
+
`[boolean | "inline" | "hidden"] output source maps for build (default: false)`
|
|
925
|
+
).option(
|
|
926
|
+
"--minify [minifier]",
|
|
927
|
+
`[boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)`
|
|
928
|
+
).option(
|
|
929
|
+
"--emptyOutDir",
|
|
930
|
+
`[boolean] force empty outDir when it's outside of root`
|
|
931
|
+
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).action(async (root, options) => {
|
|
927
932
|
filterDuplicateOptions(options);
|
|
928
933
|
const configFile = resolveConfigFile(options);
|
|
929
934
|
const { buildService, configService } = await createCompilerContext({
|
|
@@ -951,10 +956,7 @@ cli.command("open").action(async () => {
|
|
|
951
956
|
});
|
|
952
957
|
cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
953
958
|
try {
|
|
954
|
-
await parse([
|
|
955
|
-
"build-npm",
|
|
956
|
-
"-p"
|
|
957
|
-
]);
|
|
959
|
+
await parse(["build-npm", "-p"]);
|
|
958
960
|
} catch (error) {
|
|
959
961
|
logger_default.error(error);
|
|
960
962
|
}
|
|
@@ -983,7 +985,8 @@ cli.command("g [filepath]", "generate component").alias("generate").option("-a,
|
|
|
983
985
|
outDir: path2.join(generateOptions?.dirs?.[type] ?? "", filepath),
|
|
984
986
|
type,
|
|
985
987
|
fileName,
|
|
986
|
-
extensions: generateOptions?.extensions
|
|
988
|
+
extensions: generateOptions?.extensions,
|
|
989
|
+
templates: generateOptions?.templates
|
|
987
990
|
});
|
|
988
991
|
});
|
|
989
992
|
cli.command("create [outDir]", "create project").option("-t, --template <type>", "template type").action(async (outDir, options) => {
|