weapp-tailwindcss 4.4.0 → 4.5.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.
Files changed (46) hide show
  1. package/dist/chunk-34T2BFTJ.mjs +59 -0
  2. package/dist/{chunk-VN2BU7ON.js → chunk-4NWVZ7I2.js} +160 -59
  3. package/dist/{chunk-D2AKCBDU.mjs → chunk-DKUPUV4T.mjs} +75 -2
  4. package/dist/{chunk-FBGUUXQV.mjs → chunk-FWIGQ4RY.mjs} +1 -1
  5. package/dist/{chunk-QXCC745G.js → chunk-IO3RB6AQ.js} +99 -28
  6. package/dist/chunk-MRKRCDIE.js +195 -0
  7. package/dist/{chunk-RBRSMHFS.js → chunk-NHB7NFQC.js} +1 -1
  8. package/dist/{chunk-L3HOZDIV.mjs → chunk-OHUQYFGP.mjs} +98 -27
  9. package/dist/{chunk-NDHL3P32.mjs → chunk-RQGIJKLG.mjs} +156 -55
  10. package/dist/chunk-WVKK6TBL.js +59 -0
  11. package/dist/{chunk-GQAB52GE.js → chunk-XYYHPJOQ.js} +384 -14
  12. package/dist/{chunk-D25XJJMP.mjs → chunk-Z7Q5UFNU.mjs} +381 -11
  13. package/dist/cli.js +3 -3
  14. package/dist/cli.mjs +2 -2
  15. package/dist/core.js +3 -3
  16. package/dist/core.mjs +2 -2
  17. package/dist/css-macro/postcss.js +1 -1
  18. package/dist/css-macro/postcss.mjs +1 -1
  19. package/dist/css-macro.js +1 -1
  20. package/dist/css-macro.mjs +1 -1
  21. package/dist/defaults.js +1 -1
  22. package/dist/defaults.mjs +1 -1
  23. package/dist/escape.js +1 -1
  24. package/dist/escape.mjs +1 -1
  25. package/dist/gulp.js +4 -4
  26. package/dist/gulp.mjs +3 -3
  27. package/dist/index.d.mts +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +7 -6
  30. package/dist/index.mjs +6 -5
  31. package/dist/postcss-html-transform.js +1 -1
  32. package/dist/postcss-html-transform.mjs +1 -1
  33. package/dist/presets.js +1 -1
  34. package/dist/presets.mjs +1 -1
  35. package/dist/types.d.mts +48 -2
  36. package/dist/types.d.ts +48 -2
  37. package/dist/types.js +1 -1
  38. package/dist/types.mjs +1 -1
  39. package/dist/vite.js +5 -4
  40. package/dist/vite.mjs +4 -3
  41. package/dist/webpack.js +5 -4
  42. package/dist/webpack.mjs +4 -3
  43. package/dist/webpack4.js +99 -29
  44. package/dist/webpack4.mjs +97 -27
  45. package/package.json +5 -5
  46. package/dist/chunk-H2Y5VNOJ.js +0 -122
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createPlugins } from './gulp.js';
2
- export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, UserDefinedOptions } from './types.js';
2
+ export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions } from './types.js';
3
3
  export { UnifiedViteWeappTailwindcssPlugin } from './vite.js';
4
4
  export { UnifiedWebpackPluginV5 } from './webpack.js';
5
5
  export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
package/dist/index.js CHANGED
@@ -1,23 +1,24 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-O2IOQ3BD.js');
2
2
 
3
3
 
4
- var _chunkQXCC745Gjs = require('./chunk-QXCC745G.js');
4
+ var _chunkIO3RB6AQjs = require('./chunk-IO3RB6AQ.js');
5
5
  require('./chunk-6GP37C26.js');
6
6
 
7
7
 
8
- var _chunkH2Y5VNOJjs = require('./chunk-H2Y5VNOJ.js');
8
+ var _chunkMRKRCDIEjs = require('./chunk-MRKRCDIE.js');
9
9
 
10
10
 
11
- var _chunkVN2BU7ONjs = require('./chunk-VN2BU7ON.js');
11
+ var _chunk4NWVZ7I2js = require('./chunk-4NWVZ7I2.js');
12
+ require('./chunk-WVKK6TBL.js');
12
13
  require('./chunk-2NRTWL47.js');
13
14
  require('./chunk-OGROHM4L.js');
14
- require('./chunk-GQAB52GE.js');
15
+ require('./chunk-XYYHPJOQ.js');
15
16
  require('./chunk-PLMJW644.js');
16
17
  require('./chunk-FOSGDQZ7.js');
17
18
  require('./chunk-UW3WHSZ5.js');
18
- require('./chunk-RBRSMHFS.js');
19
+ require('./chunk-NHB7NFQC.js');
19
20
 
20
21
 
21
22
 
22
23
 
23
- exports.UnifiedViteWeappTailwindcssPlugin = _chunkVN2BU7ONjs.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkQXCC745Gjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkH2Y5VNOJjs.createPlugins;
24
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunk4NWVZ7I2js.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkIO3RB6AQjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkMRKRCDIEjs.createPlugins;
package/dist/index.mjs CHANGED
@@ -1,21 +1,22 @@
1
1
  import "./chunk-YAN7TO2B.mjs";
2
2
  import {
3
3
  UnifiedWebpackPluginV5
4
- } from "./chunk-L3HOZDIV.mjs";
4
+ } from "./chunk-OHUQYFGP.mjs";
5
5
  import "./chunk-2F7HOQQY.mjs";
6
6
  import {
7
7
  createPlugins
8
- } from "./chunk-D2AKCBDU.mjs";
8
+ } from "./chunk-DKUPUV4T.mjs";
9
9
  import {
10
10
  UnifiedViteWeappTailwindcssPlugin
11
- } from "./chunk-NDHL3P32.mjs";
11
+ } from "./chunk-RQGIJKLG.mjs";
12
+ import "./chunk-34T2BFTJ.mjs";
12
13
  import "./chunk-H4JTYYOI.mjs";
13
14
  import "./chunk-CMUA5KCO.mjs";
14
- import "./chunk-D25XJJMP.mjs";
15
+ import "./chunk-Z7Q5UFNU.mjs";
15
16
  import "./chunk-Q67IXIAH.mjs";
16
17
  import "./chunk-IHKVNALD.mjs";
17
18
  import "./chunk-ZNKIYZRQ.mjs";
18
- import "./chunk-FBGUUXQV.mjs";
19
+ import "./chunk-FWIGQ4RY.mjs";
19
20
  export {
20
21
  UnifiedViteWeappTailwindcssPlugin,
21
22
  UnifiedWebpackPluginV5,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('./chunk-RBRSMHFS.js');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('./chunk-NHB7NFQC.js');
2
2
 
3
3
  // src/postcss-html-transform.ts
4
4
  var _htmltransform = require('@weapp-tailwindcss/postcss/html-transform'); var _htmltransform2 = _interopRequireDefault(_htmltransform);
@@ -1,4 +1,4 @@
1
- import "./chunk-FBGUUXQV.mjs";
1
+ import "./chunk-FWIGQ4RY.mjs";
2
2
 
3
3
  // src/postcss-html-transform.ts
4
4
  import postcssHtmlTransform from "@weapp-tailwindcss/postcss/html-transform";
package/dist/presets.js CHANGED
@@ -4,7 +4,7 @@ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
4
4
 
5
5
 
6
6
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
7
- require('./chunk-RBRSMHFS.js');
7
+ require('./chunk-NHB7NFQC.js');
8
8
 
9
9
  // src/presets.ts
10
10
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
package/dist/presets.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  defuOverrideArray
6
6
  } from "./chunk-ZNKIYZRQ.mjs";
7
- import "./chunk-FBGUUXQV.mjs";
7
+ import "./chunk-FWIGQ4RY.mjs";
8
8
 
9
9
  // src/presets.ts
10
10
  import process from "process";
package/dist/types.d.mts CHANGED
@@ -547,13 +547,32 @@ interface InternalCssSelectorReplacerOptions {
547
547
  mangleContext?: IMangleScopeContext;
548
548
  escapeMap?: Record<string, string>;
549
549
  }
550
+ interface LinkedJsModuleResult {
551
+ code: string;
552
+ }
550
553
  interface JsHandlerResult {
551
554
  code: string;
552
555
  map?: SourceMap;
553
556
  error?: ParseError;
557
+ /**
558
+ * Additional modules transformed because of cross-file analysis.
559
+ * Keyed by absolute filename.
560
+ */
561
+ linked?: Record<string, LinkedJsModuleResult>;
554
562
  }
555
563
  type ICustomAttributes = Record<string, ItemOrItemArray<string | RegExp>> | Map<string | RegExp, ItemOrItemArray<string | RegExp>>;
556
564
  type ICustomAttributesEntities = [string | RegExp, ItemOrItemArray<string | RegExp>][];
565
+ interface TailwindcssPatcherLike {
566
+ packageInfo: TailwindcssPatcher['packageInfo'];
567
+ majorVersion?: number;
568
+ patch: TailwindcssPatcher['patch'];
569
+ getClassSet: TailwindcssPatcher['getClassSet'];
570
+ getClassSetV3: TailwindcssPatcher['getClassSetV3'];
571
+ extract: TailwindcssPatcher['extract'];
572
+ cacheOptions?: TailwindcssPatcher['cacheOptions'];
573
+ patchOptions?: TailwindcssPatcher['patchOptions'];
574
+ rawOptions?: TailwindcssPatcher['rawOptions'];
575
+ }
557
576
  interface IJsHandlerOptions {
558
577
  escapeMap?: Record<string, string>;
559
578
  classNameSet?: Set<string>;
@@ -568,6 +587,15 @@ interface IJsHandlerOptions {
568
587
  ignoreTaggedTemplateExpressionIdentifiers?: (string | RegExp)[];
569
588
  ignoreCallExpressionIdentifiers?: (string | RegExp)[];
570
589
  uniAppX?: boolean;
590
+ /**
591
+ * Absolute path of the module currently being transformed.
592
+ * Required when enabling cross-file analysis.
593
+ */
594
+ filename?: string;
595
+ /**
596
+ * Configure cross-file module graph analysis.
597
+ */
598
+ moduleGraph?: JsModuleGraphOptions;
571
599
  }
572
600
  interface IArbitraryValues {
573
601
  /**
@@ -613,7 +641,7 @@ type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supportCust
613
641
  customReplaceDictionary: Record<string, string>;
614
642
  setMangleRuntimeSet: (runtimeSet: Set<string>) => void;
615
643
  cache: ICreateCacheReturnType;
616
- twPatcher: TailwindcssPatcher;
644
+ twPatcher: TailwindcssPatcherLike;
617
645
  }>;
618
646
  type InternalPostcssOptions = Pick<UserDefinedOptions, 'cssMatcher' | 'mainCssChunkMatcher' | 'cssPreflight' | 'cssPreflightRange' | 'customRuleCallback' | 'disabled'>;
619
647
  interface IBaseWebpackPlugin {
@@ -630,5 +658,23 @@ interface InternalPatchResult {
630
658
  plugin?: string;
631
659
  }
632
660
  type CreateJsHandlerOptions = Omit<IJsHandlerOptions, 'classNameSet'>;
661
+ interface JsModuleGraphOptions {
662
+ /**
663
+ * Resolve an import specifier to an absolute file path.
664
+ */
665
+ resolve: (specifier: string, importer: string) => string | undefined;
666
+ /**
667
+ * Load module source synchronously.
668
+ */
669
+ load: (id: string) => string | undefined;
670
+ /**
671
+ * Optional filter to skip modules.
672
+ */
673
+ filter?: (id: string, specifier: string, importer: string) => boolean;
674
+ /**
675
+ * Maximum traversal depth. Defaults to `Infinity`.
676
+ */
677
+ maxDepth?: number;
678
+ }
633
679
 
634
- export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, UserDefinedOptions };
680
+ export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions };
package/dist/types.d.ts CHANGED
@@ -547,13 +547,32 @@ interface InternalCssSelectorReplacerOptions {
547
547
  mangleContext?: IMangleScopeContext;
548
548
  escapeMap?: Record<string, string>;
549
549
  }
550
+ interface LinkedJsModuleResult {
551
+ code: string;
552
+ }
550
553
  interface JsHandlerResult {
551
554
  code: string;
552
555
  map?: SourceMap;
553
556
  error?: ParseError;
557
+ /**
558
+ * Additional modules transformed because of cross-file analysis.
559
+ * Keyed by absolute filename.
560
+ */
561
+ linked?: Record<string, LinkedJsModuleResult>;
554
562
  }
555
563
  type ICustomAttributes = Record<string, ItemOrItemArray<string | RegExp>> | Map<string | RegExp, ItemOrItemArray<string | RegExp>>;
556
564
  type ICustomAttributesEntities = [string | RegExp, ItemOrItemArray<string | RegExp>][];
565
+ interface TailwindcssPatcherLike {
566
+ packageInfo: TailwindcssPatcher['packageInfo'];
567
+ majorVersion?: number;
568
+ patch: TailwindcssPatcher['patch'];
569
+ getClassSet: TailwindcssPatcher['getClassSet'];
570
+ getClassSetV3: TailwindcssPatcher['getClassSetV3'];
571
+ extract: TailwindcssPatcher['extract'];
572
+ cacheOptions?: TailwindcssPatcher['cacheOptions'];
573
+ patchOptions?: TailwindcssPatcher['patchOptions'];
574
+ rawOptions?: TailwindcssPatcher['rawOptions'];
575
+ }
557
576
  interface IJsHandlerOptions {
558
577
  escapeMap?: Record<string, string>;
559
578
  classNameSet?: Set<string>;
@@ -568,6 +587,15 @@ interface IJsHandlerOptions {
568
587
  ignoreTaggedTemplateExpressionIdentifiers?: (string | RegExp)[];
569
588
  ignoreCallExpressionIdentifiers?: (string | RegExp)[];
570
589
  uniAppX?: boolean;
590
+ /**
591
+ * Absolute path of the module currently being transformed.
592
+ * Required when enabling cross-file analysis.
593
+ */
594
+ filename?: string;
595
+ /**
596
+ * Configure cross-file module graph analysis.
597
+ */
598
+ moduleGraph?: JsModuleGraphOptions;
571
599
  }
572
600
  interface IArbitraryValues {
573
601
  /**
@@ -613,7 +641,7 @@ type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supportCust
613
641
  customReplaceDictionary: Record<string, string>;
614
642
  setMangleRuntimeSet: (runtimeSet: Set<string>) => void;
615
643
  cache: ICreateCacheReturnType;
616
- twPatcher: TailwindcssPatcher;
644
+ twPatcher: TailwindcssPatcherLike;
617
645
  }>;
618
646
  type InternalPostcssOptions = Pick<UserDefinedOptions, 'cssMatcher' | 'mainCssChunkMatcher' | 'cssPreflight' | 'cssPreflightRange' | 'customRuleCallback' | 'disabled'>;
619
647
  interface IBaseWebpackPlugin {
@@ -630,5 +658,23 @@ interface InternalPatchResult {
630
658
  plugin?: string;
631
659
  }
632
660
  type CreateJsHandlerOptions = Omit<IJsHandlerOptions, 'classNameSet'>;
661
+ interface JsModuleGraphOptions {
662
+ /**
663
+ * Resolve an import specifier to an absolute file path.
664
+ */
665
+ resolve: (specifier: string, importer: string) => string | undefined;
666
+ /**
667
+ * Load module source synchronously.
668
+ */
669
+ load: (id: string) => string | undefined;
670
+ /**
671
+ * Optional filter to skip modules.
672
+ */
673
+ filter?: (id: string, specifier: string, importer: string) => boolean;
674
+ /**
675
+ * Maximum traversal depth. Defaults to `Infinity`.
676
+ */
677
+ maxDepth?: number;
678
+ }
633
679
 
634
- export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, UserDefinedOptions };
680
+ export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalCssSelectorReplacerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions };
package/dist/types.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use strict";require('./chunk-O2IOQ3BD.js');
2
- require('./chunk-RBRSMHFS.js');
2
+ require('./chunk-NHB7NFQC.js');
package/dist/types.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  import "./chunk-YAN7TO2B.mjs";
2
- import "./chunk-FBGUUXQV.mjs";
2
+ import "./chunk-FWIGQ4RY.mjs";
package/dist/vite.js CHANGED
@@ -1,13 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkVN2BU7ONjs = require('./chunk-VN2BU7ON.js');
3
+ var _chunk4NWVZ7I2js = require('./chunk-4NWVZ7I2.js');
4
+ require('./chunk-WVKK6TBL.js');
4
5
  require('./chunk-2NRTWL47.js');
5
6
  require('./chunk-OGROHM4L.js');
6
- require('./chunk-GQAB52GE.js');
7
+ require('./chunk-XYYHPJOQ.js');
7
8
  require('./chunk-PLMJW644.js');
8
9
  require('./chunk-FOSGDQZ7.js');
9
10
  require('./chunk-UW3WHSZ5.js');
10
- require('./chunk-RBRSMHFS.js');
11
+ require('./chunk-NHB7NFQC.js');
11
12
 
12
13
 
13
- exports.UnifiedViteWeappTailwindcssPlugin = _chunkVN2BU7ONjs.UnifiedViteWeappTailwindcssPlugin;
14
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunk4NWVZ7I2js.UnifiedViteWeappTailwindcssPlugin;
package/dist/vite.mjs CHANGED
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  UnifiedViteWeappTailwindcssPlugin
3
- } from "./chunk-NDHL3P32.mjs";
3
+ } from "./chunk-RQGIJKLG.mjs";
4
+ import "./chunk-34T2BFTJ.mjs";
4
5
  import "./chunk-H4JTYYOI.mjs";
5
6
  import "./chunk-CMUA5KCO.mjs";
6
- import "./chunk-D25XJJMP.mjs";
7
+ import "./chunk-Z7Q5UFNU.mjs";
7
8
  import "./chunk-Q67IXIAH.mjs";
8
9
  import "./chunk-IHKVNALD.mjs";
9
10
  import "./chunk-ZNKIYZRQ.mjs";
10
- import "./chunk-FBGUUXQV.mjs";
11
+ import "./chunk-FWIGQ4RY.mjs";
11
12
  export {
12
13
  UnifiedViteWeappTailwindcssPlugin
13
14
  };
package/dist/webpack.js CHANGED
@@ -1,14 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkQXCC745Gjs = require('./chunk-QXCC745G.js');
3
+ var _chunkIO3RB6AQjs = require('./chunk-IO3RB6AQ.js');
4
4
  require('./chunk-6GP37C26.js');
5
+ require('./chunk-WVKK6TBL.js');
5
6
  require('./chunk-2NRTWL47.js');
6
7
  require('./chunk-OGROHM4L.js');
7
- require('./chunk-GQAB52GE.js');
8
+ require('./chunk-XYYHPJOQ.js');
8
9
  require('./chunk-PLMJW644.js');
9
10
  require('./chunk-FOSGDQZ7.js');
10
11
  require('./chunk-UW3WHSZ5.js');
11
- require('./chunk-RBRSMHFS.js');
12
+ require('./chunk-NHB7NFQC.js');
12
13
 
13
14
 
14
- exports.UnifiedWebpackPluginV5 = _chunkQXCC745Gjs.UnifiedWebpackPluginV5;
15
+ exports.UnifiedWebpackPluginV5 = _chunkIO3RB6AQjs.UnifiedWebpackPluginV5;
package/dist/webpack.mjs CHANGED
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  UnifiedWebpackPluginV5
3
- } from "./chunk-L3HOZDIV.mjs";
3
+ } from "./chunk-OHUQYFGP.mjs";
4
4
  import "./chunk-2F7HOQQY.mjs";
5
+ import "./chunk-34T2BFTJ.mjs";
5
6
  import "./chunk-H4JTYYOI.mjs";
6
7
  import "./chunk-CMUA5KCO.mjs";
7
- import "./chunk-D25XJJMP.mjs";
8
+ import "./chunk-Z7Q5UFNU.mjs";
8
9
  import "./chunk-Q67IXIAH.mjs";
9
10
  import "./chunk-IHKVNALD.mjs";
10
11
  import "./chunk-ZNKIYZRQ.mjs";
11
- import "./chunk-FBGUUXQV.mjs";
12
+ import "./chunk-FWIGQ4RY.mjs";
12
13
  export {
13
14
  UnifiedWebpackPluginV5
14
15
  };
package/dist/webpack4.js CHANGED
@@ -1,31 +1,36 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
3
  var _chunk6GP37C26js = require('./chunk-6GP37C26.js');
4
4
 
5
5
 
6
6
 
7
+ var _chunkWVKK6TBLjs = require('./chunk-WVKK6TBL.js');
8
+
9
+
10
+
7
11
  var _chunk2NRTWL47js = require('./chunk-2NRTWL47.js');
8
12
 
9
13
 
10
14
  var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
11
15
 
12
16
 
13
- var _chunkGQAB52GEjs = require('./chunk-GQAB52GE.js');
17
+ var _chunkXYYHPJOQjs = require('./chunk-XYYHPJOQ.js');
14
18
  require('./chunk-PLMJW644.js');
15
19
  require('./chunk-FOSGDQZ7.js');
16
20
 
17
21
 
18
22
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
19
- require('./chunk-RBRSMHFS.js');
23
+ require('./chunk-NHB7NFQC.js');
20
24
 
21
25
  // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
22
26
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
23
27
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
28
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
24
29
  var _webpacksources = require('webpack-sources');
25
30
  var debug = _chunk2NRTWL47js.createDebug.call(void 0, );
26
31
  var UnifiedWebpackPluginV4 = class {
27
32
  constructor(options = {}) {
28
- this.options = _chunkGQAB52GEjs.getCompilerContext.call(void 0, options);
33
+ this.options = _chunkXYYHPJOQjs.getCompilerContext.call(void 0, options);
29
34
  this.appType = this.options.appType;
30
35
  }
31
36
  apply(compiler) {
@@ -84,6 +89,58 @@ var UnifiedWebpackPluginV4 = class {
84
89
  }
85
90
  const assets = compilation.assets;
86
91
  const entries = Object.entries(assets);
92
+ const outputDir = _optionalChain([compiler, 'access', _ => _.options, 'optionalAccess', _2 => _2.output, 'optionalAccess', _3 => _3.path]) ? _path2.default.resolve(compiler.options.output.path) : _process2.default.cwd();
93
+ const jsAssets = /* @__PURE__ */ new Map();
94
+ for (const [file] of entries) {
95
+ if (this.options.jsMatcher(file) || this.options.wxsMatcher(file)) {
96
+ const absolute = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
97
+ jsAssets.set(absolute, file);
98
+ }
99
+ }
100
+ const moduleGraphOptions = {
101
+ resolve(specifier, importer) {
102
+ return _chunkWVKK6TBLjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
103
+ },
104
+ load: (id) => {
105
+ const assetName = jsAssets.get(id);
106
+ if (!assetName) {
107
+ return void 0;
108
+ }
109
+ const assetSource = compilation.assets[assetName];
110
+ if (!assetSource) {
111
+ return void 0;
112
+ }
113
+ const source = assetSource.source();
114
+ return typeof source === "string" ? source : source.toString();
115
+ },
116
+ filter(id) {
117
+ return jsAssets.has(id);
118
+ }
119
+ };
120
+ const applyLinkedResults = (linked) => {
121
+ if (!linked) {
122
+ return;
123
+ }
124
+ for (const [id, { code }] of Object.entries(linked)) {
125
+ const assetName = jsAssets.get(id);
126
+ if (!assetName) {
127
+ continue;
128
+ }
129
+ const assetSource = compilation.assets[assetName];
130
+ if (!assetSource) {
131
+ continue;
132
+ }
133
+ const previousSource = assetSource.source();
134
+ const previous = typeof previousSource === "string" ? previousSource : previousSource.toString();
135
+ if (previous === code) {
136
+ continue;
137
+ }
138
+ const source = new (0, _webpacksources.ConcatSource)(code);
139
+ compilation.updateAsset(assetName, source);
140
+ onUpdate(assetName, previous, code);
141
+ debug("js linked handle: %s", assetName);
142
+ }
143
+ };
87
144
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
88
145
  const runtimeSet = await twPatcher.getClassSet();
89
146
  setMangleRuntimeSet(runtimeSet);
@@ -121,32 +178,45 @@ var UnifiedWebpackPluginV4 = class {
121
178
  }
122
179
  }
123
180
  if (Array.isArray(groupedEntries.js)) {
124
- for (const element of groupedEntries.js) {
125
- const [file, originalSource] = element;
181
+ for (const [file] of groupedEntries.js) {
126
182
  const cacheKey = _chunk6GP37C26js.getCacheKey.call(void 0, file);
127
- const rawSource = originalSource.source().toString();
128
- tasks.push(
129
- _chunk2NRTWL47js.processCachedTask.call(void 0, {
130
- cache,
131
- cacheKey,
132
- rawSource,
133
- applyResult(source) {
134
- compilation.updateAsset(file, source);
135
- },
136
- onCacheHit() {
137
- debug("js cache hit: %s", file);
138
- },
139
- transform: async () => {
140
- const { code } = await jsHandler(rawSource, runtimeSet);
141
- const source = new (0, _webpacksources.ConcatSource)(code);
142
- onUpdate(file, rawSource, code);
143
- debug("js handle: %s", file);
144
- return {
145
- result: source
146
- };
147
- }
148
- })
149
- );
183
+ const assetSource = compilation.assets[file];
184
+ if (!assetSource) {
185
+ continue;
186
+ }
187
+ const initialValue = assetSource.source();
188
+ const initialRawSource = typeof initialValue === "string" ? initialValue : initialValue.toString();
189
+ const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
190
+ await _chunk2NRTWL47js.processCachedTask.call(void 0, {
191
+ cache,
192
+ cacheKey,
193
+ rawSource: initialRawSource,
194
+ applyResult(source) {
195
+ compilation.updateAsset(file, source);
196
+ },
197
+ onCacheHit() {
198
+ debug("js cache hit: %s", file);
199
+ },
200
+ transform: async () => {
201
+ const currentAsset = compilation.assets[file];
202
+ const currentValue = _optionalChain([currentAsset, 'optionalAccess', _4 => _4.source, 'call', _5 => _5()]);
203
+ const currentSource = typeof currentValue === "string" ? currentValue : _nullishCoalesce(_optionalChain([currentValue, 'optionalAccess', _6 => _6.toString, 'call', _7 => _7()]), () => ( ""));
204
+ const { code, linked } = await jsHandler(currentSource, runtimeSet, {
205
+ filename: absoluteFile,
206
+ moduleGraph: moduleGraphOptions,
207
+ babelParserOptions: {
208
+ sourceFilename: absoluteFile
209
+ }
210
+ });
211
+ const source = new (0, _webpacksources.ConcatSource)(code);
212
+ onUpdate(file, currentSource, code);
213
+ debug("js handle: %s", file);
214
+ applyLinkedResults(linked);
215
+ return {
216
+ result: source
217
+ };
218
+ }
219
+ });
150
220
  }
151
221
  }
152
222
  if (Array.isArray(groupedEntries.css)) {