@weapp-tailwindcss/cli 0.0.0-alpha.0 → 0.0.0-alpha.1

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.cjs CHANGED
@@ -3,19 +3,19 @@
3
3
  const commander = require('commander');
4
4
  const loadPostcssConfig = require('postcss-load-config');
5
5
  const path = require('node:path');
6
+ const fs = require('fs-extra');
6
7
  const gulp = require('weapp-tailwindcss/gulp');
7
8
  const gulp$1 = require('gulp');
8
- const fs = require('fs-extra');
9
9
  const cosmiconfig = require('cosmiconfig');
10
10
 
11
11
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
12
12
 
13
13
  const loadPostcssConfig__default = /*#__PURE__*/_interopDefaultCompat(loadPostcssConfig);
14
14
  const path__default = /*#__PURE__*/_interopDefaultCompat(path);
15
- const gulp__default = /*#__PURE__*/_interopDefaultCompat(gulp$1);
16
15
  const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
16
+ const gulp__default = /*#__PURE__*/_interopDefaultCompat(gulp$1);
17
17
 
18
- function isPlainObject(value) {
18
+ function isPlainObject$2(value) {
19
19
  if (value === null || typeof value !== "object") {
20
20
  return false;
21
21
  }
@@ -33,7 +33,7 @@ function isPlainObject(value) {
33
33
  }
34
34
 
35
35
  function _defu(baseObject, defaults, namespace = ".", merger) {
36
- if (!isPlainObject(defaults)) {
36
+ if (!isPlainObject$2(defaults)) {
37
37
  return _defu(baseObject, {}, namespace, merger);
38
38
  }
39
39
  const object = Object.assign({}, defaults);
@@ -50,7 +50,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
50
50
  }
51
51
  if (Array.isArray(value) && Array.isArray(object[key])) {
52
52
  object[key] = [...value, ...object[key]];
53
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
53
+ } else if (isPlainObject$2(value) && isPlainObject$2(object[key])) {
54
54
  object[key] = _defu(
55
55
  value,
56
56
  object[key],
@@ -79,40 +79,21 @@ var AssetType = /* @__PURE__ */ ((AssetType2) => {
79
79
  return AssetType2;
80
80
  })(AssetType || {});
81
81
 
82
- const defaultJavascriptExtensions = ["js"];
83
- const defaultTypescriptExtensions = ["ts"];
84
- const defaultWxsExtensions = ["wxs"];
85
- const defaultNodeModulesDirs = ["**/node_modules/**", "**/miniprogram_npm/**", "**/project.config.json/**", "**/project.private.config.json/**", "**/package.json/**"];
86
- async function build(options) {
87
- const {
88
- root: cwd,
89
- weappTailwindcssOptions,
90
- outDir,
91
- src: srcBase,
92
- clean,
93
- extensions,
94
- exclude,
95
- include
96
- } = defu(options, {
97
- outDir: "dist",
98
- weappTailwindcssOptions: {},
99
- clean: true,
100
- src: "",
101
- exclude: [...defaultNodeModulesDirs],
102
- extensions: {
103
- javascript: [...defaultJavascriptExtensions, ...defaultTypescriptExtensions, ...defaultWxsExtensions],
104
- html: ["wxml"],
105
- css: ["wxss", "less", "sass", "scss"],
106
- json: ["json"]
82
+ function getTasks(options) {
83
+ const { root: cwd, weappTailwindcssOptions, outDir, src: srcBase, extensions, exclude, include } = options;
84
+ const globsSet = /* @__PURE__ */ new Set();
85
+ const base = srcBase ? srcBase + "/" : "";
86
+ function globsSetAdd(...value) {
87
+ for (const v of value) {
88
+ if (Array.isArray(v)) {
89
+ for (const vv of v) {
90
+ globsSet.add(vv);
91
+ }
92
+ } else {
93
+ globsSet.add(v);
94
+ }
107
95
  }
108
- });
109
- if (clean) {
110
- const { deleteAsync } = await import('del');
111
- const patterns = [outDir + "/**"];
112
- await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
113
96
  }
114
- await fs.ensureDir(path__default.resolve(cwd, outDir));
115
- const base = srcBase ? srcBase + "/" : "";
116
97
  function getGlobs(type) {
117
98
  const globs = [];
118
99
  if (typeof include === "function") {
@@ -130,8 +111,11 @@ async function build(options) {
130
111
  function getJsTasks() {
131
112
  const assetType = AssetType.JavaScript;
132
113
  const globs = getGlobs(assetType);
114
+ globsSetAdd(globs);
133
115
  return extensions[assetType].map((x) => {
134
- return () => gulp__default.src([`${base}**/*.${x}`, ...globs], { cwd }).pipe(
116
+ const src = `${base}**/*.${x}`;
117
+ globsSetAdd(src);
118
+ return () => gulp__default.src([src, ...globs], { cwd }).pipe(
135
119
  transformJs({
136
120
  babelParserOptions: x === "ts" ? {
137
121
  plugins: ["typescript"]
@@ -147,8 +131,11 @@ async function build(options) {
147
131
  function getJsonTasks() {
148
132
  const assetType = AssetType.Json;
149
133
  const globs = getGlobs(assetType);
134
+ globsSetAdd(globs);
150
135
  return extensions[assetType].map((x) => {
151
- return () => gulp__default.src([`${base}**/*.${x}`, ...globs], { cwd }).pipe(
136
+ const src = `${base}**/*.${x}`;
137
+ globsSetAdd(src);
138
+ return () => gulp__default.src([src, ...globs], { cwd }).pipe(
152
139
  gulp__default.dest(outDir, {
153
140
  cwd
154
141
  })
@@ -158,8 +145,11 @@ async function build(options) {
158
145
  function getCssTasks() {
159
146
  const assetType = AssetType.Css;
160
147
  const globs = getGlobs(assetType);
148
+ globsSetAdd(globs);
161
149
  return extensions[assetType].map((x) => {
162
- return () => gulp__default.src([`${base}**/*.${x}`, ...globs], { cwd }).pipe(transformWxss()).pipe(
150
+ const src = `${base}**/*.${x}`;
151
+ globsSetAdd(src);
152
+ return () => gulp__default.src([src, ...globs], { cwd }).pipe(transformWxss()).pipe(
163
153
  gulp__default.dest(outDir, {
164
154
  cwd
165
155
  })
@@ -169,8 +159,11 @@ async function build(options) {
169
159
  function getHtmlTasks() {
170
160
  const assetType = AssetType.Html;
171
161
  const globs = getGlobs(assetType);
162
+ globsSetAdd(globs);
172
163
  return extensions[assetType].map((x) => {
173
- return () => gulp__default.src([`${base}**/*.${x}`, ...globs], { cwd }).pipe(transformWxml()).pipe(
164
+ const src = `${base}**/*.${x}`;
165
+ globsSetAdd(src);
166
+ return () => gulp__default.src([src, ...globs], { cwd }).pipe(transformWxml()).pipe(
174
167
  gulp__default.dest(outDir, {
175
168
  cwd
176
169
  })
@@ -179,27 +172,450 @@ async function build(options) {
179
172
  }
180
173
  function copyOthers() {
181
174
  if (Array.isArray(include)) {
182
- return gulp__default.src(
183
- include.map((x) => {
184
- return `${base}${x}`;
185
- }),
186
- { cwd }
187
- ).pipe(
175
+ const globs = include.map((x) => {
176
+ return `${base}${x}`;
177
+ });
178
+ globsSetAdd(globs);
179
+ return gulp__default.src(globs, { cwd }).pipe(
188
180
  gulp__default.dest(outDir, {
189
181
  cwd
190
182
  })
191
183
  );
192
184
  }
193
185
  }
186
+ return {
187
+ getGlobs,
188
+ getJsTasks,
189
+ getJsonTasks,
190
+ getCssTasks,
191
+ getHtmlTasks,
192
+ copyOthers,
193
+ globsSet
194
+ };
195
+ }
196
+
197
+ const defaultJavascriptExtensions = ["js"];
198
+ const defaultTypescriptExtensions = ["ts"];
199
+ const defaultWxsExtensions = ["wxs"];
200
+ const defaultNodeModulesDirs = [
201
+ "**/node_modules/**",
202
+ "**/miniprogram_npm/**",
203
+ "**/project.config.json/**",
204
+ "**/project.private.config.json/**",
205
+ "**/package.json/**",
206
+ "postcss.config.js",
207
+ "tailwind.config.js"
208
+ ];
209
+ function createBuilder(options) {
210
+ const {
211
+ root: cwd,
212
+ weappTailwindcssOptions,
213
+ outDir,
214
+ src: srcBase,
215
+ clean,
216
+ extensions,
217
+ exclude,
218
+ include
219
+ } = defu(options, {
220
+ outDir: "dist",
221
+ weappTailwindcssOptions: {},
222
+ clean: true,
223
+ src: "",
224
+ exclude: [...defaultNodeModulesDirs],
225
+ extensions: {
226
+ javascript: [...defaultJavascriptExtensions, ...defaultTypescriptExtensions, ...defaultWxsExtensions],
227
+ html: ["wxml"],
228
+ css: ["wxss", "less", "sass", "scss"],
229
+ json: ["json"]
230
+ }
231
+ });
232
+ const { copyOthers, getCssTasks, getHtmlTasks, getJsTasks, getJsonTasks, globsSet } = getTasks({
233
+ root: cwd,
234
+ weappTailwindcssOptions,
235
+ outDir,
236
+ src: srcBase,
237
+ clean,
238
+ extensions,
239
+ exclude,
240
+ include
241
+ });
194
242
  const tasks = [...getJsTasks(), ...getJsonTasks(), ...getCssTasks(), ...getHtmlTasks(), copyOthers];
195
- for (const task of tasks) {
196
- const s = task();
197
- if (s) {
198
- await new Promise((resolve, reject) => s.on("finish", resolve).on("error", reject));
243
+ return {
244
+ async build() {
245
+ if (clean) {
246
+ const { deleteAsync } = await import('del');
247
+ const patterns = [outDir + "/**"];
248
+ await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
249
+ }
250
+ await fs.ensureDir(path__default.resolve(cwd, outDir));
251
+ for (const task of tasks) {
252
+ const s = task();
253
+ if (s) {
254
+ await new Promise((resolve, reject) => s.on("finish", resolve).on("error", reject));
255
+ }
256
+ }
257
+ return this;
258
+ },
259
+ async watch() {
260
+ await fs.ensureDir(path__default.resolve(cwd, outDir));
261
+ return this;
262
+ },
263
+ globsSet
264
+ };
265
+ }
266
+ function build(options) {
267
+ const builder = createBuilder(options);
268
+ return builder.build();
269
+ }
270
+
271
+ function getDefaultExportFromCjs (x) {
272
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
273
+ }
274
+
275
+ /*!
276
+ * is-primitive <https://github.com/jonschlinkert/is-primitive>
277
+ *
278
+ * Copyright (c) 2014-present, Jon Schlinkert.
279
+ * Released under the MIT License.
280
+ */
281
+
282
+ var isPrimitive$1 = function isPrimitive(val) {
283
+ if (typeof val === 'object') {
284
+ return val === null;
285
+ }
286
+ return typeof val !== 'function';
287
+ };
288
+
289
+ /*!
290
+ * isobject <https://github.com/jonschlinkert/isobject>
291
+ *
292
+ * Copyright (c) 2014-2017, Jon Schlinkert.
293
+ * Released under the MIT License.
294
+ */
295
+
296
+ var isobject = function isObject(val) {
297
+ return val != null && typeof val === 'object' && Array.isArray(val) === false;
298
+ };
299
+
300
+ /*!
301
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
302
+ *
303
+ * Copyright (c) 2014-2017, Jon Schlinkert.
304
+ * Released under the MIT License.
305
+ */
306
+
307
+ var isObject$2 = isobject;
308
+
309
+ function isObjectObject(o) {
310
+ return isObject$2(o) === true
311
+ && Object.prototype.toString.call(o) === '[object Object]';
312
+ }
313
+
314
+ var isPlainObject$1 = function isPlainObject(o) {
315
+ var ctor,prot;
316
+
317
+ if (isObjectObject(o) === false) return false;
318
+
319
+ // If has modified constructor
320
+ ctor = o.constructor;
321
+ if (typeof ctor !== 'function') return false;
322
+
323
+ // If has modified prototype
324
+ prot = ctor.prototype;
325
+ if (isObjectObject(prot) === false) return false;
326
+
327
+ // If constructor does not have an Object-specific method
328
+ if (prot.hasOwnProperty('isPrototypeOf') === false) {
329
+ return false;
330
+ }
331
+
332
+ // Most likely a plain Object
333
+ return true;
334
+ };
335
+
336
+ /*!
337
+ * set-value <https://github.com/jonschlinkert/set-value>
338
+ *
339
+ * Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
340
+ * Released under the MIT License.
341
+ */
342
+
343
+ const { deleteProperty } = Reflect;
344
+ const isPrimitive = isPrimitive$1;
345
+ const isPlainObject = isPlainObject$1;
346
+
347
+ const isObject$1 = value => {
348
+ return (typeof value === 'object' && value !== null) || typeof value === 'function';
349
+ };
350
+
351
+ const isUnsafeKey = key => {
352
+ return key === '__proto__' || key === 'constructor' || key === 'prototype';
353
+ };
354
+
355
+ const validateKey = key => {
356
+ if (!isPrimitive(key)) {
357
+ throw new TypeError('Object keys must be strings or symbols');
358
+ }
359
+
360
+ if (isUnsafeKey(key)) {
361
+ throw new Error(`Cannot set unsafe key: "${key}"`);
362
+ }
363
+ };
364
+
365
+ const toStringKey = input => {
366
+ return Array.isArray(input) ? input.flat().map(String).join(',') : input;
367
+ };
368
+
369
+ const createMemoKey = (input, options) => {
370
+ if (typeof input !== 'string' || !options) return input;
371
+ let key = input + ';';
372
+ if (options.arrays !== undefined) key += `arrays=${options.arrays};`;
373
+ if (options.separator !== undefined) key += `separator=${options.separator};`;
374
+ if (options.split !== undefined) key += `split=${options.split};`;
375
+ if (options.merge !== undefined) key += `merge=${options.merge};`;
376
+ if (options.preservePaths !== undefined) key += `preservePaths=${options.preservePaths};`;
377
+ return key;
378
+ };
379
+
380
+ const memoize = (input, options, fn) => {
381
+ const key = toStringKey(options ? createMemoKey(input, options) : input);
382
+ validateKey(key);
383
+
384
+ const value = setValue.cache.get(key) || fn();
385
+ setValue.cache.set(key, value);
386
+ return value;
387
+ };
388
+
389
+ const splitString = (input, options = {}) => {
390
+ const sep = options.separator || '.';
391
+ const preserve = sep === '/' ? false : options.preservePaths;
392
+
393
+ if (typeof input === 'string' && preserve !== false && /\//.test(input)) {
394
+ return [input];
395
+ }
396
+
397
+ const parts = [];
398
+ let part = '';
399
+
400
+ const push = part => {
401
+ let number;
402
+ if (part.trim() !== '' && Number.isInteger((number = Number(part)))) {
403
+ parts.push(number);
404
+ } else {
405
+ parts.push(part);
406
+ }
407
+ };
408
+
409
+ for (let i = 0; i < input.length; i++) {
410
+ const value = input[i];
411
+
412
+ if (value === '\\') {
413
+ part += input[++i];
414
+ continue;
415
+ }
416
+
417
+ if (value === sep) {
418
+ push(part);
419
+ part = '';
420
+ continue;
421
+ }
422
+
423
+ part += value;
424
+ }
425
+
426
+ if (part) {
427
+ push(part);
428
+ }
429
+
430
+ return parts;
431
+ };
432
+
433
+ const split$1 = (input, options) => {
434
+ if (options && typeof options.split === 'function') return options.split(input);
435
+ if (typeof input === 'symbol') return [input];
436
+ if (Array.isArray(input)) return input;
437
+ return memoize(input, options, () => splitString(input, options));
438
+ };
439
+
440
+ const assignProp = (obj, prop, value, options) => {
441
+ validateKey(prop);
442
+
443
+ // Delete property when "value" is undefined
444
+ if (value === undefined) {
445
+ deleteProperty(obj, prop);
446
+
447
+ } else if (options && options.merge) {
448
+ const merge = options.merge === 'function' ? options.merge : Object.assign;
449
+
450
+ // Only merge plain objects
451
+ if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
452
+ obj[prop] = merge(obj[prop], value);
453
+ } else {
454
+ obj[prop] = value;
199
455
  }
456
+
457
+ } else {
458
+ obj[prop] = value;
200
459
  }
460
+
461
+ return obj;
462
+ };
463
+
464
+ const setValue = (target, path, value, options) => {
465
+ if (!path || !isObject$1(target)) return target;
466
+
467
+ const keys = split$1(path, options);
468
+ let obj = target;
469
+
470
+ for (let i = 0; i < keys.length; i++) {
471
+ const key = keys[i];
472
+ const next = keys[i + 1];
473
+
474
+ validateKey(key);
475
+
476
+ if (next === undefined) {
477
+ assignProp(obj, key, value, options);
478
+ break;
479
+ }
480
+
481
+ if (typeof next === 'number' && !Array.isArray(obj[key])) {
482
+ obj = obj[key] = [];
483
+ continue;
484
+ }
485
+
486
+ if (!isObject$1(obj[key])) {
487
+ obj[key] = {};
488
+ }
489
+
490
+ obj = obj[key];
491
+ }
492
+
493
+ return target;
494
+ };
495
+
496
+ setValue.split = split$1;
497
+ setValue.cache = new Map();
498
+ setValue.clear = () => {
499
+ setValue.cache = new Map();
500
+ };
501
+
502
+ var setValue_1 = setValue;
503
+
504
+ const set = /*@__PURE__*/getDefaultExportFromCjs(setValue_1);
505
+
506
+ /*!
507
+ * get-value <https://github.com/jonschlinkert/get-value>
508
+ *
509
+ * Copyright (c) 2014-2018, Jon Schlinkert.
510
+ * Released under the MIT License.
511
+ */
512
+
513
+ const isObject = isobject;
514
+
515
+ var getValue = function(target, path, options) {
516
+ if (!isObject(options)) {
517
+ options = { default: options };
518
+ }
519
+
520
+ if (!isValidObject(target)) {
521
+ return typeof options.default !== 'undefined' ? options.default : target;
522
+ }
523
+
524
+ if (typeof path === 'number') {
525
+ path = String(path);
526
+ }
527
+
528
+ const isArray = Array.isArray(path);
529
+ const isString = typeof path === 'string';
530
+ const splitChar = options.separator || '.';
531
+ const joinChar = options.joinChar || (typeof splitChar === 'string' ? splitChar : '.');
532
+
533
+ if (!isString && !isArray) {
534
+ return target;
535
+ }
536
+
537
+ if (isString && path in target) {
538
+ return isValid(path, target, options) ? target[path] : options.default;
539
+ }
540
+
541
+ let segs = isArray ? path : split(path, splitChar, options);
542
+ let len = segs.length;
543
+ let idx = 0;
544
+
545
+ do {
546
+ let prop = segs[idx];
547
+ if (typeof prop === 'number') {
548
+ prop = String(prop);
549
+ }
550
+
551
+ while (prop && prop.slice(-1) === '\\') {
552
+ prop = join([prop.slice(0, -1), segs[++idx] || ''], joinChar, options);
553
+ }
554
+
555
+ if (prop in target) {
556
+ if (!isValid(prop, target, options)) {
557
+ return options.default;
558
+ }
559
+
560
+ target = target[prop];
561
+ } else {
562
+ let hasProp = false;
563
+ let n = idx + 1;
564
+
565
+ while (n < len) {
566
+ prop = join([prop, segs[n++]], joinChar, options);
567
+
568
+ if ((hasProp = prop in target)) {
569
+ if (!isValid(prop, target, options)) {
570
+ return options.default;
571
+ }
572
+
573
+ target = target[prop];
574
+ idx = n - 1;
575
+ break;
576
+ }
577
+ }
578
+
579
+ if (!hasProp) {
580
+ return options.default;
581
+ }
582
+ }
583
+ } while (++idx < len && isValidObject(target));
584
+
585
+ if (idx === len) {
586
+ return target;
587
+ }
588
+
589
+ return options.default;
590
+ };
591
+
592
+ function join(segs, joinChar, options) {
593
+ if (typeof options.join === 'function') {
594
+ return options.join(segs);
595
+ }
596
+ return segs[0] + joinChar + segs[1];
597
+ }
598
+
599
+ function split(path, splitChar, options) {
600
+ if (typeof options.split === 'function') {
601
+ return options.split(path);
602
+ }
603
+ return path.split(splitChar);
604
+ }
605
+
606
+ function isValid(key, target, options) {
607
+ if (typeof options.isValid === 'function') {
608
+ return options.isValid(key, target);
609
+ }
610
+ return true;
201
611
  }
202
612
 
613
+ function isValidObject(val) {
614
+ return isObject(val) || Array.isArray(val) || typeof val === 'function';
615
+ }
616
+
617
+ const get = /*@__PURE__*/getDefaultExportFromCjs(getValue);
618
+
203
619
  function createConfigLoader(root) {
204
620
  const explorer = cosmiconfig.cosmiconfigSync("weapp-tw");
205
621
  function search(searchFrom = root) {
@@ -234,10 +650,10 @@ function updateProjectConfig(options) {
234
650
  if (fs__default.existsSync(projectConfigPath)) {
235
651
  try {
236
652
  const projectConfig = fs__default.readJSONSync(projectConfigPath);
237
- projectConfig.miniprogramRoot = "dist/";
238
- projectConfig.srcMiniprogramRoot = "dist/";
239
- projectConfig.setting.packNpmManually = true;
240
- if (Array.isArray(projectConfig.setting.packNpmRelationList)) {
653
+ set(projectConfig, "miniprogramRoot", "dist/");
654
+ set(projectConfig, "srcMiniprogramRoot", "dist/");
655
+ set(projectConfig, "setting.packNpmManually", true);
656
+ if (Array.isArray(get(projectConfig, "setting.packNpmRelationList"))) {
241
657
  const x = projectConfig.setting.packNpmRelationList.find((x2) => x2.packageJsonPath === "./package.json" && x2.miniprogramNpmDistDir === "./dist");
242
658
  if (!x) {
243
659
  projectConfig.setting.packNpmRelationList.push({
@@ -246,12 +662,12 @@ function updateProjectConfig(options) {
246
662
  });
247
663
  }
248
664
  } else {
249
- projectConfig.setting.packNpmRelationList = [
665
+ set(projectConfig, "setting.packNpmRelationList", [
250
666
  {
251
667
  packageJsonPath: "./package.json",
252
668
  miniprogramNpmDistDir: "./dist"
253
669
  }
254
- ];
670
+ ]);
255
671
  }
256
672
  fs__default.outputJSONSync(dest ?? projectConfigPath, projectConfig, {
257
673
  spaces: 2
@@ -264,6 +680,22 @@ function updateProjectConfig(options) {
264
680
  console.warn(`\u2728 \u6CA1\u6709\u627E\u5230 ${projectConfigFilename} \u6587\u4EF6!`);
265
681
  }
266
682
  }
683
+ function updatePackageJson(options) {
684
+ const { root, dest } = options;
685
+ const packageJsonFilename = "package.json";
686
+ const packageJsonPath = path__default.resolve(root, packageJsonFilename);
687
+ if (fs__default.existsSync(packageJsonPath)) {
688
+ try {
689
+ const packageJson = fs__default.readJSONSync(packageJsonPath);
690
+ set(packageJson, "scripts.dev", "weapp-tw dev");
691
+ set(packageJson, "scripts.build", "weapp-tw build");
692
+ fs__default.outputJSONSync(dest ?? packageJsonPath, packageJson, {
693
+ spaces: 2
694
+ });
695
+ } catch {
696
+ }
697
+ }
698
+ }
267
699
  function initConfig(options) {
268
700
  const { lang, root } = defu(options, { lang: "js", root: process.cwd() });
269
701
  const configFilename = `weapp-tw.config.${lang ?? "js"}`;
@@ -289,6 +721,7 @@ module.exports = {}
289
721
  }
290
722
  console.log(`\u2728 ${configFilename} \u914D\u7F6E\u6587\u4EF6\uFF0C\u521D\u59CB\u5316\u6210\u529F!`);
291
723
  updateProjectConfig({ root });
724
+ updatePackageJson({ root });
292
725
  return configPath;
293
726
  }
294
727
 
@@ -320,10 +753,8 @@ function createCli() {
320
753
  return program;
321
754
  }
322
755
 
323
- function createWatcher(options) {
324
- }
325
-
756
+ exports.build = build;
757
+ exports.createBuilder = createBuilder;
326
758
  exports.createCli = createCli;
327
759
  exports.createConfigLoader = createConfigLoader;
328
- exports.createWatcher = createWatcher;
329
760
  exports.defineConfig = defineConfig;