weapp-vite 1.8.0 → 1.8.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.
@@ -95,7 +95,7 @@ var logger_default = logger;
95
95
  init_esm_shims();
96
96
 
97
97
  // package.json
98
- var version = "1.8.0";
98
+ var version = "1.8.1";
99
99
 
100
100
  // src/constants.ts
101
101
  var VERSION = version;
@@ -840,58 +840,60 @@ function vitePluginWeapp(ctx, subPackageMeta) {
840
840
  });
841
841
  }
842
842
  }
843
- for (const { filePath, fileName, isHtml } of wxmlFiles) {
844
- const source = await fs4.readFile(filePath, "utf8");
845
- let _source;
846
- if (weapp?.enhance?.wxml) {
847
- const { code, deps } = processWxml(source);
848
- _source = code;
849
- for (const wxsDep of deps.filter((x) => x.tagName === "wxs")) {
850
- if (jsExtensions.includes(wxsDep.attrs.lang) || /\.wxs\.[jt]s$/.test(wxsDep.value)) {
851
- const wxsPath = path4.resolve(path4.dirname(filePath), wxsDep.value);
852
- if (await fs4.exists(wxsPath)) {
853
- cachedWatchFiles.push(wxsPath);
854
- const code2 = await fs4.readFile(wxsPath, "utf8");
855
- const res = transformWxsCode(code2, {
856
- filename: wxsPath
857
- });
858
- if (res && res.code) {
859
- cachedEmittedFiles.push(
860
- {
861
- type: "asset",
862
- fileName: ctx.relativeSrcRoot(relative(removeExtension(wxsPath))),
863
- source: res.code
864
- }
865
- );
843
+ await Promise.all([
844
+ ...wxmlFiles.map(async ({ filePath, fileName, isHtml }) => {
845
+ const source = await fs4.readFile(filePath, "utf8");
846
+ let _source;
847
+ if (weapp?.enhance?.wxml) {
848
+ const { code, deps } = processWxml(source);
849
+ _source = code;
850
+ for (const wxsDep of deps.filter((x) => x.tagName === "wxs")) {
851
+ if (jsExtensions.includes(wxsDep.attrs.lang) || /\.wxs\.[jt]s$/.test(wxsDep.value)) {
852
+ const wxsPath = path4.resolve(path4.dirname(filePath), wxsDep.value);
853
+ if (await fs4.exists(wxsPath)) {
854
+ cachedWatchFiles.push(wxsPath);
855
+ const code2 = await fs4.readFile(wxsPath, "utf8");
856
+ const res = transformWxsCode(code2, {
857
+ filename: wxsPath
858
+ });
859
+ if (res && res.code) {
860
+ cachedEmittedFiles.push(
861
+ {
862
+ type: "asset",
863
+ fileName: ctx.relativeSrcRoot(relative(removeExtension(wxsPath))),
864
+ source: res.code
865
+ }
866
+ );
867
+ }
866
868
  }
867
869
  }
868
870
  }
871
+ } else {
872
+ _source = source;
869
873
  }
870
- } else {
871
- _source = source;
872
- }
873
- cachedEmittedFiles.push({
874
- type: "asset",
875
- fileName: isHtml ? changeFileExtension(fileName, ctx.outputExtensions.wxml) : fileName,
876
- source: _source
877
- });
878
- }
879
- for (const { fileName, filePath } of wxsFiles) {
880
- const source = await fs4.readFile(filePath);
881
- cachedEmittedFiles.push({
882
- type: "asset",
883
- fileName,
884
- source
885
- });
886
- }
887
- for (const { fileName, filePath } of mediaFiles) {
888
- const source = await fs4.readFile(filePath);
889
- cachedEmittedFiles.push({
890
- type: "asset",
891
- fileName,
892
- source
893
- });
894
- }
874
+ cachedEmittedFiles.push({
875
+ type: "asset",
876
+ fileName: isHtml ? changeFileExtension(fileName, ctx.outputExtensions.wxml) : fileName,
877
+ source: _source
878
+ });
879
+ }),
880
+ ...wxsFiles.map(async ({ fileName, filePath }) => {
881
+ const source = await fs4.readFile(filePath);
882
+ cachedEmittedFiles.push({
883
+ type: "asset",
884
+ fileName,
885
+ source
886
+ });
887
+ }),
888
+ ...mediaFiles.map(async ({ fileName, filePath }) => {
889
+ const source = await fs4.readFile(filePath);
890
+ cachedEmittedFiles.push({
891
+ type: "asset",
892
+ fileName,
893
+ source
894
+ });
895
+ })
896
+ ]);
895
897
  debug?.(ctx.potentialComponentEntries);
896
898
  if (subPackageMeta) {
897
899
  entriesSet = subPackageMeta.entriesSet;
@@ -1421,7 +1423,8 @@ var CompilerContext = class {
1421
1423
  },
1422
1424
  sourcemap: false,
1423
1425
  config: false,
1424
- define: {
1426
+ // https://tsup.egoist.dev/#compile-time-environment-variables
1427
+ env: {
1425
1428
  NODE_ENV: "production"
1426
1429
  }
1427
1430
  // external: [],
package/dist/cli.cjs CHANGED
@@ -130,7 +130,7 @@ var import_weapp_ide_cli = require("weapp-ide-cli");
130
130
  init_cjs_shims();
131
131
 
132
132
  // package.json
133
- var version = "1.8.0";
133
+ var version = "1.8.1";
134
134
 
135
135
  // src/constants.ts
136
136
  var VERSION = version;
@@ -880,58 +880,60 @@ function vitePluginWeapp(ctx, subPackageMeta) {
880
880
  });
881
881
  }
882
882
  }
883
- for (const { filePath, fileName, isHtml } of wxmlFiles) {
884
- const source = await import_fs_extra4.default.readFile(filePath, "utf8");
885
- let _source;
886
- if (weapp?.enhance?.wxml) {
887
- const { code, deps } = processWxml(source);
888
- _source = code;
889
- for (const wxsDep of deps.filter((x) => x.tagName === "wxs")) {
890
- if (jsExtensions.includes(wxsDep.attrs.lang) || /\.wxs\.[jt]s$/.test(wxsDep.value)) {
891
- const wxsPath = import_pathe4.default.resolve(import_pathe4.default.dirname(filePath), wxsDep.value);
892
- if (await import_fs_extra4.default.exists(wxsPath)) {
893
- cachedWatchFiles.push(wxsPath);
894
- const code2 = await import_fs_extra4.default.readFile(wxsPath, "utf8");
895
- const res = transformWxsCode(code2, {
896
- filename: wxsPath
897
- });
898
- if (res && res.code) {
899
- cachedEmittedFiles.push(
900
- {
901
- type: "asset",
902
- fileName: ctx.relativeSrcRoot(relative((0, import_shared5.removeExtension)(wxsPath))),
903
- source: res.code
904
- }
905
- );
883
+ await Promise.all([
884
+ ...wxmlFiles.map(async ({ filePath, fileName, isHtml }) => {
885
+ const source = await import_fs_extra4.default.readFile(filePath, "utf8");
886
+ let _source;
887
+ if (weapp?.enhance?.wxml) {
888
+ const { code, deps } = processWxml(source);
889
+ _source = code;
890
+ for (const wxsDep of deps.filter((x) => x.tagName === "wxs")) {
891
+ if (jsExtensions.includes(wxsDep.attrs.lang) || /\.wxs\.[jt]s$/.test(wxsDep.value)) {
892
+ const wxsPath = import_pathe4.default.resolve(import_pathe4.default.dirname(filePath), wxsDep.value);
893
+ if (await import_fs_extra4.default.exists(wxsPath)) {
894
+ cachedWatchFiles.push(wxsPath);
895
+ const code2 = await import_fs_extra4.default.readFile(wxsPath, "utf8");
896
+ const res = transformWxsCode(code2, {
897
+ filename: wxsPath
898
+ });
899
+ if (res && res.code) {
900
+ cachedEmittedFiles.push(
901
+ {
902
+ type: "asset",
903
+ fileName: ctx.relativeSrcRoot(relative((0, import_shared5.removeExtension)(wxsPath))),
904
+ source: res.code
905
+ }
906
+ );
907
+ }
906
908
  }
907
909
  }
908
910
  }
911
+ } else {
912
+ _source = source;
909
913
  }
910
- } else {
911
- _source = source;
912
- }
913
- cachedEmittedFiles.push({
914
- type: "asset",
915
- fileName: isHtml ? changeFileExtension(fileName, ctx.outputExtensions.wxml) : fileName,
916
- source: _source
917
- });
918
- }
919
- for (const { fileName, filePath } of wxsFiles) {
920
- const source = await import_fs_extra4.default.readFile(filePath);
921
- cachedEmittedFiles.push({
922
- type: "asset",
923
- fileName,
924
- source
925
- });
926
- }
927
- for (const { fileName, filePath } of mediaFiles) {
928
- const source = await import_fs_extra4.default.readFile(filePath);
929
- cachedEmittedFiles.push({
930
- type: "asset",
931
- fileName,
932
- source
933
- });
934
- }
914
+ cachedEmittedFiles.push({
915
+ type: "asset",
916
+ fileName: isHtml ? changeFileExtension(fileName, ctx.outputExtensions.wxml) : fileName,
917
+ source: _source
918
+ });
919
+ }),
920
+ ...wxsFiles.map(async ({ fileName, filePath }) => {
921
+ const source = await import_fs_extra4.default.readFile(filePath);
922
+ cachedEmittedFiles.push({
923
+ type: "asset",
924
+ fileName,
925
+ source
926
+ });
927
+ }),
928
+ ...mediaFiles.map(async ({ fileName, filePath }) => {
929
+ const source = await import_fs_extra4.default.readFile(filePath);
930
+ cachedEmittedFiles.push({
931
+ type: "asset",
932
+ fileName,
933
+ source
934
+ });
935
+ })
936
+ ]);
935
937
  debug?.(ctx.potentialComponentEntries);
936
938
  if (subPackageMeta) {
937
939
  entriesSet = subPackageMeta.entriesSet;
@@ -1464,7 +1466,8 @@ var CompilerContext = class {
1464
1466
  },
1465
1467
  sourcemap: false,
1466
1468
  config: false,
1467
- define: {
1469
+ // https://tsup.egoist.dev/#compile-time-environment-variables
1470
+ env: {
1468
1471
  NODE_ENV: "production"
1469
1472
  }
1470
1473
  // external: [],
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  VERSION,
3
3
  createCompilerContext,
4
4
  logger_default
5
- } from "./chunk-JKTPETKK.mjs";
5
+ } from "./chunk-LYCBVJHR.mjs";
6
6
  import "./chunk-67O7U5RB.mjs";
7
7
  import {
8
8
  init_esm_shims
package/dist/index.cjs CHANGED
@@ -879,58 +879,60 @@ function vitePluginWeapp(ctx, subPackageMeta) {
879
879
  });
880
880
  }
881
881
  }
882
- for (const { filePath, fileName, isHtml } of wxmlFiles) {
883
- const source = await import_fs_extra4.default.readFile(filePath, "utf8");
884
- let _source;
885
- if (weapp?.enhance?.wxml) {
886
- const { code, deps } = processWxml(source);
887
- _source = code;
888
- for (const wxsDep of deps.filter((x) => x.tagName === "wxs")) {
889
- if (jsExtensions.includes(wxsDep.attrs.lang) || /\.wxs\.[jt]s$/.test(wxsDep.value)) {
890
- const wxsPath = import_pathe4.default.resolve(import_pathe4.default.dirname(filePath), wxsDep.value);
891
- if (await import_fs_extra4.default.exists(wxsPath)) {
892
- cachedWatchFiles.push(wxsPath);
893
- const code2 = await import_fs_extra4.default.readFile(wxsPath, "utf8");
894
- const res = transformWxsCode(code2, {
895
- filename: wxsPath
896
- });
897
- if (res && res.code) {
898
- cachedEmittedFiles.push(
899
- {
900
- type: "asset",
901
- fileName: ctx.relativeSrcRoot(relative((0, import_shared5.removeExtension)(wxsPath))),
902
- source: res.code
903
- }
904
- );
882
+ await Promise.all([
883
+ ...wxmlFiles.map(async ({ filePath, fileName, isHtml }) => {
884
+ const source = await import_fs_extra4.default.readFile(filePath, "utf8");
885
+ let _source;
886
+ if (weapp?.enhance?.wxml) {
887
+ const { code, deps } = processWxml(source);
888
+ _source = code;
889
+ for (const wxsDep of deps.filter((x) => x.tagName === "wxs")) {
890
+ if (jsExtensions.includes(wxsDep.attrs.lang) || /\.wxs\.[jt]s$/.test(wxsDep.value)) {
891
+ const wxsPath = import_pathe4.default.resolve(import_pathe4.default.dirname(filePath), wxsDep.value);
892
+ if (await import_fs_extra4.default.exists(wxsPath)) {
893
+ cachedWatchFiles.push(wxsPath);
894
+ const code2 = await import_fs_extra4.default.readFile(wxsPath, "utf8");
895
+ const res = transformWxsCode(code2, {
896
+ filename: wxsPath
897
+ });
898
+ if (res && res.code) {
899
+ cachedEmittedFiles.push(
900
+ {
901
+ type: "asset",
902
+ fileName: ctx.relativeSrcRoot(relative((0, import_shared5.removeExtension)(wxsPath))),
903
+ source: res.code
904
+ }
905
+ );
906
+ }
905
907
  }
906
908
  }
907
909
  }
910
+ } else {
911
+ _source = source;
908
912
  }
909
- } else {
910
- _source = source;
911
- }
912
- cachedEmittedFiles.push({
913
- type: "asset",
914
- fileName: isHtml ? changeFileExtension(fileName, ctx.outputExtensions.wxml) : fileName,
915
- source: _source
916
- });
917
- }
918
- for (const { fileName, filePath } of wxsFiles) {
919
- const source = await import_fs_extra4.default.readFile(filePath);
920
- cachedEmittedFiles.push({
921
- type: "asset",
922
- fileName,
923
- source
924
- });
925
- }
926
- for (const { fileName, filePath } of mediaFiles) {
927
- const source = await import_fs_extra4.default.readFile(filePath);
928
- cachedEmittedFiles.push({
929
- type: "asset",
930
- fileName,
931
- source
932
- });
933
- }
913
+ cachedEmittedFiles.push({
914
+ type: "asset",
915
+ fileName: isHtml ? changeFileExtension(fileName, ctx.outputExtensions.wxml) : fileName,
916
+ source: _source
917
+ });
918
+ }),
919
+ ...wxsFiles.map(async ({ fileName, filePath }) => {
920
+ const source = await import_fs_extra4.default.readFile(filePath);
921
+ cachedEmittedFiles.push({
922
+ type: "asset",
923
+ fileName,
924
+ source
925
+ });
926
+ }),
927
+ ...mediaFiles.map(async ({ fileName, filePath }) => {
928
+ const source = await import_fs_extra4.default.readFile(filePath);
929
+ cachedEmittedFiles.push({
930
+ type: "asset",
931
+ fileName,
932
+ source
933
+ });
934
+ })
935
+ ]);
934
936
  debug?.(ctx.potentialComponentEntries);
935
937
  if (subPackageMeta) {
936
938
  entriesSet = subPackageMeta.entriesSet;
@@ -1463,7 +1465,8 @@ var CompilerContext = class {
1463
1465
  },
1464
1466
  sourcemap: false,
1465
1467
  config: false,
1466
- define: {
1468
+ // https://tsup.egoist.dev/#compile-time-environment-variables
1469
+ env: {
1467
1470
  NODE_ENV: "production"
1468
1471
  }
1469
1472
  // external: [],
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CompilerContext,
3
3
  createCompilerContext
4
- } from "./chunk-JKTPETKK.mjs";
4
+ } from "./chunk-LYCBVJHR.mjs";
5
5
  import "./chunk-67O7U5RB.mjs";
6
6
  import {
7
7
  init_esm_shims
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",