@plaudit/webpack-extensions 3.21.2 → 4.0.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 (279) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/USER-GUIDE.md +2 -1
  3. package/dist/api/asset-information-emission.d.ts +74 -0
  4. package/dist/api/asset-information-emission.d.ts.map +1 -0
  5. package/dist/api/asset-information-emission.js +398 -0
  6. package/dist/api/asset-information-emission.js.map +1 -0
  7. package/dist/api/configuration.d.ts +102 -0
  8. package/dist/api/configuration.d.ts.map +1 -0
  9. package/dist/api/configuration.js +83 -0
  10. package/dist/api/configuration.js.map +1 -0
  11. package/dist/api/coordinatable-emitter.d.ts +27 -0
  12. package/dist/api/coordinatable-emitter.d.ts.map +1 -0
  13. package/dist/api/coordinatable-emitter.js +20 -0
  14. package/dist/api/coordinatable-emitter.js.map +1 -0
  15. package/dist/api/entries/dependencies.d.ts +69 -0
  16. package/dist/api/entries/dependencies.d.ts.map +1 -0
  17. package/dist/api/entries/dependencies.js +61 -0
  18. package/dist/api/entries/dependencies.js.map +1 -0
  19. package/dist/api/entries/flag-logic.d.ts +37 -0
  20. package/dist/api/entries/flag-logic.d.ts.map +1 -0
  21. package/dist/api/entries/flag-logic.js +110 -0
  22. package/dist/api/entries/flag-logic.js.map +1 -0
  23. package/dist/api/entries/identifiers.d.ts +84 -0
  24. package/dist/api/entries/identifiers.d.ts.map +1 -0
  25. package/dist/api/entries/identifiers.js +590 -0
  26. package/dist/api/entries/identifiers.js.map +1 -0
  27. package/dist/api/entries/index.d.ts +6 -0
  28. package/dist/api/entries/index.d.ts.map +1 -0
  29. package/dist/{plugins → api/entries}/index.js +6 -8
  30. package/dist/api/entries/index.js.map +1 -0
  31. package/dist/api/entries/locations.d.ts +135 -0
  32. package/dist/api/entries/locations.d.ts.map +1 -0
  33. package/dist/api/entries/locations.js +174 -0
  34. package/dist/api/entries/locations.js.map +1 -0
  35. package/dist/api/entries/manager.d.ts +12 -0
  36. package/dist/api/entries/manager.d.ts.map +1 -0
  37. package/dist/api/entries/manager.js +35 -0
  38. package/dist/api/entries/manager.js.map +1 -0
  39. package/dist/api/handle-derivation.d.ts +32 -0
  40. package/dist/api/handle-derivation.d.ts.map +1 -0
  41. package/dist/api/handle-derivation.js +77 -0
  42. package/dist/api/handle-derivation.js.map +1 -0
  43. package/dist/api/index.d.ts +7 -0
  44. package/dist/api/index.d.ts.map +1 -0
  45. package/dist/api/index.js +23 -0
  46. package/dist/api/index.js.map +1 -0
  47. package/dist/api/shared-types.d.ts +86 -0
  48. package/dist/api/shared-types.d.ts.map +1 -0
  49. package/dist/api/shared-types.js +3 -0
  50. package/dist/api/shared-types.js.map +1 -0
  51. package/dist/internal-utils/auto-registering-plugins-loader.d.ts +3 -0
  52. package/dist/internal-utils/auto-registering-plugins-loader.d.ts.map +1 -0
  53. package/dist/internal-utils/auto-registering-plugins-loader.js +42 -0
  54. package/dist/internal-utils/auto-registering-plugins-loader.js.map +1 -0
  55. package/dist/internal-utils/common-config-helpers.d.ts +14 -0
  56. package/dist/internal-utils/common-config-helpers.d.ts.map +1 -0
  57. package/dist/internal-utils/common-config-helpers.js +140 -0
  58. package/dist/internal-utils/common-config-helpers.js.map +1 -0
  59. package/dist/internal-utils/entrypoint-resolution-logic.d.ts +14 -0
  60. package/dist/internal-utils/entrypoint-resolution-logic.d.ts.map +1 -0
  61. package/dist/internal-utils/entrypoint-resolution-logic.js +223 -0
  62. package/dist/internal-utils/entrypoint-resolution-logic.js.map +1 -0
  63. package/dist/internal-utils/internal-pseudo-plugin.d.ts +6 -0
  64. package/dist/internal-utils/internal-pseudo-plugin.d.ts.map +1 -0
  65. package/dist/internal-utils/internal-pseudo-plugin.js +46 -0
  66. package/dist/internal-utils/internal-pseudo-plugin.js.map +1 -0
  67. package/dist/mocks/blocks.d.ts +32 -0
  68. package/dist/mocks/blocks.d.ts.map +1 -0
  69. package/dist/mocks/blocks.js +3 -0
  70. package/dist/mocks/blocks.js.map +1 -0
  71. package/dist/mocks/index.d.ts +2 -0
  72. package/dist/mocks/index.d.ts.map +1 -0
  73. package/dist/mocks/index.js +18 -0
  74. package/dist/mocks/index.js.map +1 -0
  75. package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts +4 -10
  76. package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts.map +1 -0
  77. package/dist/plugins/AdditionalDependencyInjectorPlugin.js +48 -47
  78. package/dist/plugins/AdditionalDependencyInjectorPlugin.js.map +1 -0
  79. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +1 -0
  80. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts.map +1 -0
  81. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js +1 -0
  82. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js.map +1 -0
  83. package/dist/plugins/PackageConfigSanityChecker.d.ts +1 -0
  84. package/dist/plugins/PackageConfigSanityChecker.d.ts.map +1 -0
  85. package/dist/plugins/PackageConfigSanityChecker.js +1 -0
  86. package/dist/plugins/PackageConfigSanityChecker.js.map +1 -0
  87. package/dist/plugins/RootCoordinatorPluginImpl.d.ts +56 -0
  88. package/dist/plugins/RootCoordinatorPluginImpl.d.ts.map +1 -0
  89. package/dist/plugins/RootCoordinatorPluginImpl.js +767 -0
  90. package/dist/plugins/RootCoordinatorPluginImpl.js.map +1 -0
  91. package/dist/plugins/VariablesJSMonitorPlugin.d.ts +2 -1
  92. package/dist/plugins/VariablesJSMonitorPlugin.d.ts.map +1 -0
  93. package/dist/plugins/VariablesJSMonitorPlugin.js +1 -0
  94. package/dist/plugins/VariablesJSMonitorPlugin.js.map +1 -0
  95. package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.d.ts +25 -0
  96. package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.d.ts.map +1 -0
  97. package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.js +458 -0
  98. package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.js.map +1 -0
  99. package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.d.ts +29 -0
  100. package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.d.ts.map +1 -0
  101. package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.js +290 -0
  102. package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.js.map +1 -0
  103. package/dist/plugins/blocks/register.d.ts +6 -0
  104. package/dist/plugins/blocks/register.d.ts.map +1 -0
  105. package/dist/plugins/blocks/register.js +14 -0
  106. package/dist/plugins/blocks/register.js.map +1 -0
  107. package/dist/plugins/blocks/registerEmitter.d.ts +4 -0
  108. package/dist/plugins/blocks/registerEmitter.d.ts.map +1 -0
  109. package/dist/plugins/blocks/registerEmitter.js +13 -0
  110. package/dist/plugins/blocks/registerEmitter.js.map +1 -0
  111. package/dist/plugins/blocks/registerProcessor.d.ts +4 -0
  112. package/dist/plugins/blocks/registerProcessor.d.ts.map +1 -0
  113. package/dist/plugins/blocks/registerProcessor.js +46 -0
  114. package/dist/plugins/blocks/registerProcessor.js.map +1 -0
  115. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts +3 -2
  116. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts.map +1 -0
  117. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js +2 -1
  118. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js.map +1 -0
  119. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.d.ts +14 -0
  120. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.d.ts.map +1 -0
  121. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.js +191 -0
  122. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.js.map +1 -0
  123. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.d.ts +14 -0
  124. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.d.ts.map +1 -0
  125. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.js +102 -0
  126. package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.js.map +1 -0
  127. package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.d.ts +25 -0
  128. package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.d.ts.map +1 -0
  129. package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.js +229 -0
  130. package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.js.map +1 -0
  131. package/dist/plugins/extensions/register.d.ts +6 -0
  132. package/dist/plugins/extensions/register.d.ts.map +1 -0
  133. package/dist/plugins/extensions/register.js +14 -0
  134. package/dist/plugins/extensions/register.js.map +1 -0
  135. package/dist/plugins/extensions/registerEmitter.d.ts +4 -0
  136. package/dist/plugins/extensions/registerEmitter.d.ts.map +1 -0
  137. package/dist/plugins/extensions/registerEmitter.js +18 -0
  138. package/dist/plugins/extensions/registerEmitter.js.map +1 -0
  139. package/dist/plugins/extensions/registerProcessor.d.ts +4 -0
  140. package/dist/plugins/extensions/registerProcessor.d.ts.map +1 -0
  141. package/dist/plugins/extensions/registerProcessor.js +42 -0
  142. package/dist/plugins/extensions/registerProcessor.js.map +1 -0
  143. package/dist/plugins/plain/PlainEntrypointProcessingPlugin.d.ts +18 -0
  144. package/dist/plugins/plain/PlainEntrypointProcessingPlugin.d.ts.map +1 -0
  145. package/dist/plugins/plain/PlainEntrypointProcessingPlugin.js +203 -0
  146. package/dist/plugins/plain/PlainEntrypointProcessingPlugin.js.map +1 -0
  147. package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.d.ts +13 -0
  148. package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.d.ts.map +1 -0
  149. package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.js +51 -0
  150. package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.js.map +1 -0
  151. package/dist/plugins/plain/register.d.ts +6 -0
  152. package/dist/plugins/plain/register.d.ts.map +1 -0
  153. package/dist/plugins/plain/register.js +14 -0
  154. package/dist/plugins/plain/register.js.map +1 -0
  155. package/dist/plugins/plain/registerEmitter.d.ts +4 -0
  156. package/dist/plugins/plain/registerEmitter.d.ts.map +1 -0
  157. package/dist/plugins/plain/registerEmitter.js +21 -0
  158. package/dist/plugins/plain/registerEmitter.js.map +1 -0
  159. package/dist/plugins/plain/registerProcessor.d.ts +4 -0
  160. package/dist/plugins/plain/registerProcessor.d.ts.map +1 -0
  161. package/dist/plugins/plain/registerProcessor.js +34 -0
  162. package/dist/plugins/plain/registerProcessor.js.map +1 -0
  163. package/dist/plugins/register.d.ts +3 -0
  164. package/dist/plugins/register.d.ts.map +1 -0
  165. package/dist/plugins/register.js +17 -0
  166. package/dist/plugins/register.js.map +1 -0
  167. package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.d.ts +20 -0
  168. package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.d.ts.map +1 -0
  169. package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.js +56 -0
  170. package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.js.map +1 -0
  171. package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.d.ts +13 -0
  172. package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.d.ts.map +1 -0
  173. package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.js +105 -0
  174. package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.js.map +1 -0
  175. package/dist/plugins/special-assets/register.d.ts +6 -0
  176. package/dist/plugins/special-assets/register.d.ts.map +1 -0
  177. package/dist/plugins/special-assets/register.js +14 -0
  178. package/dist/plugins/special-assets/register.js.map +1 -0
  179. package/dist/plugins/special-assets/registerEmitter.d.ts +4 -0
  180. package/dist/plugins/special-assets/registerEmitter.d.ts.map +1 -0
  181. package/dist/plugins/special-assets/registerEmitter.js +15 -0
  182. package/dist/plugins/special-assets/registerEmitter.js.map +1 -0
  183. package/dist/plugins/special-assets/registerProcessor.d.ts +4 -0
  184. package/dist/plugins/special-assets/registerProcessor.d.ts.map +1 -0
  185. package/dist/plugins/special-assets/registerProcessor.js +15 -0
  186. package/dist/plugins/special-assets/registerProcessor.js.map +1 -0
  187. package/dist/plugins/unified-loader/UnifiedLoaderGenerator.d.ts +22 -0
  188. package/dist/plugins/unified-loader/UnifiedLoaderGenerator.d.ts.map +1 -0
  189. package/dist/plugins/unified-loader/UnifiedLoaderGenerator.js +95 -0
  190. package/dist/plugins/unified-loader/UnifiedLoaderGenerator.js.map +1 -0
  191. package/dist/plugins/wpml-config/WPMLConfigBuilder.d.ts +24 -0
  192. package/dist/plugins/wpml-config/WPMLConfigBuilder.d.ts.map +1 -0
  193. package/dist/plugins/{WPMLConfigBuilder.js → wpml-config/WPMLConfigBuilder.js} +123 -53
  194. package/dist/plugins/wpml-config/WPMLConfigBuilder.js.map +1 -0
  195. package/dist/plugins/wpml-config/register.d.ts +6 -0
  196. package/dist/plugins/wpml-config/register.d.ts.map +1 -0
  197. package/dist/plugins/wpml-config/register.js +25 -0
  198. package/dist/plugins/wpml-config/register.js.map +1 -0
  199. package/dist/shared.d.ts +10 -283
  200. package/dist/shared.d.ts.map +1 -0
  201. package/dist/shared.js +32 -405
  202. package/dist/shared.js.map +1 -0
  203. package/dist/utils/error-helpers.d.ts +7 -0
  204. package/dist/utils/error-helpers.d.ts.map +1 -0
  205. package/dist/utils/error-helpers.js +73 -0
  206. package/dist/utils/error-helpers.js.map +1 -0
  207. package/dist/utils/index.d.ts +6 -0
  208. package/dist/utils/index.d.ts.map +1 -0
  209. package/dist/utils/index.js +22 -0
  210. package/dist/utils/index.js.map +1 -0
  211. package/dist/utils/misc.d.ts +4 -0
  212. package/dist/utils/misc.d.ts.map +1 -0
  213. package/dist/utils/misc.js +18 -0
  214. package/dist/utils/misc.js.map +1 -0
  215. package/dist/utils/path-helpers.d.ts +16 -0
  216. package/dist/utils/path-helpers.d.ts.map +1 -0
  217. package/dist/utils/path-helpers.js +115 -0
  218. package/dist/utils/path-helpers.js.map +1 -0
  219. package/dist/utils/pseudo-semaphore.d.ts +1 -0
  220. package/dist/utils/pseudo-semaphore.d.ts.map +1 -0
  221. package/dist/utils/pseudo-semaphore.js +3 -5
  222. package/dist/utils/pseudo-semaphore.js.map +1 -0
  223. package/dist/utils/type-helpers.d.ts +27 -0
  224. package/dist/utils/type-helpers.d.ts.map +1 -0
  225. package/dist/utils/type-helpers.js +33 -0
  226. package/dist/utils/type-helpers.js.map +1 -0
  227. package/dist/utils/writer-utils.d.ts +8 -0
  228. package/dist/utils/writer-utils.d.ts.map +1 -0
  229. package/dist/utils/writer-utils.js +35 -0
  230. package/dist/utils/writer-utils.js.map +1 -0
  231. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts +2 -1
  232. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts.map +1 -0
  233. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js +5 -7
  234. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js.map +1 -0
  235. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts +1 -0
  236. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts.map +1 -0
  237. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js +1 -0
  238. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js.map +1 -0
  239. package/dist/wordpress-scripts-wrapper.d.ts +3 -2
  240. package/dist/wordpress-scripts-wrapper.d.ts.map +1 -0
  241. package/dist/wordpress-scripts-wrapper.js +137 -391
  242. package/dist/wordpress-scripts-wrapper.js.map +1 -0
  243. package/package.json +28 -50
  244. package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.d.ts +0 -25
  245. package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.js +0 -86
  246. package/dist/plugins/AbstractBiPhasicGroupPlugin.d.ts +0 -31
  247. package/dist/plugins/AbstractBiPhasicGroupPlugin.js +0 -91
  248. package/dist/plugins/EnhancedBlockJSONPlugin.d.ts +0 -47
  249. package/dist/plugins/EnhancedBlockJSONPlugin.js +0 -657
  250. package/dist/plugins/EnhancedDynamicEntryPlugin.d.ts +0 -8
  251. package/dist/plugins/EnhancedDynamicEntryPlugin.js +0 -14
  252. package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.d.ts +0 -20
  253. package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.js +0 -191
  254. package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.d.ts +0 -9
  255. package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.js +0 -45
  256. package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.d.ts +0 -6
  257. package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.js +0 -13
  258. package/dist/plugins/MixableBiPhasicGroupPlugin.d.ts +0 -6
  259. package/dist/plugins/MixableBiPhasicGroupPlugin.js +0 -13
  260. package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.d.ts +0 -26
  261. package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +0 -392
  262. package/dist/plugins/SpecialAssetHandlingPlugin.d.ts +0 -12
  263. package/dist/plugins/SpecialAssetHandlingPlugin.js +0 -134
  264. package/dist/plugins/UnifiedLoaderGenerator.d.ts +0 -21
  265. package/dist/plugins/UnifiedLoaderGenerator.js +0 -144
  266. package/dist/plugins/WPMLConfigBuilder.d.ts +0 -17
  267. package/dist/plugins/index.d.ts +0 -8
  268. package/dist/plugins/static-configs.d.ts +0 -3
  269. package/dist/plugins/static-configs.js +0 -44
  270. package/dist/utils/common-config-helpers.d.ts +0 -28
  271. package/dist/utils/common-config-helpers.js +0 -489
  272. package/dist/utils/css-writer.d.ts +0 -4
  273. package/dist/utils/css-writer.js +0 -46
  274. package/dist/utils/entrypoint-resolution-logic.d.ts +0 -13
  275. package/dist/utils/entrypoint-resolution-logic.js +0 -82
  276. package/dist/utils/location-encoding-filename-parser.d.ts +0 -30
  277. package/dist/utils/location-encoding-filename-parser.js +0 -120
  278. package/dist/utils/path-query-and-related-helpers.d.ts +0 -64
  279. package/dist/utils/path-query-and-related-helpers.js +0 -269
@@ -0,0 +1,102 @@
1
+ import { AsyncParallelHook, AsyncSeriesHook, SyncBailHook } from "tapable";
2
+ import type { Configuration, WebpackPluginInstance } from "webpack";
3
+ import type { RootCoordinatorPlugin } from "./coordinatable-emitter";
4
+ import type { EntrypointField } from "./entries";
5
+ import type { VerifiedAdvancedDestinationConfig, VerifiedPlauditWordpressWebpackConfig } from "./shared-types";
6
+ export interface AutoRegisteringPlugin {
7
+ readonly plauditWebpackExtensionsPlugin: true;
8
+ register(wrapperManager: WrapperManager): void | Promise<void>;
9
+ }
10
+ export declare function isAutoRegisteringPlugin(thing: unknown): thing is AutoRegisteringPlugin;
11
+ export type ResolvedDestination = {
12
+ srcRoots: string[];
13
+ src: string;
14
+ dest: VerifiedAdvancedDestinationConfig;
15
+ } & ({
16
+ srcRoot: string | [string, ...string[]];
17
+ srcIsDirectory: false;
18
+ } | {
19
+ srcRoot: string;
20
+ srcIsDirectory: true;
21
+ });
22
+ export type ConfigLevelProps = {
23
+ config: VerifiedPlauditWordpressWebpackConfig;
24
+ hasAnyNonModuleBuilds: boolean;
25
+ webpackConfig: Omit<Configuration, 'plugins'>;
26
+ };
27
+ export type WPConfigFinalizeProps = Omit<ConfigLevelProps, 'webpackConfig'> & {
28
+ isProductionBuild: boolean;
29
+ };
30
+ export declare class WrapperManager {
31
+ readonly coordinator: RootCoordinatorPlugin;
32
+ readonly config: Readonly<VerifiedPlauditWordpressWebpackConfig>;
33
+ readonly hooks: {
34
+ readonly webpackConfig: {
35
+ /**
36
+ * This is used to modify the module rules for Webpack.
37
+ * It is intended to allow plugins to fix up issues that can come from how WordPress configures the rules by default and to patch in additional file handling.
38
+ * It uses immer to ensure that the changes cannot be leaked to other {@link Configuration} instances.
39
+ * It fires once per Webpack {@link Configuration}.
40
+ */
41
+ readonly rules: AsyncSeriesHook<[("" | "..." | 0 | false | import("webpack").RuleSetRule | null | undefined)[], ConfigLevelProps & RulesTimeConfig], import("tapable").UnsetAdditionalOptions>;
42
+ /**
43
+ * This is used to allow for modifying the Webpack {@link Configuration} after everything else is done.
44
+ * It uses immer to ensure that the changes cannot be leaked to other {@link Configuration} instances.
45
+ * It fires once per Webpack {@link Configuration}.
46
+ */
47
+ readonly finalize: AsyncSeriesHook<[Configuration, WPConfigFinalizeProps], import("tapable").UnsetAdditionalOptions>;
48
+ };
49
+ /**
50
+ * This is used to set up the taps for each batch. It fires once per {@link IndividualBatchProcessor}
51
+ */
52
+ readonly batch: AsyncSeriesHook<[IndividualBatchProcessor, ConfigLevelProps], import("tapable").UnsetAdditionalOptions>;
53
+ };
54
+ readonly emitterPlugins: ((props: ConfigLevelProps, item: ResolvedDestination, destinationHandler: DestinationHandler) => undefined | WebpackPluginInstance | WebpackPluginInstance[])[];
55
+ readonly supportedSourceTypes: Set<string>;
56
+ constructor(coordinator: RootCoordinatorPlugin, config: Readonly<VerifiedPlauditWordpressWebpackConfig>);
57
+ }
58
+ export type WebpackRules = NonNullable<NonNullable<Configuration['module']>['rules']>;
59
+ export type RulesTimeConfig = {
60
+ getVariableValue: (name: string) => unknown;
61
+ entrypointFields: ReadonlyArray<EntrypointField>;
62
+ scriptExtension: RegExp;
63
+ };
64
+ export type DestinationHandler = {
65
+ sourceType: string;
66
+ plugin?: WebpackPluginInstance | WebpackPluginInstance[];
67
+ supportsAssetCopying?: boolean;
68
+ };
69
+ export declare class IndividualBatchProcessor {
70
+ readonly plugins: readonly WebpackPluginInstance[];
71
+ readonly canClean: boolean;
72
+ readonly hasAnyNonModuleBuilds: boolean;
73
+ readonly entrypointFields: ReadonlyArray<EntrypointField>;
74
+ readonly scriptExtension: RegExp;
75
+ readonly hooks: {
76
+ /**
77
+ * This fires before the batch has been processed to allow logic that should be executed in parallel to be used without making the batch hook parallel
78
+ */
79
+ readonly beforeBatch: AsyncParallelHook<[], import("tapable").UnsetAdditionalOptions>;
80
+ /**
81
+ * Fires before the destination handler has been resolved. This fires regardless of whether the resolution is successful.
82
+ */
83
+ readonly beforeDestinationHandler: AsyncParallelHook<[ResolvedDestination], import("tapable").UnsetAdditionalOptions>;
84
+ /**
85
+ * Used to determine the logic that will handle the ResolvedDestination. If none of the taps returns anything, the destination is skipped.
86
+ */
87
+ readonly destinationHandler: SyncBailHook<[ResolvedDestination], DestinationHandler | undefined, import("tapable").UnsetAdditionalOptions>;
88
+ /**
89
+ * Fires after the destination handler has been resolved. This DOES NOT fire if the resolution was unsuccessful.
90
+ * This is intended for use in adding plugins that do additional processing work like {@link CopyPlugin}
91
+ */
92
+ readonly afterDestinationHandler: AsyncSeriesHook<[ResolvedDestination, DestinationHandler | undefined], import("tapable").UnsetAdditionalOptions>;
93
+ /**
94
+ * Fires after the batch has been processed, but before it is finalized into a single config object.
95
+ * This is intended to allow logic that collects data over the course of the batch being processed to use it
96
+ */
97
+ readonly afterBatch: AsyncSeriesHook<[WebpackPluginInstance[]], import("tapable").UnsetAdditionalOptions>;
98
+ };
99
+ readonly metadata: Map<unknown, unknown>;
100
+ constructor(plugins: readonly WebpackPluginInstance[], canClean: boolean, hasAnyNonModuleBuilds: boolean, entrypointFields: ReadonlyArray<EntrypointField>, scriptExtension: RegExp);
101
+ }
102
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/api/configuration.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AACzE,OAAO,KAAK,EAAC,aAAa,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAElE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAC;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e,CAAC,EAChD,eAAe,EAAE,MAAM,EACpC;CACJ"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IndividualBatchProcessor = exports.WrapperManager = void 0;
4
+ exports.isAutoRegisteringPlugin = isAutoRegisteringPlugin;
5
+ const tapable_1 = require("tapable");
6
+ function isAutoRegisteringPlugin(thing) {
7
+ return !!thing && typeof thing === 'object' &&
8
+ 'plauditWebpackExtensionsPlugin' in thing && thing.plauditWebpackExtensionsPlugin === true &&
9
+ 'register' in thing && typeof thing.register === 'function';
10
+ }
11
+ class WrapperManager {
12
+ coordinator;
13
+ config;
14
+ hooks = {
15
+ webpackConfig: {
16
+ /**
17
+ * This is used to modify the module rules for Webpack.
18
+ * It is intended to allow plugins to fix up issues that can come from how WordPress configures the rules by default and to patch in additional file handling.
19
+ * It uses immer to ensure that the changes cannot be leaked to other {@link Configuration} instances.
20
+ * It fires once per Webpack {@link Configuration}.
21
+ */
22
+ rules: new tapable_1.AsyncSeriesHook(["rules", "rulesTimeConfig"], "webpackConfigRules"),
23
+ /**
24
+ * This is used to allow for modifying the Webpack {@link Configuration} after everything else is done.
25
+ * It uses immer to ensure that the changes cannot be leaked to other {@link Configuration} instances.
26
+ * It fires once per Webpack {@link Configuration}.
27
+ */
28
+ finalize: new tapable_1.AsyncSeriesHook(["webpackConfig", "props"], "webpackConfigFinalize"),
29
+ },
30
+ /**
31
+ * This is used to set up the taps for each batch. It fires once per {@link IndividualBatchProcessor}
32
+ */
33
+ batch: new tapable_1.AsyncSeriesHook(["batch", "props"]),
34
+ };
35
+ emitterPlugins = [];
36
+ supportedSourceTypes = new Set();
37
+ constructor(coordinator, config) {
38
+ this.coordinator = coordinator;
39
+ this.config = config;
40
+ }
41
+ }
42
+ exports.WrapperManager = WrapperManager;
43
+ class IndividualBatchProcessor {
44
+ plugins;
45
+ canClean;
46
+ hasAnyNonModuleBuilds;
47
+ entrypointFields;
48
+ scriptExtension;
49
+ hooks = {
50
+ /**
51
+ * This fires before the batch has been processed to allow logic that should be executed in parallel to be used without making the batch hook parallel
52
+ */
53
+ beforeBatch: new tapable_1.AsyncParallelHook([], "beforeBatch"),
54
+ /**
55
+ * Fires before the destination handler has been resolved. This fires regardless of whether the resolution is successful.
56
+ */
57
+ beforeDestinationHandler: new tapable_1.AsyncParallelHook(["item"], "beforeDestinationHandler"),
58
+ /**
59
+ * Used to determine the logic that will handle the ResolvedDestination. If none of the taps returns anything, the destination is skipped.
60
+ */
61
+ destinationHandler: new tapable_1.SyncBailHook(["item"], "destinationHandler"),
62
+ /**
63
+ * Fires after the destination handler has been resolved. This DOES NOT fire if the resolution was unsuccessful.
64
+ * This is intended for use in adding plugins that do additional processing work like {@link CopyPlugin}
65
+ */
66
+ afterDestinationHandler: new tapable_1.AsyncSeriesHook(["item", "destinationHandler"], "afterDestinationHandler"),
67
+ /**
68
+ * Fires after the batch has been processed, but before it is finalized into a single config object.
69
+ * This is intended to allow logic that collects data over the course of the batch being processed to use it
70
+ */
71
+ afterBatch: new tapable_1.AsyncSeriesHook(["plugins"], "afterBatch"),
72
+ };
73
+ metadata = new Map();
74
+ constructor(plugins, canClean, hasAnyNonModuleBuilds, entrypointFields, scriptExtension) {
75
+ this.plugins = plugins;
76
+ this.canClean = canClean;
77
+ this.hasAnyNonModuleBuilds = hasAnyNonModuleBuilds;
78
+ this.entrypointFields = entrypointFields;
79
+ this.scriptExtension = scriptExtension;
80
+ }
81
+ }
82
+ exports.IndividualBatchProcessor = IndividualBatchProcessor;
83
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/api/configuration.ts"],"names":[],"mappings":";;;;AACA,qCAAyE;AAWzE,iCAAwC,KAAc;IACrD,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC1C,gCAAgC,IAAI,KAAK,IAAI,KAAK,CAAC,8BAA8B,KAAK,IAAI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IAEvD,YACiB,OAAyC,EACzC,QAAiB,EACjB,qBAA8B,EAC9B,gBAAgD,EAChD,eAAuB;uBAJvB,OAAO;wBACP,QAAQ;qCACR,qBAAqB;gCACrB,gBAAgB;+BAChB,eAAe;IAC7B,CAAC;CACJ"}
@@ -0,0 +1,27 @@
1
+ import type { Compilation, Compiler, Configuration, WebpackPluginInstance } from "webpack";
2
+ import type { UnifiedAssetsCacheEntry } from "./asset-information-emission";
3
+ import { makeEntryManager } from "./entries";
4
+ export type CoordinatedEmissionTargetBuilder = Readonly<[string, (baseConfig: Configuration, coordinator: RootCoordinatorPlugin) => Configuration]>;
5
+ /**
6
+ * NOTE: Each instance of a given plugin MUST be restricted to a single compiler
7
+ */
8
+ export declare abstract class CoordinatableEmitter implements WebpackPluginInstance {
9
+ abstract getCoordinatedEmissionTargets(): CoordinatedEmissionTargetBuilder[];
10
+ protected abstract readonly coordinator: RootCoordinatorPlugin;
11
+ abstract readonly provides: ReadonlyArray<string>;
12
+ abstract readonly requires: ReadonlyArray<string>;
13
+ abstract readonly defaultCompilationName: string | undefined;
14
+ apply(compiler: Compiler): void;
15
+ makeEntryManager(compiler: Compiler, compilation: Compilation, context: string, coordinatedLoaderName?: string | undefined): ReturnType<typeof makeEntryManager>;
16
+ }
17
+ export interface RootCoordinatorPlugin extends WebpackPluginInstance {
18
+ enableAssetPhpFileEmission(coordinatedLoaderName: string): void;
19
+ /**
20
+ * This is called automatically from within {@link CoordinatableEmitter#apply()}
21
+ */
22
+ registerDataEmitter(compiler: Compiler, emitter: CoordinatableEmitter, ...emissionTargets: string[]): void;
23
+ reportData(compilation: Compilation, emitter: CoordinatableEmitter, emissionTarget: string, data: Record<string, unknown> | unknown[]): void;
24
+ getHandles(compilation: Compilation): Promise<Record<string, UnifiedAssetsCacheEntry>>;
25
+ getData<T extends Record<string, unknown> | unknown[]>(emissionTarget: string): T[];
26
+ }
27
+ //# sourceMappingURL=coordinatable-emitter.d.ts.map
@@ -0,0 +1 @@
1
+ {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AC;IAE3G,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAE3I,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAEvF,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAC,OAAO,EAAE,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;CAClF"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CoordinatableEmitter = void 0;
4
+ const entries_1 = require("./entries");
5
+ /**
6
+ * NOTE: Each instance of a given plugin MUST be restricted to a single compiler
7
+ */
8
+ class CoordinatableEmitter {
9
+ apply(compiler) {
10
+ this.coordinator.registerDataEmitter(compiler, this, ...this.provides);
11
+ }
12
+ makeEntryManager(compiler, compilation, context, coordinatedLoaderName = this.provides[0]) {
13
+ if (coordinatedLoaderName === undefined) {
14
+ throw new Error("A coordinated emitter name was somehow not provided. Please report this to Josh immediately");
15
+ }
16
+ return (0, entries_1.makeEntryManager)(compiler, compilation, context, coordinatedLoaderName);
17
+ }
18
+ }
19
+ exports.CoordinatableEmitter = CoordinatableEmitter;
20
+ //# sourceMappingURL=coordinatable-emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinatable-emitter.js","sourceRoot":"","sources":["../../src/api/coordinatable-emitter.ts"],"names":[],"mappings":";;;AAGA,uCAA2C;AAI3C;;GAEG;AACH;IASC,KAAK,CAAC,QAAkB;QACvB,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED,gBAAgB,CAAC,QAAkB,EAAE,WAAwB,EAAE,OAAe,EAAE,qBAAqB,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvH,IAAI,qBAAqB,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAC;QAChH,CAAC;QACD,OAAO,IAAA,0BAAgB,EAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAChF,CAAC;CACD"}
@@ -0,0 +1,69 @@
1
+ import type { EntryOptionPlugin, Entrypoint } from "webpack";
2
+ import type { BaseHandleData, UnifiedAssetsCacheEntry } from "../asset-information-emission";
3
+ import { type HandleAndDerivationMechanism, type HandleDerivationMechanism } from "../handle-derivation";
4
+ import type { NormalizedEnqueuingControlFlags } from "./flag-logic";
5
+ import { type EnqueuedAssetType, type EntrypointField, type NormalizedUsageLocations } from "./locations";
6
+ export type MinEntryInfo = {
7
+ absoluteSrc: string;
8
+ name: string;
9
+ type: EnqueuedAssetType;
10
+ };
11
+ export type EntryOptions = ReturnType<typeof EntryOptionPlugin.entryDescriptionToOptions>;
12
+ type PlauditEntryExtras = MinEntryInfo & {
13
+ flags: NormalizedEnqueuingControlFlags;
14
+ locations: NormalizedUsageLocations;
15
+ additionalDependencies: string[];
16
+ initialHandleName: HandleAndDerivationMechanism | false;
17
+ additionalSrcs?: string[];
18
+ baseDestination: string;
19
+ coordinatedLoaderName?: string;
20
+ staticallyLoaded?: boolean;
21
+ /**
22
+ * Defaults to false; note: this function returning true DOES NOT mean that the asset WILL be inlined - it just means that it MAY be inlined
23
+ */
24
+ mayInline?: (file: string, options: PlauditEntryOptions) => boolean;
25
+ /**
26
+ * This defaults to true if the asset is not going to be inlined and false otherwise
27
+ */
28
+ writeToDisk?: (file: string, options: PlauditEntryOptions) => boolean;
29
+ shouldOmitRegistration?: boolean;
30
+ computedHandleName?: string;
31
+ computedHandleArguments?: BaseHandleData['rest'];
32
+ intermediateInlineConfig?: {
33
+ deleteWhenDone: boolean;
34
+ };
35
+ };
36
+ export type NoOverrides<T extends object, Reserved> = Extract<keyof T, keyof Reserved> extends never ? T : never;
37
+ export type PlauditEntryOptions<T extends object = object> = PlauditEntryExtras & EntryOptions & NoOverrides<T, PlauditEntryExtras | EntryOptions | 'handleConfig'>;
38
+ export type HandleConfig<T extends PlauditEntryOptions = PlauditEntryOptions> = string | ((generatedHandle: string, options: Omit<T, 'initialHandleName'>) => string | undefined | HandleAndDerivationMechanism) | {
39
+ niceName: string;
40
+ fallbackNiceName?: string;
41
+ derivation?: HandleDerivationMechanism;
42
+ };
43
+ export type MinPlauditEntryOptions<T extends PlauditEntryOptions = PlauditEntryOptions> = Omit<T, Exclude<keyof EntryOptions, 'name'> | 'initialHandleName'>;
44
+ export declare function makePlauditEntryOptions<T extends PlauditEntryOptions>(handleConfig: HandleConfig<T> | undefined, handlePrefix: string, handleSuffix: string, options: Omit<T, 'initialHandleName'>): Omit<T, 'initialHandleName'> & {
45
+ initialHandleName: HandleAndDerivationMechanism;
46
+ };
47
+ export declare function isPlauditEntryOptions(options: object | undefined): options is PlauditEntryOptions;
48
+ export declare function getPlauditEntryOptions(entrypoint: Entrypoint): PlauditEntryOptions | undefined;
49
+ export type BlockEntryOptions = PlauditEntryOptions<{
50
+ blockJsonAssetAbsoluteSrc: string;
51
+ originalEntrypointFieldValue?: string;
52
+ entrypointField: EntrypointField;
53
+ }>;
54
+ export declare function isBlockEntryOptions(options: PlauditEntryOptions): options is BlockEntryOptions;
55
+ export declare function isBlockEntryOptionsHolder(entry: UnifiedAssetsCacheEntry): entry is UnifiedAssetsCacheEntry<BlockEntryOptions>;
56
+ export type ExtensionEntryOptions = PlauditEntryOptions<{
57
+ blockSlug: string;
58
+ entrypointField: EntrypointField;
59
+ }>;
60
+ export declare function isExtensionEntryOptions(options: PlauditEntryOptions): options is ExtensionEntryOptions;
61
+ export declare function isExtensionEntryOptionsHolder(entry: UnifiedAssetsCacheEntry): entry is UnifiedAssetsCacheEntry<ExtensionEntryOptions>;
62
+ export type ObjectEntrypointJsonParseResult = {
63
+ entrypointName: string;
64
+ filename: string;
65
+ additionalSrcFilenames?: string[];
66
+ };
67
+ export declare function parseEntrypointsJson(entrypointsJsonPath: string): Promise<(string | ObjectEntrypointJsonParseResult)[]>;
68
+ export {};
69
+ //# sourceMappingURL=dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/api/entries/dependencies.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,iBAAiB,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAC,cAAc,EAAE,uBAAuB,EAAC,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAuC,KAAK,4BAA4B,EAAE,KAAK,yBAAyB,EAAC,MAAM,sBAAsB,CAAC;AAE7I,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,cAAc,CAAC;AAClE,OAAO,EAAC,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAA0C,KAAK,wBAAwB,EAAC,MAAM,aAAa,CAAC;AAEhJ,MAAM,MAAM,YAAY,GAAG;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAC,CAAC;AACxF,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;AAC1F,KAAK,kBAAkB,GAAG,YAAY,GAAC;IACtC,KAAK,EAAE,+BAA+B,CAAC;IACvC,SAAS,EAAE,wBAAwB,CAAC;IACpC,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,iBAAiB,EAAE,4BAA4B,GAAC,KAAK,CAAC;IACtD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAG1B,eAAe,EAAE,MAAM,CAAC;IAGxB,qBAAqB,CAA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,MAAM,MAAM,+BAA+B,GAAG;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC;AAC5H,wBAAsB,oBAAoB,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,GAAC,+BAA+B,CAAC,EAAE,CAAC,CAmB3H"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePlauditEntryOptions = makePlauditEntryOptions;
4
+ exports.isPlauditEntryOptions = isPlauditEntryOptions;
5
+ exports.getPlauditEntryOptions = getPlauditEntryOptions;
6
+ exports.isBlockEntryOptions = isBlockEntryOptions;
7
+ exports.isBlockEntryOptionsHolder = isBlockEntryOptionsHolder;
8
+ exports.isExtensionEntryOptions = isExtensionEntryOptions;
9
+ exports.isExtensionEntryOptionsHolder = isExtensionEntryOptionsHolder;
10
+ exports.parseEntrypointsJson = parseEntrypointsJson;
11
+ const promises_1 = require("node:fs/promises");
12
+ const utils_1 = require("../../utils");
13
+ const handle_derivation_1 = require("../handle-derivation");
14
+ const locations_1 = require("./locations");
15
+ function makePlauditEntryOptions(handleConfig, handlePrefix, handleSuffix, options) {
16
+ return { ...options, initialHandleName: (0, handle_derivation_1.convertHandleConfigToEmittableHandle)(handleConfig, handlePrefix, handleSuffix, options) };
17
+ }
18
+ function isPlauditEntryOptions(options) {
19
+ return !!options &&
20
+ ('type' in options && (0, locations_1.isEnqueuedAssetType)(options.type)) &&
21
+ ('flags' in options && typeof options.flags === 'object' && !!options.flags) &&
22
+ ('locations' in options && typeof options.locations === 'object' && !!options.locations) &&
23
+ ('baseDestination' in options && typeof options.baseDestination === 'string');
24
+ }
25
+ function getPlauditEntryOptions(entrypoint) {
26
+ return isPlauditEntryOptions(entrypoint.options) ? entrypoint.options : undefined;
27
+ }
28
+ function isBlockEntryOptions(options) {
29
+ return ('blockJsonAssetAbsoluteSrc' in options && typeof options.blockJsonAssetAbsoluteSrc === 'string') &&
30
+ ('entrypointField' in options && (0, locations_1.isEntrypointField)(options.entrypointField));
31
+ }
32
+ function isBlockEntryOptionsHolder(entry) {
33
+ return isBlockEntryOptions(entry.options);
34
+ }
35
+ function isExtensionEntryOptions(options) {
36
+ return ('blockSlug' in options && typeof options.blockSlug === 'string') && ('entrypointField' in options && (0, locations_1.isEntrypointField)(options.entrypointField));
37
+ }
38
+ function isExtensionEntryOptionsHolder(entry) {
39
+ return isExtensionEntryOptions(entry.options);
40
+ }
41
+ async function parseEntrypointsJson(entrypointsJsonPath) {
42
+ const entrypointsJson = JSON.parse(await (0, promises_1.readFile)(entrypointsJsonPath, 'utf-8'));
43
+ if (Array.isArray(entrypointsJson)) {
44
+ return entrypointsJson;
45
+ }
46
+ //TODO: CONSIDER: While this is more correct than the prior behavior (which was ignoring the key), it could cause errors
47
+ return Object.entries(entrypointsJson)
48
+ .map(([key, value]) => {
49
+ if (!Array.isArray(value)) {
50
+ if (value.import !== undefined) {
51
+ value = value.import;
52
+ }
53
+ else {
54
+ return undefined;
55
+ }
56
+ }
57
+ return (0, utils_1.hasAtLeastOneItem)(value) ? { entrypointName: key, filename: value[0], additionalSrcFilenames: value.slice(1) } : undefined;
58
+ })
59
+ .filter(v => v !== undefined);
60
+ }
61
+ //# sourceMappingURL=dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/api/entries/dependencies.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+CAA0C;AAI1C,uCAA8C;AAE9C,4DAA6I;AAG7I,2CAAgJ;AA4ChJ,iCAAuE,YAAuC,EAAE,YAAoB,EAAE,YAAoB,EAAE,OAAqC;IAChM,OAAO,EAAC,GAAG,OAAO,EAAE,iBAAiB,EAAE,IAAA,wDAAoC,EAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,CAAC,EAAC,CAAC;AACj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;AAC/C,CAAC;AAGM,KAAK,+BAA+B,mBAA2B;IACrE,MAAM,eAAe,GAAoF,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,mBAAQ,EAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC;IAClK,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QACpC,OAAO,eAAe,CAAC;IACxB,CAAC;IAED,wHAAwH;IACxH,OAAO,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAA6C,EAAE;QAChE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAChC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACP,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,CAAC;QACD,OAAO,IAAA,yBAAiB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAE,EAAC,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,sBAAsB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5I,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,37 @@
1
+ declare const wordPressLoadingStrategies: readonly ['defer', 'async'];
2
+ declare const namedStrategies: readonly ["defer", "async", "eager", "lazy"];
3
+ export type LoadingStrategy = typeof namedStrategies[number];
4
+ export type WordPressSupportedLoadingStrategy = typeof wordPressLoadingStrategies[number];
5
+ export type ShorthandLoadingStrategy = Exclude<LoadingStrategy, WordPressSupportedLoadingStrategy>;
6
+ export declare function isValidNamedStrategy(strategy: unknown): strategy is LoadingStrategy;
7
+ export declare function isWordPressSupportedLoadingStrategy(strategy: unknown): strategy is WordPressSupportedLoadingStrategy;
8
+ export declare function newInvalidLoadingStrategyError(strategy: unknown, file?: string): import("webpack").WebpackError;
9
+ export declare function isDeferringLoadingStrategy(strategy: unknown): strategy is "async" | "defer";
10
+ export type InFooter = boolean;
11
+ export declare function isValidInFooter(in_footer: unknown): in_footer is InFooter;
12
+ export declare function invalidInFooterError(in_footer: unknown, file?: string): import("webpack").WebpackError;
13
+ declare const validFetchPriorities: readonly ["auto", "low", "high"];
14
+ export type FetchPriority = typeof validFetchPriorities[number];
15
+ export declare function isValidFetchPriority(fetchpriority: unknown): fetchpriority is FetchPriority;
16
+ export declare function newInvalidFetchPriorityError(fetchpriority: unknown, file?: string): import("webpack").WebpackError;
17
+ declare const validInliningPositionValues: readonly ['before', 'after'];
18
+ export type InliningPosition = typeof validInliningPositionValues[number];
19
+ export declare const defaultInliningPosition = "after";
20
+ export declare function isValidInliningPositionValue(position: unknown): position is InliningPosition;
21
+ export declare function newInvalidInliningPositionValueError(position: unknown, file?: string, useDefaultValueValue?: string): import("webpack").WebpackError;
22
+ export declare function isEnqueuingControlFlag(prop: string): prop is keyof NormalizedEnqueuingControlFlags;
23
+ export type NormalizedEnqueuingControlFlags = {
24
+ strategy?: WordPressSupportedLoadingStrategy;
25
+ in_footer?: InFooter;
26
+ inline?: InliningPosition;
27
+ fetchpriority?: FetchPriority;
28
+ };
29
+ export type EnqueuingControlFlags = {
30
+ [key in Exclude<keyof NormalizedEnqueuingControlFlags, 'strategy' | 'inline'>]?: NormalizedEnqueuingControlFlags[key] | false;
31
+ } & {
32
+ strategy?: LoadingStrategy | false;
33
+ inline?: boolean | InliningPosition;
34
+ };
35
+ export declare function normalizeAndMergeEnqueuingControlFlags(rawFlags: EnqueuingControlFlags | undefined, computedFlags: NormalizedEnqueuingControlFlags | undefined, file?: string): NormalizedEnqueuingControlFlags;
36
+ export {};
37
+ //# sourceMappingURL=flag-logic.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exports.isWordPressSupportedLoadingStrategy = isWordPressSupportedLoadingStrategy;
6
+ exports.newInvalidLoadingStrategyError = newInvalidLoadingStrategyError;
7
+ exports.isDeferringLoadingStrategy = isDeferringLoadingStrategy;
8
+ exports.isValidInFooter = isValidInFooter;
9
+ exports.invalidInFooterError = invalidInFooterError;
10
+ exports.isValidFetchPriority = isValidFetchPriority;
11
+ exports.newInvalidFetchPriorityError = newInvalidFetchPriorityError;
12
+ exports.isValidInliningPositionValue = isValidInliningPositionValue;
13
+ exports.newInvalidInliningPositionValueError = newInvalidInliningPositionValueError;
14
+ exports.isEnqueuingControlFlag = isEnqueuingControlFlag;
15
+ exports.normalizeAndMergeEnqueuingControlFlags = normalizeAndMergeEnqueuingControlFlags;
16
+ const utils_1 = require("../../utils");
17
+ const wordPressLoadingStrategies = ['defer', 'async'];
18
+ const namedStrategies = [...wordPressLoadingStrategies, 'eager', 'lazy'];
19
+ function isValidNamedStrategy(strategy) {
20
+ return namedStrategies.includes(strategy);
21
+ }
22
+ function isWordPressSupportedLoadingStrategy(strategy) {
23
+ return wordPressLoadingStrategies.includes(strategy);
24
+ }
25
+ function newInvalidLoadingStrategyError(strategy, file) {
26
+ return (0, utils_1.newWebpackErrorForFile)({
27
+ text: "The strategy value is invalid", received: strategy, expected: `boolean|'${namedStrategies.join("'|'")}'|undefined`, display: 'type'
28
+ }, file);
29
+ }
30
+ function isDeferringLoadingStrategy(strategy) {
31
+ return strategy === 'async' || strategy === 'defer';
32
+ }
33
+ function isValidInFooter(in_footer) {
34
+ return typeof in_footer === 'boolean';
35
+ }
36
+ function invalidInFooterError(in_footer, file) {
37
+ return (0, utils_1.newWebpackErrorForFile)({ text: "The in_footer value is invalid", received: in_footer, expected: "boolean|undefined", display: 'type' }, file);
38
+ }
39
+ const validFetchPriorities = ["auto", "low", "high"];
40
+ function isValidFetchPriority(fetchpriority) {
41
+ return validFetchPriorities.includes(fetchpriority);
42
+ }
43
+ function newInvalidFetchPriorityError(fetchpriority, file) {
44
+ return (0, utils_1.newWebpackErrorForFile)({ text: "The fetchpriority value is invalid", received: fetchpriority, expected: "'auto'|'low'|'high'|undefined", display: 'type' }, file);
45
+ }
46
+ const validInliningPositionValues = ['before', 'after'];
47
+ exports.defaultInliningPosition = 'after';
48
+ function isValidInliningPositionValue(position) {
49
+ return validInliningPositionValues.includes(position);
50
+ }
51
+ function newInvalidInliningPositionValueError(position, file, useDefaultValueValue = 'undefined') {
52
+ return (0, utils_1.newWebpackErrorForFile)({
53
+ text: "The inlining position value is invalid", received: position,
54
+ expected: `'${validInliningPositionValues.join("'|'")}'|${useDefaultValueValue}`, display: 'type'
55
+ }, file);
56
+ }
57
+ function isEnqueuingControlFlag(prop) {
58
+ return ['strategy', 'in_footer', 'inline', 'fetchpriority', 'lazyLoader'].includes(prop);
59
+ }
60
+ function normalizeAndMergeEnqueuingControlFlags(rawFlags, computedFlags, file) {
61
+ if (rawFlags === undefined || !Object.values(rawFlags).some(v => v !== undefined)) {
62
+ return computedFlags ?? {};
63
+ }
64
+ const res = computedFlags ? { ...computedFlags } : {};
65
+ if (rawFlags.strategy === 'eager') {
66
+ res.in_footer = false;
67
+ }
68
+ else if (rawFlags.strategy === 'lazy') {
69
+ res.strategy = 'defer';
70
+ res.in_footer = true;
71
+ }
72
+ else if (isWordPressSupportedLoadingStrategy(rawFlags.strategy)) {
73
+ res.strategy = rawFlags.strategy;
74
+ }
75
+ else if (rawFlags.strategy === false) {
76
+ delete res.strategy;
77
+ }
78
+ else if (rawFlags.strategy !== undefined) {
79
+ throw (0, utils_1.newWebpackErrorForFile)(`Encountered an unsupported strategy value: '${rawFlags.strategy}'. Please resolve the issue or report it immediately if you believe that this message is in incorrect`, file);
80
+ }
81
+ if (rawFlags.in_footer !== undefined) {
82
+ if (typeof rawFlags.in_footer !== 'boolean') {
83
+ throw (0, utils_1.newWebpackErrorForFile)(`Encountered an unsupported in_footer value: '${rawFlags.strategy}'. Please resolve the issue or report it immediately if you believe that this message is in incorrect`, file);
84
+ }
85
+ res.in_footer = rawFlags.in_footer;
86
+ }
87
+ if (rawFlags.inline === true) {
88
+ res.inline ??= exports.defaultInliningPosition;
89
+ }
90
+ else if (rawFlags.inline === false) {
91
+ delete res.inline;
92
+ }
93
+ else if (isValidInliningPositionValue(rawFlags.inline)) {
94
+ res.inline = rawFlags.inline;
95
+ }
96
+ else if (rawFlags.inline !== undefined) {
97
+ throw newInvalidInliningPositionValueError(rawFlags.inline, file, 'boolean|undefined');
98
+ }
99
+ if (rawFlags.fetchpriority === false) {
100
+ delete res.fetchpriority;
101
+ }
102
+ else if (isValidFetchPriority(rawFlags.fetchpriority)) {
103
+ res.fetchpriority = rawFlags.fetchpriority;
104
+ }
105
+ else if (rawFlags.fetchpriority !== undefined) {
106
+ throw newInvalidFetchPriorityError(rawFlags.fetchpriority, file);
107
+ }
108
+ return res;
109
+ }
110
+ //# sourceMappingURL=flag-logic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag-logic.js","sourceRoot":"","sources":["../../../src/api/entries/flag-logic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAmD;AAEnD,MAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAC/D,MAAM,eAAe,GAAG,CAAC,GAAG,0BAA0B,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAIlF,8BAAqC,QAAiB;IACrD,OAAQ,eAAsC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACnE,CAAC;AACD,6CAAoD,QAAiB;IACpE,OAAQ,0BAAiD,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AACD,wCAA+C,QAAiB,EAAE,IAAa;IAC9E,OAAO,IAAA,8BAAsB,EAAC;QAC7B,IAAI,EAAE,+BAA+B,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM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