@plaudit/webpack-extensions 4.0.0-rc.1 → 4.1.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.
Files changed (246) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/api/asset-information-emission.d.ts +74 -0
  3. package/dist/api/asset-information-emission.d.ts.map +1 -0
  4. package/dist/api/asset-information-emission.js +398 -0
  5. package/dist/api/asset-information-emission.js.map +1 -0
  6. package/dist/api/configuration.d.ts +102 -0
  7. package/dist/api/configuration.d.ts.map +1 -0
  8. package/dist/api/configuration.js +83 -0
  9. package/dist/api/configuration.js.map +1 -0
  10. package/dist/api/coordinatable-emitter.d.ts +27 -0
  11. package/dist/api/coordinatable-emitter.d.ts.map +1 -0
  12. package/dist/api/coordinatable-emitter.js +20 -0
  13. package/dist/api/coordinatable-emitter.js.map +1 -0
  14. package/dist/api/entries/dependencies.d.ts +69 -0
  15. package/dist/api/entries/dependencies.d.ts.map +1 -0
  16. package/dist/api/entries/dependencies.js +61 -0
  17. package/dist/api/entries/dependencies.js.map +1 -0
  18. package/dist/api/entries/flag-logic.d.ts +37 -0
  19. package/dist/api/entries/flag-logic.d.ts.map +1 -0
  20. package/dist/api/entries/flag-logic.js +110 -0
  21. package/dist/api/entries/flag-logic.js.map +1 -0
  22. package/dist/api/entries/identifiers.d.ts +84 -0
  23. package/dist/api/entries/identifiers.d.ts.map +1 -0
  24. package/dist/api/entries/identifiers.js +590 -0
  25. package/dist/api/entries/identifiers.js.map +1 -0
  26. package/dist/api/entries/index.d.ts +6 -0
  27. package/dist/api/entries/index.d.ts.map +1 -0
  28. package/dist/api/entries/index.js +22 -0
  29. package/dist/api/entries/index.js.map +1 -0
  30. package/dist/api/entries/locations.d.ts +135 -0
  31. package/dist/api/entries/locations.d.ts.map +1 -0
  32. package/dist/api/entries/locations.js +174 -0
  33. package/dist/api/entries/locations.js.map +1 -0
  34. package/dist/api/entries/manager.d.ts +12 -0
  35. package/dist/api/entries/manager.d.ts.map +1 -0
  36. package/dist/api/entries/manager.js +35 -0
  37. package/dist/api/entries/manager.js.map +1 -0
  38. package/dist/api/handle-derivation.d.ts +32 -0
  39. package/dist/api/handle-derivation.d.ts.map +1 -0
  40. package/dist/api/handle-derivation.js +77 -0
  41. package/dist/api/handle-derivation.js.map +1 -0
  42. package/dist/api/index.d.ts +7 -0
  43. package/dist/api/index.d.ts.map +1 -0
  44. package/dist/api/index.js +23 -0
  45. package/dist/api/index.js.map +1 -0
  46. package/dist/api/shared-types.d.ts +86 -0
  47. package/dist/api/shared-types.d.ts.map +1 -0
  48. package/dist/api/shared-types.js +3 -0
  49. package/dist/api/shared-types.js.map +1 -0
  50. package/dist/internal-utils/auto-registering-plugins-loader.d.ts +3 -0
  51. package/dist/internal-utils/auto-registering-plugins-loader.d.ts.map +1 -0
  52. package/dist/internal-utils/auto-registering-plugins-loader.js +42 -0
  53. package/dist/internal-utils/auto-registering-plugins-loader.js.map +1 -0
  54. package/dist/internal-utils/common-config-helpers.d.ts +14 -0
  55. package/dist/internal-utils/common-config-helpers.d.ts.map +1 -0
  56. package/dist/internal-utils/common-config-helpers.js +140 -0
  57. package/dist/internal-utils/common-config-helpers.js.map +1 -0
  58. package/dist/internal-utils/entrypoint-resolution-logic.d.ts +14 -0
  59. package/dist/internal-utils/entrypoint-resolution-logic.d.ts.map +1 -0
  60. package/dist/internal-utils/entrypoint-resolution-logic.js +223 -0
  61. package/dist/internal-utils/entrypoint-resolution-logic.js.map +1 -0
  62. package/dist/internal-utils/internal-pseudo-plugin.d.ts +6 -0
  63. package/dist/internal-utils/internal-pseudo-plugin.d.ts.map +1 -0
  64. package/dist/internal-utils/internal-pseudo-plugin.js +46 -0
  65. package/dist/internal-utils/internal-pseudo-plugin.js.map +1 -0
  66. package/dist/mocks/blocks.d.ts +32 -0
  67. package/dist/mocks/blocks.d.ts.map +1 -0
  68. package/dist/mocks/blocks.js +3 -0
  69. package/dist/mocks/blocks.js.map +1 -0
  70. package/dist/mocks/index.d.ts +2 -0
  71. package/dist/mocks/index.d.ts.map +1 -0
  72. package/dist/mocks/index.js +18 -0
  73. package/dist/mocks/index.js.map +1 -0
  74. package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts +5 -0
  75. package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts.map +1 -0
  76. package/dist/plugins/AdditionalDependencyInjectorPlugin.js +59 -0
  77. package/dist/plugins/AdditionalDependencyInjectorPlugin.js.map +1 -0
  78. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +5 -0
  79. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts.map +1 -0
  80. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js +16 -0
  81. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js.map +1 -0
  82. package/dist/plugins/PackageConfigSanityChecker.d.ts +5 -0
  83. package/dist/plugins/PackageConfigSanityChecker.d.ts.map +1 -0
  84. package/dist/plugins/PackageConfigSanityChecker.js +31 -0
  85. package/dist/plugins/PackageConfigSanityChecker.js.map +1 -0
  86. package/dist/plugins/RootCoordinatorPluginImpl.d.ts +56 -0
  87. package/dist/plugins/RootCoordinatorPluginImpl.d.ts.map +1 -0
  88. package/dist/plugins/RootCoordinatorPluginImpl.js +767 -0
  89. package/dist/plugins/RootCoordinatorPluginImpl.js.map +1 -0
  90. package/dist/plugins/VariablesJSMonitorPlugin.d.ts +8 -0
  91. package/dist/plugins/VariablesJSMonitorPlugin.d.ts.map +1 -0
  92. package/dist/plugins/VariablesJSMonitorPlugin.js +21 -0
  93. package/dist/plugins/VariablesJSMonitorPlugin.js.map +1 -0
  94. package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.d.ts +25 -0
  95. package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.d.ts.map +1 -0
  96. package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.js +458 -0
  97. package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.js.map +1 -0
  98. package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.d.ts +29 -0
  99. package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.d.ts.map +1 -0
  100. package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.js +290 -0
  101. package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.js.map +1 -0
  102. package/dist/plugins/blocks/register.d.ts +6 -0
  103. package/dist/plugins/blocks/register.d.ts.map +1 -0
  104. package/dist/plugins/blocks/register.js +14 -0
  105. package/dist/plugins/blocks/register.js.map +1 -0
  106. package/dist/plugins/blocks/registerEmitter.d.ts +4 -0
  107. package/dist/plugins/blocks/registerEmitter.d.ts.map +1 -0
  108. package/dist/plugins/blocks/registerEmitter.js +13 -0
  109. package/dist/plugins/blocks/registerEmitter.js.map +1 -0
  110. package/dist/plugins/blocks/registerProcessor.d.ts +4 -0
  111. package/dist/plugins/blocks/registerProcessor.d.ts.map +1 -0
  112. package/dist/plugins/blocks/registerProcessor.js +46 -0
  113. package/dist/plugins/blocks/registerProcessor.js.map +1 -0
  114. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts +5 -0
  115. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts.map +1 -0
  116. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js +148 -0
  117. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js.map +1 -0
  118. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.d.ts +14 -0
  119. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.d.ts.map +1 -0
  120. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.js +191 -0
  121. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.js.map +1 -0
  122. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.d.ts +14 -0
  123. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.d.ts.map +1 -0
  124. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.js +102 -0
  125. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.js.map +1 -0
  126. package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.d.ts +25 -0
  127. package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.d.ts.map +1 -0
  128. package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.js +229 -0
  129. package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.js.map +1 -0
  130. package/dist/plugins/extensions/register.d.ts +6 -0
  131. package/dist/plugins/extensions/register.d.ts.map +1 -0
  132. package/dist/plugins/extensions/register.js +14 -0
  133. package/dist/plugins/extensions/register.js.map +1 -0
  134. package/dist/plugins/extensions/registerEmitter.d.ts +4 -0
  135. package/dist/plugins/extensions/registerEmitter.d.ts.map +1 -0
  136. package/dist/plugins/extensions/registerEmitter.js +18 -0
  137. package/dist/plugins/extensions/registerEmitter.js.map +1 -0
  138. package/dist/plugins/extensions/registerProcessor.d.ts +4 -0
  139. package/dist/plugins/extensions/registerProcessor.d.ts.map +1 -0
  140. package/dist/plugins/extensions/registerProcessor.js +42 -0
  141. package/dist/plugins/extensions/registerProcessor.js.map +1 -0
  142. package/dist/plugins/index.d.ts +11 -0
  143. package/dist/plugins/index.d.ts.map +1 -0
  144. package/dist/plugins/index.js +27 -0
  145. package/dist/plugins/index.js.map +1 -0
  146. package/dist/plugins/plain/PlainEntrypointProcessingPlugin.d.ts +18 -0
  147. package/dist/plugins/plain/PlainEntrypointProcessingPlugin.d.ts.map +1 -0
  148. package/dist/plugins/plain/PlainEntrypointProcessingPlugin.js +203 -0
  149. package/dist/plugins/plain/PlainEntrypointProcessingPlugin.js.map +1 -0
  150. package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.d.ts +13 -0
  151. package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.d.ts.map +1 -0
  152. package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.js +51 -0
  153. package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.js.map +1 -0
  154. package/dist/plugins/plain/register.d.ts +6 -0
  155. package/dist/plugins/plain/register.d.ts.map +1 -0
  156. package/dist/plugins/plain/register.js +14 -0
  157. package/dist/plugins/plain/register.js.map +1 -0
  158. package/dist/plugins/plain/registerEmitter.d.ts +4 -0
  159. package/dist/plugins/plain/registerEmitter.d.ts.map +1 -0
  160. package/dist/plugins/plain/registerEmitter.js +21 -0
  161. package/dist/plugins/plain/registerEmitter.js.map +1 -0
  162. package/dist/plugins/plain/registerProcessor.d.ts +4 -0
  163. package/dist/plugins/plain/registerProcessor.d.ts.map +1 -0
  164. package/dist/plugins/plain/registerProcessor.js +34 -0
  165. package/dist/plugins/plain/registerProcessor.js.map +1 -0
  166. package/dist/plugins/register.d.ts +3 -0
  167. package/dist/plugins/register.d.ts.map +1 -0
  168. package/dist/plugins/register.js +17 -0
  169. package/dist/plugins/register.js.map +1 -0
  170. package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.d.ts +20 -0
  171. package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.d.ts.map +1 -0
  172. package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.js +56 -0
  173. package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.js.map +1 -0
  174. package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.d.ts +13 -0
  175. package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.d.ts.map +1 -0
  176. package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.js +105 -0
  177. package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.js.map +1 -0
  178. package/dist/plugins/special-assets/register.d.ts +6 -0
  179. package/dist/plugins/special-assets/register.d.ts.map +1 -0
  180. package/dist/plugins/special-assets/register.js +14 -0
  181. package/dist/plugins/special-assets/register.js.map +1 -0
  182. package/dist/plugins/special-assets/registerEmitter.d.ts +4 -0
  183. package/dist/plugins/special-assets/registerEmitter.d.ts.map +1 -0
  184. package/dist/plugins/special-assets/registerEmitter.js +15 -0
  185. package/dist/plugins/special-assets/registerEmitter.js.map +1 -0
  186. package/dist/plugins/special-assets/registerProcessor.d.ts +4 -0
  187. package/dist/plugins/special-assets/registerProcessor.d.ts.map +1 -0
  188. package/dist/plugins/special-assets/registerProcessor.js +15 -0
  189. package/dist/plugins/special-assets/registerProcessor.js.map +1 -0
  190. package/dist/plugins/unified-loader/UnifiedLoaderGenerator.d.ts +22 -0
  191. package/dist/plugins/unified-loader/UnifiedLoaderGenerator.d.ts.map +1 -0
  192. package/dist/plugins/unified-loader/UnifiedLoaderGenerator.js +95 -0
  193. package/dist/plugins/unified-loader/UnifiedLoaderGenerator.js.map +1 -0
  194. package/dist/plugins/wpml-config/WPMLConfigBuilder.d.ts +24 -0
  195. package/dist/plugins/wpml-config/WPMLConfigBuilder.d.ts.map +1 -0
  196. package/dist/plugins/wpml-config/WPMLConfigBuilder.js +542 -0
  197. package/dist/plugins/wpml-config/WPMLConfigBuilder.js.map +1 -0
  198. package/dist/plugins/wpml-config/register.d.ts +6 -0
  199. package/dist/plugins/wpml-config/register.d.ts.map +1 -0
  200. package/dist/plugins/wpml-config/register.js +25 -0
  201. package/dist/plugins/wpml-config/register.js.map +1 -0
  202. package/dist/shared.d.ts +38 -0
  203. package/dist/shared.d.ts.map +1 -0
  204. package/dist/shared.js +163 -0
  205. package/dist/shared.js.map +1 -0
  206. package/dist/utils/error-helpers.d.ts +7 -0
  207. package/dist/utils/error-helpers.d.ts.map +1 -0
  208. package/dist/utils/error-helpers.js +73 -0
  209. package/dist/utils/error-helpers.js.map +1 -0
  210. package/dist/utils/index.d.ts +6 -0
  211. package/dist/utils/index.d.ts.map +1 -0
  212. package/dist/utils/index.js +22 -0
  213. package/dist/utils/index.js.map +1 -0
  214. package/dist/utils/misc.d.ts +4 -0
  215. package/dist/utils/misc.d.ts.map +1 -0
  216. package/dist/utils/misc.js +18 -0
  217. package/dist/utils/misc.js.map +1 -0
  218. package/dist/utils/path-helpers.d.ts +16 -0
  219. package/dist/utils/path-helpers.d.ts.map +1 -0
  220. package/dist/utils/path-helpers.js +115 -0
  221. package/dist/utils/path-helpers.js.map +1 -0
  222. package/dist/utils/pseudo-semaphore.d.ts +15 -0
  223. package/dist/utils/pseudo-semaphore.d.ts.map +1 -0
  224. package/dist/utils/pseudo-semaphore.js +77 -0
  225. package/dist/utils/pseudo-semaphore.js.map +1 -0
  226. package/dist/utils/type-helpers.d.ts +27 -0
  227. package/dist/utils/type-helpers.d.ts.map +1 -0
  228. package/dist/utils/type-helpers.js +33 -0
  229. package/dist/utils/type-helpers.js.map +1 -0
  230. package/dist/utils/writer-utils.d.ts +8 -0
  231. package/dist/utils/writer-utils.d.ts.map +1 -0
  232. package/dist/utils/writer-utils.js +35 -0
  233. package/dist/utils/writer-utils.js.map +1 -0
  234. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts +73 -0
  235. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts.map +1 -0
  236. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js +516 -0
  237. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js.map +1 -0
  238. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts +57 -0
  239. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts.map +1 -0
  240. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js +156 -0
  241. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js.map +1 -0
  242. package/dist/wordpress-scripts-wrapper.d.ts +5 -0
  243. package/dist/wordpress-scripts-wrapper.d.ts.map +1 -0
  244. package/dist/wordpress-scripts-wrapper.js +444 -0
  245. package/dist/wordpress-scripts-wrapper.js.map +1 -0
  246. package/package.json +7 -3
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlainEntrypointProcessingPlugin = void 0;
4
+ const promises_1 = require("node:fs/promises");
5
+ const node_path_1 = require("node:path");
6
+ const webpack_1 = require("webpack");
7
+ const api_1 = require("../../api");
8
+ const utils_1 = require("../../utils");
9
+ const basenameCleaner = /_(?:script(?:-\d+)?\.js|style(?:-\d+)?\.css)$|(?<!_(script|style))\.(js|css)$/;
10
+ class PlainEntrypointProcessingPlugin extends api_1.CoordinatableEmitter {
11
+ coordinator;
12
+ config;
13
+ context;
14
+ origins;
15
+ constructor(coordinator, config, context, origins) {
16
+ super();
17
+ this.coordinator = coordinator;
18
+ this.config = config;
19
+ this.context = context;
20
+ this.origins = origins;
21
+ }
22
+ requires = [];
23
+ provides = ["plain-entrypoints"];
24
+ defaultCompilationName = undefined;
25
+ apply(compiler) {
26
+ super.apply(compiler);
27
+ const processingModules = !!compiler.options.output.module;
28
+ compiler.hooks.make.tapPromise(this.constructor.name, async (compilation) => {
29
+ const { addEntry, waitHook } = this.makeEntryManager(compiler, compilation, this.context);
30
+ const plainEntrypoints = [];
31
+ const explicitlyRequestedSources = new Set(this.origins.flatMap(v => v[0]));
32
+ for (const [srcRoot, dest] of this.origins) {
33
+ let absoluteSrc, additionalSrcs;
34
+ if (Array.isArray(srcRoot)) {
35
+ absoluteSrc = srcRoot[0];
36
+ additionalSrcs = srcRoot.slice(1);
37
+ }
38
+ else {
39
+ absoluteSrc = srcRoot;
40
+ additionalSrcs = undefined;
41
+ }
42
+ const stats = await (0, promises_1.stat)(absoluteSrc, { throwIfNoEntry: false });
43
+ if (stats?.isFile()) {
44
+ plainEntrypoints.push(this.processFileSource(absoluteSrc, dest, additionalSrcs));
45
+ }
46
+ else if (stats?.isDirectory()) {
47
+ if (additionalSrcs?.length) {
48
+ (0, utils_1.emitWarning)("Additional sources are not supported when in directory mode", { compilation, rawIdentifier: (0, node_path_1.relative)(this.context, absoluteSrc) });
49
+ }
50
+ plainEntrypoints.push(this.processDirectorySource(compilation, explicitlyRequestedSources, absoluteSrc, dest, additionalSrcs));
51
+ }
52
+ else if (stats !== undefined) {
53
+ throw new Error(`"${srcRoot}" resolved to neither a directory nor a file`);
54
+ }
55
+ }
56
+ for (const ep of (0, utils_1.dedupeEntrypointOutputPaths)((await Promise.all(plainEntrypoints)).flat())) {
57
+ if (processingModules === (ep.type === "script_module")) {
58
+ addEntry(ep.absoluteSrc, ep);
59
+ }
60
+ }
61
+ await waitHook();
62
+ });
63
+ compiler.hooks.thisCompilation.tap(this.constructor.name, compilation => {
64
+ compilation.hooks.processAssets.tap({ name: this.constructor.name, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_REPORT }, () => {
65
+ const reportableData = [];
66
+ const relevantDestinations = this.origins.map(v => v[1].destination);
67
+ for (const entrypoint of compilation.entrypoints.values()) {
68
+ if ((0, api_1.isPlauditEntryOptions)(entrypoint.options) && relevantDestinations.includes(entrypoint.options.baseDestination)) {
69
+ reportableData.push(entrypoint.options.absoluteSrc);
70
+ }
71
+ }
72
+ this.coordinator.reportData(compilation, this, "plain-entrypoints", reportableData);
73
+ });
74
+ });
75
+ }
76
+ async processDirectorySource(compilation, explicitlyRequestedSources, srcRoot, dest, additionalSrcRoots) {
77
+ const plainEntrypoints = [];
78
+ const tryAddEntrypoint = (filename, delegateContext, assumePreEncodedLocations, entrypointNameSuffix, additionalSrcFilenames) => {
79
+ if (dest.withLegacyBlocksIn !== false) {
80
+ (0, utils_1.emitWarning)("The withLegacyBlocksIn option is not valid when in directory mode. It will be ignored", { compilation });
81
+ }
82
+ const parsedFilename = (0, api_1.parseEntrypointIdentifier)(filename, dest, delegateContext, { assumePreEncodedLocations });
83
+ if (!parsedFilename?.type) {
84
+ return;
85
+ }
86
+ const { filePath, ...pluginOptions } = parsedFilename;
87
+ const absoluteSrc = (0, node_path_1.normalize)((0, utils_1.joinPossiblyAbsolutePaths)(srcRoot, filePath));
88
+ if (explicitlyRequestedSources.has(absoluteSrc) && absoluteSrc !== srcRoot) {
89
+ return;
90
+ }
91
+ const additionalSrcFilenamesParent = (0, node_path_1.dirname)(absoluteSrc);
92
+ const parsedEntrypoint = (0, node_path_1.parse)((0, node_path_1.normalize)((0, node_path_1.join)(dest.destination, (0, node_path_1.relative)(srcRoot, absoluteSrc))));
93
+ const cleanBasename = (pluginOptions.niceName ?? entrypointNameSuffix) || (0, utils_1.kebabCase)(parsedEntrypoint.name.replace(basenameCleaner, ""));
94
+ const combinedAdditionalSrcRoots = [];
95
+ if (additionalSrcRoots?.length) {
96
+ combinedAdditionalSrcRoots.push(...additionalSrcRoots);
97
+ }
98
+ if (additionalSrcFilenames?.length) {
99
+ combinedAdditionalSrcRoots.push(...additionalSrcFilenames.map(fn => (0, node_path_1.join)(additionalSrcFilenamesParent, fn)));
100
+ }
101
+ plainEntrypoints.push((0, api_1.makePlauditEntryOptions)(dest.handle, this.config.targetHandlePrefix, cleanBasename, {
102
+ ...pluginOptions,
103
+ absoluteSrc,
104
+ name: (0, node_path_1.join)(parsedEntrypoint.dir, parsedEntrypoint.name),
105
+ additionalDependencies: dest.additionalDependencies,
106
+ baseDestination: dest.destination,
107
+ additionalSrcs: combinedAdditionalSrcRoots.length > 0 ? combinedAdditionalSrcRoots : undefined,
108
+ ...inliningHandlers,
109
+ }));
110
+ };
111
+ const handleEntrypointAndPackageJsons = async (srcPrefix) => {
112
+ try {
113
+ const packageJsonOrigin = (0, node_path_1.join)(srcRoot, srcPrefix + 'package.json');
114
+ const packageJson = JSON.parse(await (0, promises_1.readFile)(packageJsonOrigin, 'utf8'));
115
+ if (packageJson['main']) {
116
+ for (const filename of (Array.isArray(packageJson['main']) ? packageJson['main'] : [packageJson['main']])) {
117
+ tryAddEntrypoint((0, node_path_1.normalize)(srcPrefix + filename), { compilation, rawIdentifier: `${packageJsonOrigin}!${filename}` }, true);
118
+ }
119
+ }
120
+ if (packageJson['style']) {
121
+ for (const filename of (Array.isArray(packageJson['style']) ? packageJson['style'] : [packageJson['style']])) {
122
+ tryAddEntrypoint((0, node_path_1.normalize)(srcPrefix + filename), { compilation, rawIdentifier: `${packageJsonOrigin}!${filename}` }, true);
123
+ }
124
+ }
125
+ return true;
126
+ }
127
+ catch {
128
+ try {
129
+ const entrypointJsonOrigin = (0, node_path_1.join)(srcRoot, srcPrefix + 'entrypoints.json');
130
+ const potentialEntrypoints = await (0, api_1.parseEntrypointsJson)(entrypointJsonOrigin);
131
+ for (const potentialEntrypoint of potentialEntrypoints) {
132
+ if (typeof potentialEntrypoint === 'string') {
133
+ tryAddEntrypoint((0, node_path_1.normalize)(srcPrefix + potentialEntrypoint), { compilation, rawIdentifier: `${entrypointJsonOrigin}!${potentialEntrypoint}` }, true);
134
+ }
135
+ else {
136
+ tryAddEntrypoint((0, node_path_1.normalize)(srcPrefix + potentialEntrypoint.filename), { compilation, rawIdentifier: `${entrypointJsonOrigin}!${potentialEntrypoint.filename}` }, true, potentialEntrypoint.entrypointName, potentialEntrypoint.additionalSrcFilenames);
137
+ }
138
+ }
139
+ return true;
140
+ }
141
+ catch {
142
+ return false;
143
+ }
144
+ }
145
+ };
146
+ if (await handleEntrypointAndPackageJsons("")) {
147
+ return plainEntrypoints;
148
+ }
149
+ for await (const dirent of await (0, promises_1.opendir)(srcRoot)) {
150
+ if (dirent.isFile()) {
151
+ tryAddEntrypoint(dirent.name, { compilation, rawIdentifier: (0, node_path_1.join)(srcRoot, dirent.name) }, false);
152
+ }
153
+ else if (dirent.isDirectory()) {
154
+ await handleEntrypointAndPackageJsons(dirent.name + "/");
155
+ }
156
+ }
157
+ return plainEntrypoints;
158
+ }
159
+ async processFileSource(srcRoot, dest, additionalSrcRoots) {
160
+ const type = (0, api_1.getAssetType)(srcRoot);
161
+ if (type) {
162
+ const { dir, name } = (0, node_path_1.parse)(dest.destination);
163
+ const cleanBasename = (0, utils_1.kebabCase)(name.replace(basenameCleaner, ""));
164
+ const combinedAdditionalSrcRoots = new Set(additionalSrcRoots ?? []);
165
+ return [(0, api_1.makePlauditEntryOptions)(dest.handle, this.config.targetHandlePrefix, cleanBasename, {
166
+ name: (0, node_path_1.join)(dir, name),
167
+ absoluteSrc: srcRoot,
168
+ baseDestination: dest.destination,
169
+ type,
170
+ flags: dest.flags,
171
+ locations: dest.locations,
172
+ additionalDependencies: dest.additionalDependencies,
173
+ additionalSrcs: combinedAdditionalSrcRoots.values().toArray(),
174
+ ...inliningHandlers,
175
+ })];
176
+ }
177
+ return [];
178
+ }
179
+ getCoordinatedEmissionTargets() {
180
+ return [];
181
+ }
182
+ }
183
+ exports.PlainEntrypointProcessingPlugin = PlainEntrypointProcessingPlugin;
184
+ const inliningHandlers = {
185
+ mayInline: (file, options) => (0, api_1.getAssetType)(file) === 'style' && options.locations.clientEditor !== undefined,
186
+ writeToDisk: (_, options) => {
187
+ return options.flags.inline === undefined || Object.keys(options.locations).some(k => k !== 'register' && k !== 'lazyLoader' && (options.type !== 'style' || k !== 'clientEditor'));
188
+ },
189
+ };
190
+ async function walkBlocksDir(blocksDir, action) {
191
+ for await (const blocksDirent of await (0, promises_1.opendir)(blocksDir)) {
192
+ if ((0, utils_1.shouldBeSkipped)(blocksDirent.name) || !blocksDirent.isDirectory()) {
193
+ continue;
194
+ }
195
+ const parentPath = (0, node_path_1.join)(blocksDir, blocksDirent.name);
196
+ for await (const dirent of await (0, promises_1.opendir)(parentPath)) {
197
+ if (!(0, utils_1.shouldBeSkipped)(dirent.name) && dirent.isFile()) {
198
+ action(dirent, parentPath);
199
+ }
200
+ }
201
+ }
202
+ }
203
+ //# sourceMappingURL=PlainEntrypointProcessingPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlainEntrypointProcessingPlugin.js","sourceRoot":"","sources":["../../../src/plugins/plain/PlainEntrypointProcessingPlugin.ts"],"names":[],"mappings":";;;AACA,+CAAyD;AACzD,yCAAoE;AAEpE,qCAAmD;AAEnD,mCAImB;AACnB,uCAA4H;AAI5H,MAAM,eAAe,GAAG,+EAA+E,CAAC;AAExG,qCAA6C,SAAQ,0BAAoB;IAEpD,WAAW;IACb,MAAM;IACN,OAA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I,MAAM,IAAA,kBAAO,EAAC,SAAS,CAAC,EAAE,CAAC;QAC3D,IAAI,IAAA,uBAAe,EAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC;YACvE,SAAS;QACV,CAAC;QACD,MAAM,UAAU,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,MAAM,IAAA,kBAAO,EAAC,UAAU,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC,IAAA,uBAAe,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;gBACtD,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YAC5B,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type Compiler } from "webpack";
2
+ import { CoordinatableEmitter, type CoordinatedEmissionTargetBuilder, type RootCoordinatorPlugin, type VerifiedPlauditWordpressWebpackConfig } from "../../api";
3
+ export declare class PlainEntrypointsConfigEmitterPlugin extends CoordinatableEmitter {
4
+ protected readonly coordinator: RootCoordinatorPlugin;
5
+ private readonly config;
6
+ constructor(coordinator: RootCoordinatorPlugin, config: VerifiedPlauditWordpressWebpackConfig);
7
+ readonly requires: readonly ["plain-entrypoints"];
8
+ readonly provides: readonly ["unified-loader"];
9
+ get defaultCompilationName(): string;
10
+ apply(compiler: Compiler): void;
11
+ getCoordinatedEmissionTargets(): CoordinatedEmissionTargetBuilder[];
12
+ }
13
+ //# sourceMappingURL=PlainEntrypointsConfigEmitterPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlainEntrypointsConfigEmitterPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/plain/PlainEntrypointsConfigEmitterPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEnD,OAAO,EAEN,oBAAoB,EACpB,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,qCAAqC,EAC1C,MAAM,WAAW,CAAC;AAMnB,qBAAa,mCAAoC,SAAQ,oBAAoB;IAE3E,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,qBAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFxB,YACoB,WAAW,EAAE,qBAAqB,EACpC,MAAM,EAAE,qCAAqC,EAG9D;IAED,SAAgB,QAAQ,YAAI,mBAAmB,EAAW;IAC1D,SAAgB,QAAQ,YAAI,gBAAgB,EAAW;IAEvD,IAAW,sBAAsB,WAEhC;IAED,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CA2B9B;IAED,6BAA6B,IAAI,gCAAgC,EAAE,CAElE;CACD"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlainEntrypointsConfigEmitterPlugin = void 0;
4
+ const php_writer_1 = require("@plaudit/php-writer");
5
+ const webpack_1 = require("webpack");
6
+ const api_1 = require("../../api");
7
+ const utils_1 = require("../../utils");
8
+ const UnifiedLoaderGenerator_1 = require("../unified-loader/UnifiedLoaderGenerator");
9
+ class PlainEntrypointsConfigEmitterPlugin extends api_1.CoordinatableEmitter {
10
+ coordinator;
11
+ config;
12
+ constructor(coordinator, config) {
13
+ super();
14
+ this.coordinator = coordinator;
15
+ this.config = config;
16
+ }
17
+ requires = ["plain-entrypoints"];
18
+ provides = ["unified-loader"];
19
+ get defaultCompilationName() {
20
+ return "plain-entrypoints";
21
+ }
22
+ apply(compiler) {
23
+ super.apply(compiler);
24
+ compiler.hooks.thisCompilation.tap(this.constructor.name, compilation => {
25
+ compilation.hooks.processAssets.tapPromise({
26
+ name: this.constructor.name,
27
+ stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
28
+ }, async () => {
29
+ const coordinatedHandles = await this.coordinator.getHandles(compilation);
30
+ const emittableSources = new Set(this.coordinator.getData("plain-entrypoints").flat());
31
+ const file = new php_writer_1.PHPFile();
32
+ if (!this.config.useUnifiedLoader && Object.values(coordinatedHandles).some(value => value.options.flags.inline === undefined)) {
33
+ (0, utils_1.emitResolveBaseUriFunction)(file);
34
+ }
35
+ (0, api_1.appendAssetHooks)(compilation, Object.values(coordinatedHandles)
36
+ .filter(data => emittableSources.has(data.options.absoluteSrc)), this.config, file, { useBlockEditorSettingsInjectionHack: true });
37
+ (0, utils_1.emitPHPWriterAsAsset)(file, compilation, "plain-entrypoints-loader.php");
38
+ this.coordinator.reportData(compilation, this, "unified-loader", {
39
+ group: "plain-entrypoints",
40
+ requiresBaseURI: true,
41
+ action: file => file.require("/plain-entrypoints-loader.php", { dirRelative: true, once: true }),
42
+ });
43
+ });
44
+ });
45
+ }
46
+ getCoordinatedEmissionTargets() {
47
+ return [UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.emissionTarget(this.config)];
48
+ }
49
+ }
50
+ exports.PlainEntrypointsConfigEmitterPlugin = PlainEntrypointsConfigEmitterPlugin;
51
+ //# sourceMappingURL=PlainEntrypointsConfigEmitterPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlainEntrypointsConfigEmitterPlugin.js","sourceRoot":"","sources":["../../../src/plugins/plain/PlainEntrypointsConfigEmitterPlugin.ts"],"names":[],"mappings":";;;AAAA,oDAA4C;AAE5C,qCAAmD;AAEnD,mCAMmB;AACnB,uCAA6E;AAC7E,qFAAiG;AAIjG,yCAAiD,SAAQ,0BAAoB;IAExD,WAAW;IACb,MAAM;IAFxB,YACoB,WAAkC,EACpC,MAA6C;QAE9D,KAAK,EAAE,CAAC;2BAHW,WAAW;sBACb,MAAM;IAGxB,CAAC;IAEe,QAAQ,GAAG,CAAC,mBAAmB,CAAU,CAAC;IAC1C,QAAQ,GAAG,CAAC,gBAAgB,CAAU,CAAC;IAEvD,IAAW,s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BAAoB,EAAC,IAAI,EAAE,WAAW,EAAE,8BAA8B,CAAC,CAAC;gBACxE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,gBAAgB,EAAE;oBAChE,KAAK,EAAE,mBAAmB;oBAC1B,eAAe,EAAE,IAAI;oBACrB,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,EAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC;iBACzE,CAAC,CAAC;YACzB,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,6BAA6B;QAC5B,OAAO,CAAC,+CAAsB,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAU,CAAC;IACtE,CAAC;CACD"}
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ plauditWebpackExtensionsPlugin: true;
3
+ register(wrapperManager: import("../../api").WrapperManager): void;
4
+ };
5
+ export = _default;
6
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/plugins/plain/register.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const registerEmitter_1 = __importDefault(require("./registerEmitter"));
6
+ const registerProcessor_1 = __importDefault(require("./registerProcessor"));
7
+ module.exports = {
8
+ plauditWebpackExtensionsPlugin: true,
9
+ register(...args) {
10
+ (0, registerProcessor_1.default)(...args);
11
+ (0, registerEmitter_1.default)(...args);
12
+ }
13
+ };
14
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/plugins/plain/register.ts"],"names":[],"mappings":";;;;AAEA,wEAAgD;AAChD,4EAAoD;AAEpD,iBAAS;IACR,8BAA8B,EAAE,IAAI;IACpC,QAAQ,CAAC,GAAG,IAAI;QACf,IAAA,2BAAiB,EAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,IAAA,yBAAe,EAAC,GAAG,IAAI,CAAC,CAAC;IAC1B,CAAC;CAC+B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type AutoRegisteringPlugin } from "../../api";
2
+ declare const register: AutoRegisteringPlugin['register'];
3
+ export default register;
4
+ //# sourceMappingURL=registerEmitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerEmitter.d.ts","sourceRoot":"","sources":["../../../src/plugins/plain/registerEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,qBAAqB,EAAuB,MAAM,WAAW,CAAC;AAK3E,QAAA,MAAM,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAY/C,CAAC;eAEa,QAAQ"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const api_1 = require("../../api");
4
+ const PlainEntrypointsConfigEmitterPlugin_1 = require("./PlainEntrypointsConfigEmitterPlugin");
5
+ const NAME = "PlainEntrypointsLoaderEmitter";
6
+ const register = ({ config, coordinator, hooks }) => {
7
+ if (config.plainEntrypointsVersion > 1) {
8
+ hooks.batch.tap(NAME, (batch, { config }) => {
9
+ batch.hooks.afterBatch.tap({ name: NAME, stage: 10 }, plugins => {
10
+ if (plugins.some(plugin => plugin instanceof api_1.CoordinatableEmitter && plugin.provides.includes("plain-entrypoints"))) {
11
+ plugins.push(new PlainEntrypointsConfigEmitterPlugin_1.PlainEntrypointsConfigEmitterPlugin(coordinator, config));
12
+ }
13
+ });
14
+ });
15
+ }
16
+ else {
17
+ coordinator.enableAssetPhpFileEmission("plain-entrypoints");
18
+ }
19
+ };
20
+ exports.default = register;
21
+ //# sourceMappingURL=registerEmitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerEmitter.js","sourceRoot":"","sources":["../../../src/plugins/plain/registerEmitter.ts"],"names":[],"mappings":";;AAAA,mCAA2E;AAE3E,+FAA0F;AAE1F,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,QAAQ,GAAsC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAC,EAAE,EAAE;IACpF,IAAI,MAAM,CAAC,uBAAuB,GAAG,CAAC,EAAE,CAAC;QACxC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAC,MAAM,EAAC,EAAE,EAAE;YACzC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAC,EAAE,OAAO,CAAC,EAAE;gBAC7D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,YAAY,0BAAoB,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC;oBACrH,OAAO,CAAC,IAAI,CAAC,IAAI,yEAAmC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;gBAC3E,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;SAAM,CAAC;QACP,WAAW,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,CAAC;IAC7D,CAAC;AACF,CAAC,CAAC;kBAEa,QAAQ"}
@@ -0,0 +1,4 @@
1
+ import { type AutoRegisteringPlugin } from "../../api";
2
+ declare const register: AutoRegisteringPlugin['register'];
3
+ export default register;
4
+ //# sourceMappingURL=registerProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerProcessor.d.ts","sourceRoot":"","sources":["../../../src/plugins/plain/registerProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,qBAAqB,EAAiB,MAAM,WAAW,CAAC;AAMrE,QAAA,MAAM,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CA8B/C,CAAC;eAEa,QAAQ"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const api_1 = require("../../api");
4
+ const PlainEntrypointProcessingPlugin_1 = require("./PlainEntrypointProcessingPlugin");
5
+ const SOURCE_TYPE = 'plain';
6
+ const NAME = `${SOURCE_TYPE.substring(0, 1).toUpperCase()}${SOURCE_TYPE.substring(1)}EntrypointsProcessor`;
7
+ const register = ({ hooks, coordinator, supportedSourceTypes }) => {
8
+ supportedSourceTypes.add(SOURCE_TYPE);
9
+ hooks.batch.tap(NAME, (batch, { config, webpackConfig }) => {
10
+ const processingModules = webpackConfig.output?.module;
11
+ const contextPath = webpackConfig.context ?? process.cwd();
12
+ const plainEntrypointOrigins = [];
13
+ batch.hooks.destinationHandler.tap({ name: NAME, stage: 1_000 }, ({ dest, srcIsDirectory, srcRoot }) => {
14
+ if (dest.sourceType && dest.sourceType !== SOURCE_TYPE) {
15
+ return;
16
+ }
17
+ const applicableExtensionTest = (name) => {
18
+ return batch.scriptExtension.test(name) || (!processingModules && api_1.styleExtension.test(name));
19
+ };
20
+ const absoluteSrc = typeof srcRoot === 'string' ? srcRoot : srcRoot[0];
21
+ if (dest.sourceType === SOURCE_TYPE || srcIsDirectory || applicableExtensionTest(absoluteSrc)) {
22
+ plainEntrypointOrigins.push([srcRoot, dest]);
23
+ }
24
+ return;
25
+ });
26
+ batch.hooks.afterBatch.tap(NAME, plugins => {
27
+ if (plainEntrypointOrigins.length > 0) {
28
+ plugins.push(new PlainEntrypointProcessingPlugin_1.PlainEntrypointProcessingPlugin(coordinator, config, contextPath, plainEntrypointOrigins));
29
+ }
30
+ });
31
+ });
32
+ };
33
+ exports.default = register;
34
+ //# sourceMappingURL=registerProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerProcessor.js","sourceRoot":"","sources":["../../../src/plugins/plain/registerProc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,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACvE,IAAI,IAAI,CAAC,UAAU,KAAK,WAAW,IAAI,cAAc,IAAI,uBAAuB,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC/F,sBAAsB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;YAC9C,CAAC;YACD,OAAO;QACR,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;YAC1C,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,IAAI,iEAA+B,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC;YAC7G,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAA;AACH,CAAC,CAAC;kBAEa,QAAQ"}
@@ -0,0 +1,3 @@
1
+ import type { AutoRegisteringPlugin } from "../api";
2
+ export declare const registerBuiltins: (...args: Parameters<AutoRegisteringPlugin['register']>) => Promise<void>;
3
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/plugins/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,QAAQ,CAAC;AAQlD,eAAO,MAAM,gBAAgB,YAAmB,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,kBAM5F,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerBuiltins = void 0;
4
+ const register_1 = require("./extensions/register");
5
+ const register_2 = require("./plain/register");
6
+ const register_3 = require("./special-assets/register");
7
+ const register_4 = require("./wpml-config/register");
8
+ //TODO: The await import... pattern needs testing
9
+ const registerBuiltins = async (...args) => {
10
+ (await import("./blocks/register.js")).register(...args);
11
+ (0, register_1.register)(...args);
12
+ (0, register_2.register)(...args);
13
+ (0, register_3.register)(...args);
14
+ (0, register_4.register)(...args);
15
+ };
16
+ exports.registerBuiltins = registerBuiltins;
17
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/plugins/register.ts"],"names":[],"mappings":";;;AAEA,oDAAqE;AACrE,+CAA2D;AAC3D,wDAA4E;AAC5E,qDAAsE;AAEtE,iDAAiD;AAC1C,MAAM,gBAAgB,GAAG,KAAK,EAAE,GAAG,IAAmD,EAAE,EAAE;IAChG,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;IACzD,IAAA,mBAAkB,EAAC,GAAG,IAAI,CAAC,CAAC;IAC5B,IAAA,mBAAa,EAAC,GAAG,IAAI,CAAC,CAAC;IACvB,IAAA,mBAAqB,EAAC,GAAG,IAAI,CAAC,CAAC;IAC/B,IAAA,mBAAkB,EAAC,GAAG,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC;AANW,QAAA,gBAAgB,GAAhB,gBAAgB,CAM3B"}
@@ -0,0 +1,20 @@
1
+ import { type Compiler } from "webpack";
2
+ import { CoordinatableEmitter, type CoordinatedEmissionTargetBuilder, type RootCoordinatorPlugin, type VerifiedPlauditWordpressWebpackConfig } from "../../api";
3
+ export type CollatedSpecialAssetData = {
4
+ [k: string]: {
5
+ preload?: boolean;
6
+ fetchpriority?: string | null;
7
+ crossorigin?: string | null;
8
+ };
9
+ };
10
+ export declare class SpecialAssetsCollectorPlugin extends CoordinatableEmitter {
11
+ protected readonly coordinator: RootCoordinatorPlugin;
12
+ private readonly config;
13
+ constructor(coordinator: RootCoordinatorPlugin, config: VerifiedPlauditWordpressWebpackConfig);
14
+ readonly requires: readonly [];
15
+ readonly provides: readonly ["special-assets"];
16
+ readonly defaultCompilationName: undefined;
17
+ apply(compiler: Compiler): void;
18
+ getCoordinatedEmissionTargets(): CoordinatedEmissionTargetBuilder[];
19
+ }
20
+ //# sourceMappingURL=SpecialAssetsCollectorPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecialAssetsCollectorPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/special-assets/SpecialAssetsCollectorPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEnD,OAAO,EACN,oBAAoB,EACpB,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,qCAAqC,EAC1C,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,wBAAwB,GAAG;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,GAAC,IAAI,CAAA;KAAC,CAAA;CAAC,CAAC;AAClI,qBAAa,4BAA6B,SAAQ,oBAAoB;IAEpE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,qBAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFxB,YACoB,WAAW,EAAE,qBAAqB,EACpC,MAAM,EAAE,qCAAqC,EAG9D;IAED,SAAgB,QAAQ,cAAe;IACvC,SAAgB,QAAQ,YAAI,gBAAgB,EAAW;IACvD,SAAgB,sBAAsB,YAAa;IAE5C,KAAK,CAAC,QAAQ,EAAE,QAAQ,QAgC9B;IAED,6BAA6B,IAAI,gCAAgC,EAAE,CAElE;CACD"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SpecialAssetsCollectorPlugin = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const webpack_1 = require("webpack");
9
+ const api_1 = require("../../api");
10
+ class SpecialAssetsCollectorPlugin extends api_1.CoordinatableEmitter {
11
+ coordinator;
12
+ config;
13
+ constructor(coordinator, config) {
14
+ super();
15
+ this.coordinator = coordinator;
16
+ this.config = config;
17
+ }
18
+ requires = [];
19
+ provides = ["special-assets"];
20
+ defaultCompilationName = undefined;
21
+ apply(compiler) {
22
+ super.apply(compiler);
23
+ compiler.hooks.thisCompilation.tap(this.constructor.name, compilation => {
24
+ compilation.hooks.processAssets.tapPromise({ name: this.constructor.name, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_ANALYSE }, async (assets) => {
25
+ const specialAssetData = {};
26
+ for (const pathname of Object.keys(assets)) {
27
+ const assetInfo = compilation.assetsInfo.get(pathname);
28
+ if (!assetInfo?.sourceFilename) {
29
+ continue;
30
+ }
31
+ const filename = node_path_1.default.join(node_path_1.default.basename(node_path_1.default.dirname(pathname)), node_path_1.default.basename(pathname));
32
+ const queryStart = assetInfo.sourceFilename.indexOf('?');
33
+ if (queryStart < 0) {
34
+ continue;
35
+ }
36
+ const params = new URLSearchParams(assetInfo.sourceFilename.substring(queryStart + 1)
37
+ .replace(/(?:fetchPriority|crossOrigin)=/gi, str => str.toLowerCase()) //This ensures consistent capitalization of the fetchPriority parameter
38
+ );
39
+ if (params.has("preload")) {
40
+ specialAssetData[filename] = {
41
+ preload: true,
42
+ fetchpriority: params.get("fetchpriority"),
43
+ crossorigin: params.get("crossorigin")
44
+ };
45
+ }
46
+ }
47
+ this.coordinator.reportData(compilation, this, "special-assets", specialAssetData);
48
+ });
49
+ });
50
+ }
51
+ getCoordinatedEmissionTargets() {
52
+ return [];
53
+ }
54
+ }
55
+ exports.SpecialAssetsCollectorPlugin = SpecialAssetsCollectorPlugin;
56
+ //# sourceMappingURL=SpecialAssetsCollectorPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecialA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AC3F,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;oBACzD,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;wBACpB,SAAS;oBACV,CAAC;oBAED,MAAM,MAAM,GAAG,IAAI,eAAe,CACjC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC;yBAChD,OAAO,CAAC,kCAAkC,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,uEAAuE;qBAC/I,CAAC;oBACF,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;wBAC3B,gBAAgB,CAAC,QAAQ,CAAC,GAAG;4BAC5B,OAAO,EAAE,IAAI;4BACb,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC;4BAC1C,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;yBACtC,CAAC;oBACH,CAAC;gBACF,CAAC;gBACD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,6BAA6B;QAC5B,OAAO,EAAE,CAAC;IACX,CAAC;CACD"}
@@ -0,0 +1,13 @@
1
+ import { type Compiler } from "webpack";
2
+ import { CoordinatableEmitter, type CoordinatedEmissionTargetBuilder, type RootCoordinatorPlugin, type VerifiedPlauditWordpressWebpackConfig } from "../../api";
3
+ export declare class SpecialAssetsLoaderEmitterPlugin extends CoordinatableEmitter {
4
+ protected readonly coordinator: RootCoordinatorPlugin;
5
+ private readonly config;
6
+ constructor(coordinator: RootCoordinatorPlugin, config: VerifiedPlauditWordpressWebpackConfig);
7
+ readonly requires: readonly ["special-assets"];
8
+ readonly provides: readonly ["unified-loader"];
9
+ get defaultCompilationName(): string;
10
+ apply(compiler: Compiler): void;
11
+ getCoordinatedEmissionTargets(): CoordinatedEmissionTargetBuilder[];
12
+ }
13
+ //# sourceMappingURL=SpecialAssetsLoaderEmitterPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecialAssetsLoaderEmitterPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEnD,OAAO,EACN,oBAAoB,EACpB,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,qCAAqC,EAC1C,MAAM,WAAW,CAAC;AAMnB,qBAAa,gCAAiC,SAAQ,oBAAoB;IAExE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,qBAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFxB,YACoB,WAAW,EAAE,qBAAqB,EACpC,MAAM,EAAE,qCAAqC,EAG9D;IAED,SAAgB,QAAQ,YAAI,gBAAgB,EAAW;IACvD,SAAgB,QAAQ,YAAI,gBAAgB,EAAW;IAEvD,IAAW,sBAAsB,WAEhC;IAEM,KAAK,CAAC,QAAQ,EAAE,QAAQ,QAyE9B;IAED,6BAA6B,IAAI,gCAAgC,EAAE,CAElE;CACD"}