@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,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./dependencies"), exports);
18
+ __exportStar(require("./flag-logic"), exports);
19
+ __exportStar(require("./identifiers"), exports);
20
+ __exportStar(require("./locations"), exports);
21
+ __exportStar(require("./manager"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/entries/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,+CAA6B;AAC7B,gDAA8B;AAC9B,8CAA4B;AAC5B,4CAA0B"}
@@ -0,0 +1,135 @@
1
+ import type { PHPWriter } from "@plaudit/php-writer";
2
+ import type { ScriptArgsObject } from "../asset-information-emission";
3
+ import type { HandleConfig } from "./dependencies";
4
+ import type { InliningPosition } from "./flag-logic";
5
+ type OptionalLocationMeta = {
6
+ supports_hook_name?: boolean;
7
+ additional_action_code?: {
8
+ before?(writer: PHPWriter): unknown;
9
+ after?(writer: PHPWriter): unknown;
10
+ };
11
+ alternate_names?: [string, ...string[]];
12
+ };
13
+ export declare const standardLocationNamesMeta: {
14
+ readonly clientView: {
15
+ readonly action: "wp_enqueue_scripts";
16
+ readonly alternate_names: ["client-view", "view"];
17
+ };
18
+ readonly clientEditor: {
19
+ readonly action: "enqueue_block_editor_assets";
20
+ readonly alternate_names: ["client-editor", "editor"];
21
+ };
22
+ readonly blockAssets: {
23
+ readonly action: "enqueue_block_assets";
24
+ readonly alternate_names: ["block-assets"];
25
+ };
26
+ readonly admin: {
27
+ readonly action: "admin_enqueue_scripts";
28
+ readonly supports_hook_name: true;
29
+ };
30
+ readonly login: {
31
+ readonly action: "login_enqueue_scripts";
32
+ };
33
+ readonly customizer: {
34
+ readonly action: "customize_controls_enqueue_scripts";
35
+ };
36
+ readonly analytics: {
37
+ readonly action: "plaudit_enqueue_analytics";
38
+ };
39
+ readonly lazyLoader: {
40
+ readonly action: false;
41
+ readonly supports_hook_name: true;
42
+ readonly alternate_names: ["lazy-loader"];
43
+ };
44
+ };
45
+ export type StandardLocationNameMeta = {
46
+ action: typeof standardLocationNamesMeta[keyof typeof standardLocationNamesMeta]['action'];
47
+ } & OptionalLocationMeta;
48
+ export type StandardLocationNames = keyof typeof standardLocationNamesMeta;
49
+ export declare function isStandardLocationName(name: string): name is StandardLocationNames;
50
+ export type LocationsWithHookNameSupport = {
51
+ [key in StandardLocationNames]: typeof standardLocationNamesMeta[key] extends {
52
+ supports_hook_name: true;
53
+ } ? key : never;
54
+ }[StandardLocationNames];
55
+ export declare function isLocationNameWithHookNameSupport(name: string): name is LocationsWithHookNameSupport;
56
+ export type LocationsWithActionSupport = {
57
+ [key in StandardLocationNames]: typeof standardLocationNamesMeta[key] extends {
58
+ action: false;
59
+ } ? never : key;
60
+ }[StandardLocationNames];
61
+ export declare function isLocationNameWithActionSupport(name: string): name is LocationsWithActionSupport;
62
+ export type LocationsWithActionAndHookNameSupport = {
63
+ [key in StandardLocationNames]: typeof standardLocationNamesMeta[key] extends {
64
+ supports_hook_name: true;
65
+ } ? typeof standardLocationNamesMeta[key] extends {
66
+ action: false;
67
+ } ? never : key : never;
68
+ }[StandardLocationNames];
69
+ export declare function iterableStandardLocationNamesMeta(): [StandardLocationNames, StandardLocationNameMeta][];
70
+ export declare function normalizeLocationName(name: string): StandardLocationNames | 'register' | undefined;
71
+ type LocationWithHookNameSupport = boolean | string | string[];
72
+ export type NormalizedLocationWithHookNameSupport = [string, ...string[]];
73
+ type LocationWithActionAndHookNameSupport = LocationWithHookNameSupport | number | {
74
+ hook_name?: string | string[];
75
+ priority?: number | true;
76
+ };
77
+ export type NormalizedLocationWithActionAndHookNameSupport = {
78
+ hook_name?: string[];
79
+ priority: number;
80
+ };
81
+ export type InputRegisterScriptArgs = ScriptArgsObject | 'lazy' | 'eager' | 'inline' | boolean;
82
+ export type RealUsageLocations = {
83
+ [K in StandardLocationNames]?: K extends LocationsWithHookNameSupport ? (K extends LocationsWithActionSupport ? LocationWithActionAndHookNameSupport : LocationWithHookNameSupport) : (K extends LocationsWithActionSupport ? boolean | number : never);
84
+ };
85
+ export type PseudoUsageLocations = {
86
+ register?: boolean | number;
87
+ };
88
+ export type DeprecatedUsageLocations = {
89
+ handle?: HandleConfig;
90
+ inline?: boolean | InliningPosition;
91
+ registerScriptArgs?: InputRegisterScriptArgs;
92
+ };
93
+ export type UsageLocations = RealUsageLocations & PseudoUsageLocations;
94
+ export type NormalizedUsageLocations = {
95
+ [K in keyof UsageLocations]?: K extends keyof typeof standardLocationNamesMeta ? K extends LocationsWithHookNameSupport ? (K extends LocationsWithActionSupport ? NormalizedLocationWithActionAndHookNameSupport : NormalizedLocationWithHookNameSupport) : (K extends LocationsWithActionSupport ? Exclude<UsageLocations[K], boolean> : never) : Exclude<UsageLocations[K], boolean>;
96
+ };
97
+ declare const enqueuedAssetTypes: readonly ['script', 'script_module', 'style'];
98
+ export type EnqueuedAssetType = typeof enqueuedAssetTypes[number];
99
+ export declare function isEnqueuedAssetType(value: unknown): value is EnqueuedAssetType;
100
+ export declare const entrypointFields: {
101
+ readonly editorStyle: 'non-module';
102
+ readonly viewStyle: 'non-module';
103
+ readonly style: 'non-module';
104
+ readonly editorScript: 'non-module';
105
+ readonly viewScript: 'non-module';
106
+ readonly script: 'non-module';
107
+ readonly viewScriptModule: 'module';
108
+ };
109
+ export type EntrypointField = keyof typeof entrypointFields;
110
+ export type EntrypointFields = EntrypointField[];
111
+ export declare function isEntrypointField(value: unknown): value is EntrypointField;
112
+ export declare function getLoadableEntrypointFields(processingModules: boolean): EntrypointFields;
113
+ export declare function convertEntrypointFieldForAssetType(entrypointField: EntrypointField, assetType: 'script' | 'style'): EntrypointField;
114
+ export declare function leadingSlashIt(pathOrSomething: string): string;
115
+ export declare const isScriptExtensionRegex: RegExp;
116
+ export declare const scriptExtension: RegExp;
117
+ export declare const scriptWithoutModuleExtension: RegExp;
118
+ export declare const scriptWithModuleExtension: RegExp;
119
+ export declare const styleExtension: RegExp;
120
+ export declare function scriptOrStyleTest(entryPath: string, scriptExtension: RegExp): "" | "script" | "style";
121
+ /**
122
+ * @return The first element is the name excluding the JS/CSS extension if it was present.
123
+ * The second element is either the extension (with a leading ".") if it was present or the empty string if it wasn't.
124
+ */
125
+ export declare function extractNameAndScriptOrStyleExt(assetPath: string): Readonly<[string, string]>;
126
+ export declare function isStyleField(field: string): field is 'style' | 'viewStyle' | 'editorStyle';
127
+ export declare function isScriptField(field: string): field is 'script' | 'viewScript' | 'editorScript';
128
+ export declare function isScriptModuleField(field: string): field is 'viewScriptModule';
129
+ export declare function getFieldType(field: string): EnqueuedAssetType;
130
+ export declare function getAssetType(assetPath: string): EnqueuedAssetType | false;
131
+ export declare function getHandleGroup(field: string): 'styleHandles' | 'scriptHandles' | 'scriptModuleHandles';
132
+ export declare function convertHookLocationToNamesAndPriority(hookLocation: NonNullable<Exclude<UsageLocations[keyof typeof standardLocationNamesMeta], false>>): [string[], number];
133
+ export declare function convertHookLocationToRawNamesAndPriority(hookLocation: NonNullable<Exclude<UsageLocations[keyof typeof standardLocationNamesMeta], false>>): [[string, ...string[]] | undefined, number | undefined];
134
+ export {};
135
+ //# sourceMappingURL=locations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../../../src/api/entries/locations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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,CAG5F;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,OAAO,GAAC,WAAW,GAAC,aAAa,CAEtF;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,GAAC,YAAY,GAAC,cAAc,CAE1F;AACD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,kBAAkB,CAE9E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAW7D;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAC,KAAK,CAEvE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAC,eAAe,GAAC,qBAAqB,CAQlG;AAED,wBAAgB,qCAAqC,CAAC,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,OAAO,yBAAyB,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAe3K;AAED,wBAAgB,wCAAwC,CACvD,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,OAAO,yBAAyB,CAAC,EAAE,KAAK,CAAC,CAAC,GAC/F,CAAC,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GAAC,SAAS,EAAE,MAAM,GAAC,SAAS,CAAC,CAkBrD"}
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.styleExtension = exports.scriptWithModuleExtension = exports.scriptWithoutModuleExtension = exports.scriptExtension = exports.isScriptExtensionRegex = exports.entrypointFields = exports.standardLocationNamesMeta = void 0;
4
+ exports.isStandardLocationName = isStandardLocationName;
5
+ exports.isLocationNameWithHookNameSupport = isLocationNameWithHookNameSupport;
6
+ exports.isLocationNameWithActionSupport = isLocationNameWithActionSupport;
7
+ exports.iterableStandardLocationNamesMeta = iterableStandardLocationNamesMeta;
8
+ exports.normalizeLocationName = normalizeLocationName;
9
+ exports.isEnqueuedAssetType = isEnqueuedAssetType;
10
+ exports.isEntrypointField = isEntrypointField;
11
+ exports.getLoadableEntrypointFields = getLoadableEntrypointFields;
12
+ exports.convertEntrypointFieldForAssetType = convertEntrypointFieldForAssetType;
13
+ exports.leadingSlashIt = leadingSlashIt;
14
+ exports.scriptOrStyleTest = scriptOrStyleTest;
15
+ exports.extractNameAndScriptOrStyleExt = extractNameAndScriptOrStyleExt;
16
+ exports.isStyleField = isStyleField;
17
+ exports.isScriptField = isScriptField;
18
+ exports.isScriptModuleField = isScriptModuleField;
19
+ exports.getFieldType = getFieldType;
20
+ exports.getAssetType = getAssetType;
21
+ exports.getHandleGroup = getHandleGroup;
22
+ exports.convertHookLocationToNamesAndPriority = convertHookLocationToNamesAndPriority;
23
+ exports.convertHookLocationToRawNamesAndPriority = convertHookLocationToRawNamesAndPriority;
24
+ const utils_1 = require("../../utils");
25
+ const identifiers_1 = require("./identifiers");
26
+ exports.standardLocationNamesMeta = {
27
+ clientView: { action: "wp_enqueue_scripts", alternate_names: ['client-view', 'view'] },
28
+ clientEditor: { action: "enqueue_block_editor_assets", alternate_names: ['client-editor', 'editor'] },
29
+ blockAssets: { action: "enqueue_block_assets", alternate_names: ['block-assets'] },
30
+ admin: { action: "admin_enqueue_scripts", supports_hook_name: true },
31
+ login: { action: "login_enqueue_scripts" },
32
+ customizer: { action: "customize_controls_enqueue_scripts" },
33
+ analytics: { action: "plaudit_enqueue_analytics" },
34
+ lazyLoader: { action: false, supports_hook_name: true, alternate_names: ['lazy-loader'] },
35
+ };
36
+ function isStandardLocationName(name) {
37
+ return Object.hasOwn(exports.standardLocationNamesMeta, name);
38
+ }
39
+ function isLocationNameWithHookNameSupport(name) {
40
+ const def = exports.standardLocationNamesMeta[name];
41
+ return typeof def === 'object' && !!def && ('supports_hook_name' in def) && def.supports_hook_name;
42
+ }
43
+ function isLocationNameWithActionSupport(name) {
44
+ const def = exports.standardLocationNamesMeta[name];
45
+ return typeof def === 'object' && !!def && def.action !== false;
46
+ }
47
+ function iterableStandardLocationNamesMeta() {
48
+ return (0, utils_1.constantEntries)(exports.standardLocationNamesMeta);
49
+ }
50
+ function normalizeLocationName(name) {
51
+ if (isStandardLocationName(name) || name === 'register') {
52
+ return name;
53
+ }
54
+ for (const [standardName, { alternate_names }] of iterableStandardLocationNamesMeta()) {
55
+ if (alternate_names?.includes(name)) {
56
+ return standardName;
57
+ }
58
+ }
59
+ return undefined;
60
+ }
61
+ const enqueuedAssetTypes = ['script', 'script_module', 'style'];
62
+ function isEnqueuedAssetType(value) {
63
+ return typeof value === 'string' && enqueuedAssetTypes.includes(value);
64
+ }
65
+ exports.entrypointFields = {
66
+ "editorStyle": 'non-module',
67
+ "viewStyle": 'non-module',
68
+ "style": 'non-module',
69
+ "editorScript": 'non-module',
70
+ "viewScript": 'non-module',
71
+ "script": 'non-module',
72
+ "viewScriptModule": 'module',
73
+ };
74
+ function isEntrypointField(value) {
75
+ return typeof value === 'string' && Object.hasOwn(exports.entrypointFields, value);
76
+ }
77
+ function getLoadableEntrypointFields(processingModules) {
78
+ const check = processingModules ? 'module' : 'non-module';
79
+ return (0, utils_1.constantEntries)(exports.entrypointFields).filter(e => e[1] === check).map(e => e[0]);
80
+ }
81
+ //TODO: Remove this
82
+ function convertEntrypointFieldForAssetType(entrypointField, assetType) {
83
+ // Using these word fragments instead of the full words allows us to avoid having to deal with the capitalization of the first letter
84
+ const searchRep = assetType === 'script' ? ['tyle', 'cript'] : [/cript(?:Module)?/, 'tyle'];
85
+ return entrypointField.replace(...searchRep);
86
+ }
87
+ function leadingSlashIt(pathOrSomething) {
88
+ return pathOrSomething.startsWith('/') ? pathOrSomething : ('/' + pathOrSomething);
89
+ }
90
+ exports.isScriptExtensionRegex = /\.m?[jt]sx?$/i;
91
+ exports.scriptExtension = /(?<filename>.+)(?<extension>\.m?[jt]sx?)$/i;
92
+ exports.scriptWithoutModuleExtension = /(?<filename>.+)(?<extension>\.[jt]sx?)($|\?)/i;
93
+ exports.scriptWithModuleExtension = /(?<filename>.+)(?<extension>\.m[jt]sx?)($|\?)/i;
94
+ exports.styleExtension = /(?<filename>.+)(?<extension>\.([ps]?c|sa)ss)($|\?)/i;
95
+ function scriptOrStyleTest(entryPath, scriptExtension) {
96
+ return scriptExtension.test(entryPath) ? "script" : (exports.styleExtension.test(entryPath) ? "style" : "");
97
+ }
98
+ /**
99
+ * @return The first element is the name excluding the JS/CSS extension if it was present.
100
+ * The second element is either the extension (with a leading ".") if it was present or the empty string if it wasn't.
101
+ */
102
+ function extractNameAndScriptOrStyleExt(assetPath) {
103
+ const { filename, extension } = (exports.scriptExtension.exec(assetPath) ?? exports.styleExtension.exec(assetPath))?.groups ?? {};
104
+ return filename && extension ? [filename, extension] : [assetPath, ""];
105
+ }
106
+ function isStyleField(field) {
107
+ return field.endsWith("tyle");
108
+ }
109
+ function isScriptField(field) {
110
+ return field.endsWith("cript");
111
+ }
112
+ function isScriptModuleField(field) {
113
+ return /[sS]cript[mM]odule$/.test(field);
114
+ }
115
+ function getFieldType(field) {
116
+ if (isStyleField(field)) {
117
+ return 'style';
118
+ }
119
+ if (isScriptField(field)) {
120
+ return 'script';
121
+ }
122
+ if (isScriptModuleField(field)) {
123
+ return 'script_module';
124
+ }
125
+ throw new Error(`Unrecognized field: ${field}`);
126
+ }
127
+ function getAssetType(assetPath) {
128
+ return exports.styleExtension.test(assetPath) ? 'style' : exports.scriptWithModuleExtension.test(assetPath) ? 'script_module' : exports.scriptWithoutModuleExtension.test(assetPath) ? 'script' : false;
129
+ }
130
+ function getHandleGroup(field) {
131
+ if (isStyleField(field)) {
132
+ return 'styleHandles';
133
+ }
134
+ if (isScriptModuleField(field)) {
135
+ return 'scriptModuleHandles';
136
+ }
137
+ return 'scriptHandles';
138
+ }
139
+ function convertHookLocationToNamesAndPriority(hookLocation) {
140
+ if (typeof hookLocation === 'string') {
141
+ return [[hookLocation], identifiers_1.DEFAULT_WP_HOOK_PRIORITY];
142
+ }
143
+ if (typeof hookLocation === 'number') {
144
+ return [[], hookLocation];
145
+ }
146
+ if (typeof hookLocation === 'boolean') {
147
+ return [[], identifiers_1.DEFAULT_WP_HOOK_PRIORITY];
148
+ }
149
+ if (Array.isArray(hookLocation)) {
150
+ return [hookLocation, identifiers_1.DEFAULT_WP_HOOK_PRIORITY];
151
+ }
152
+ // if it's in object-form
153
+ return [typeof hookLocation.hook_name === 'string' ? [hookLocation.hook_name] : hookLocation.hook_name ?? [], hookLocation.priority === true ? identifiers_1.DEFAULT_WP_HOOK_PRIORITY : hookLocation.priority ?? identifiers_1.DEFAULT_WP_HOOK_PRIORITY];
154
+ }
155
+ function convertHookLocationToRawNamesAndPriority(hookLocation) {
156
+ if (typeof hookLocation === 'string') {
157
+ return [[hookLocation], undefined];
158
+ }
159
+ if (typeof hookLocation === 'number') {
160
+ return [undefined, hookLocation];
161
+ }
162
+ if (typeof hookLocation === 'boolean') {
163
+ return [undefined, identifiers_1.DEFAULT_WP_HOOK_PRIORITY];
164
+ }
165
+ if (Array.isArray(hookLocation)) {
166
+ return [(0, utils_1.hasAtLeastOneItem)(hookLocation) ? hookLocation : undefined, undefined];
167
+ }
168
+ // if it's in object-form
169
+ return [
170
+ typeof hookLocation.hook_name === 'string' ? [hookLocation.hook_name] : (0, utils_1.hasAtLeastOneItem)(hookLocation.hook_name) ? hookLocation.hook_name : undefined,
171
+ hookLocation.priority === true ? identifiers_1.DEFAULT_WP_HOOK_PRIORITY : hookLocation.priority
172
+ ];
173
+ }
174
+ //# sourceMappingURL=locations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locations.js","sourceRoot":"","sources":["../../../src/api/entries/locations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,uCAA+D;AAK/D,+CAAuD;AAO1C,QAAA,yBAAyB,GAAG;IACxC,UAAU,EAAS,EAAC,MAAM,E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CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAChF,CAAC;IACD,yBAAyB;IACzB,OAAO;QACN,OAAO,YAAY,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAA,yBAAiB,EAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QACtJ,YAAY,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,sCAAwB,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ;KACjF,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type Compilation, type Compiler } from "webpack";
2
+ import { type EntryOptions, type NoOverrides } from "./dependencies";
3
+ export type EntryManager = {
4
+ addDependency: (dep: Parameters<Compilation['addEntry']>[1], options: EntryOptions) => void;
5
+ addEntry: <T extends object = object>(descOrSrc: string | string[], simpleOptions: NoOverrides<T, keyof EntryOptions | 'name'> & Omit<EntryOptions, 'name'> & {
6
+ name: string;
7
+ }) => void;
8
+ addEntryInjectionPromise: (promise: Promise<unknown>) => void;
9
+ waitHook: () => Promise<unknown>;
10
+ };
11
+ export declare function makeEntryManager(compiler: Compiler, compilation: Compilation, context: string, coordinatedLoaderName: string): EntryManager;
12
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/api/entries/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAiC,MAAM,SAAS,CAAC;AAIxF,OAAO,EAAC,KAAK,YAAY,EAAyB,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE1F,MAAM,MAAM,YAAY,GAAG;IAC1B,aAAa,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5F,QAAQ,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAC,MAAM,EAAE,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,EAAE,MAAM,YAAY,GAAC,MAAM,CAAC,GAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAC;IAC9K,wBAAwB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC9D,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,GAAG,YAAY,CA+B3I"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeEntryManager = makeEntryManager;
4
+ const webpack_1 = require("webpack");
5
+ const utils_1 = require("../../utils");
6
+ const dependencies_1 = require("./dependencies");
7
+ function makeEntryManager(compiler, compilation, context, coordinatedLoaderName) {
8
+ const promises = [];
9
+ const addDependency = (dep, options) => {
10
+ promises.push(new Promise((resolve, reject) => {
11
+ compilation.addEntry(context, dep, { ...options, coordinatedLoaderName }, err => void (err ? reject(err) : resolve()));
12
+ }));
13
+ };
14
+ return {
15
+ addDependency,
16
+ addEntry: (descOrSrc, options) => {
17
+ if (!Array.isArray(descOrSrc) || (0, utils_1.hasAtLeastOneItem)(descOrSrc)) {
18
+ let desc;
19
+ if ((0, dependencies_1.isPlauditEntryOptions)(options) && options.additionalSrcs?.length) {
20
+ desc = { import: typeof descOrSrc === 'string' ? [descOrSrc, ...options.additionalSrcs] : [...descOrSrc, ...options.additionalSrcs] };
21
+ }
22
+ else {
23
+ desc = { import: typeof descOrSrc === 'string' ? [descOrSrc] : descOrSrc };
24
+ }
25
+ const opts = { ...webpack_1.EntryOptionPlugin.entryDescriptionToOptions(compiler, options.name, desc), ...options };
26
+ for (const src of desc.import) {
27
+ addDependency(webpack_1.EntryPlugin.createDependency(src, opts), opts);
28
+ }
29
+ }
30
+ },
31
+ addEntryInjectionPromise: promise => void promises.push(promise),
32
+ waitHook: () => Promise.all(promises),
33
+ };
34
+ }
35
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/api/entries/manager.ts"],"names":[],"mappings":";;;AAAA,qCAAwF;AAExF,uCAA8C;AAE9C,iDAA0F;AAS1F,0BAAiC,QAAkB,EAAE,WAAwB,EAAE,OAAe,EAAE,qBAA6B;IAC5H,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,MAAM,aAAa,GAAkC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QACrE,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnD,WAAW,CAAC,QAAQ,CACnB,OAAO,EACP,GAAG,EACH,EAAC,GAAG,OAAO,EAAE,qBAAqB,EAA4B,EAC9D,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAC3C,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO;QACN,aAAa;QACb,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,IAAA,yBAAiB,EAAC,SAAS,CAAC,EAAE,CAAC;gBAC/D,IAAI,IAAwB,CAAC;gBAC7B,IAAI,IAAA,oCAAqB,EAAC,OAAO,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;oBACtE,IAAI,GAAG,EAAC,MAAM,EAAE,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,EAAC,CAAA;gBACpI,CAAC;qBAAM,CAAC;oBACP,IAAI,GAAG,EAAC,MAAM,EAAE,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,EAAC,CAAC;gBAC1E,CAAC;gBACD,MAAM,IAAI,GAAG,EAAC,GAAG,2BAAiB,CAAC,yBAAyB,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,OAAO,EAAC,CAAC;gBACxG,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;oBAC/B,aAAa,CAAC,qBAAW,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;gBAC9D,CAAC;YACF,CAAC;QACF,CAAC;QACD,wBAAwB,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;QAChE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;KAC5B,CAAC;AACZ,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { HandleConfig, PlauditEntryOptions } from "./entries";
2
+ /**
3
+ * The type of mechanism via which the handle was derived.
4
+ * These are used when determining which handles can be safely modified by conflict-avoidance code when a conflict occurs.
5
+ */
6
+ export declare enum HandleDerivationMechanism {
7
+ /**
8
+ * Indicates that the entirety of the handle was specified by the user.
9
+ * Handles derived via this mechanism cannot be modified by conflict-avoidance code, and will, therefore, throw errors if a conflict occurs.
10
+ */
11
+ manual = 0,
12
+ /**
13
+ * Indicates that the suffix of the handle was specified by the user declaring the "nice name" of the file.
14
+ * Handles derived via this mechanism cannot be modified by conflict-avoidance code, and will, therefore, throw errors if a conflict occurs.
15
+ */
16
+ niceName = 1,
17
+ /**
18
+ * Indicates that the handle was generated by the build script. This is the most common method of handle derivation.
19
+ * Handles derived via this mechanism can be modified by conflict-avoidance code, and will, therefore, not throw errors if a conflict occurs.
20
+ * This is possible because the user is not supposed to interact with generated handles directly.
21
+ */
22
+ generation = 2
23
+ }
24
+ export declare function handleCannotBeModifiedForConflictAvoidance(derivationMechanism: HandleDerivationMechanism | Pick<HandleAndDerivationMechanism, 'derivation'>): boolean;
25
+ export type HandleAndDerivationMechanism = {
26
+ handle: string;
27
+ fallbackHandleProducer?: () => HandleAndDerivationMechanism;
28
+ derivation: HandleDerivationMechanism;
29
+ };
30
+ export declare function convertHandleConfigToEmittableHandle<T extends Record<string, unknown> = Record<string, unknown>>(handle: HandleConfig<PlauditEntryOptions<T>> | undefined, handlePrefix: string, handleSuffix: string, options: Omit<PlauditEntryOptions<T>, 'initialHandleName'>): HandleAndDerivationMechanism;
31
+ export declare function makeEmittableConfigPHP(data: unknown, asFullFile: boolean, parentIndent?: string): string;
32
+ //# sourceMappingURL=handle-derivation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-derivation.d.ts","sourceRoot":"","sources":["../../src/api/handle-derivation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAEjE;;;GAGG;AACH,oBAAY,yBAAyB;IACpC;;;OAGG;IACH,MAAM,IAAA;IACN;;;OAGG;IACH,QAAQ,IAAA;IACR;;;;OAIG;IACH,UAAU,IAAA;CACV;AACD,wBAAgB,0CAA0C,CAAC,mBAAmB,EAAE,yBAAyB,GAAC,IAAI,CAAC,4BAA4B,EAAE,YAAY,CAAC,WAEzJ;AAED,MAAM,MAAM,4BAA4B,GAAG;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,sBAAsB,CAAC,EAAE,MAAM,4BAA4B,CAAC;IAAC,UAAU,EAAE,yBAAyB,CAAA;CAAC,CAAC;AAEhK,wBAAgB,oCAAoC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/G,MAAM,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAC,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,GAC5J,4BAA4B,CAgC9B;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,SAAK,UAO3F"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HandleDerivationMechanism = void 0;
4
+ exports.handleCannotBeModifiedForConflictAvoidance = handleCannotBeModifiedForConflictAvoidance;
5
+ exports.convertHandleConfigToEmittableHandle = convertHandleConfigToEmittableHandle;
6
+ exports.makeEmittableConfigPHP = makeEmittableConfigPHP;
7
+ const php_writer_1 = require("@plaudit/php-writer");
8
+ /**
9
+ * The type of mechanism via which the handle was derived.
10
+ * These are used when determining which handles can be safely modified by conflict-avoidance code when a conflict occurs.
11
+ */
12
+ var HandleDerivationMechanism;
13
+ (function (HandleDerivationMechanism) {
14
+ /**
15
+ * Indicates that the entirety of the handle was specified by the user.
16
+ * Handles derived via this mechanism cannot be modified by conflict-avoidance code, and will, therefore, throw errors if a conflict occurs.
17
+ */
18
+ HandleDerivationMechanism[HandleDerivationMechanism["manual"] = 0] = "manual";
19
+ /**
20
+ * Indicates that the suffix of the handle was specified by the user declaring the "nice name" of the file.
21
+ * Handles derived via this mechanism cannot be modified by conflict-avoidance code, and will, therefore, throw errors if a conflict occurs.
22
+ */
23
+ HandleDerivationMechanism[HandleDerivationMechanism["niceName"] = 1] = "niceName";
24
+ /**
25
+ * Indicates that the handle was generated by the build script. This is the most common method of handle derivation.
26
+ * Handles derived via this mechanism can be modified by conflict-avoidance code, and will, therefore, not throw errors if a conflict occurs.
27
+ * This is possible because the user is not supposed to interact with generated handles directly.
28
+ */
29
+ HandleDerivationMechanism[HandleDerivationMechanism["generation"] = 2] = "generation";
30
+ })(HandleDerivationMechanism || (exports.HandleDerivationMechanism = HandleDerivationMechanism = {}));
31
+ function handleCannotBeModifiedForConflictAvoidance(derivationMechanism) {
32
+ return (typeof derivationMechanism === 'object' ? derivationMechanism.derivation : derivationMechanism) !== HandleDerivationMechanism.generation;
33
+ }
34
+ function convertHandleConfigToEmittableHandle(handle, handlePrefix, handleSuffix, options) {
35
+ const generatedHandle = `${handlePrefix}/${handleSuffix}`;
36
+ if (!handle) {
37
+ return { handle: generatedHandle, derivation: HandleDerivationMechanism.generation };
38
+ }
39
+ let emittableHandle, derivation;
40
+ if (typeof handle === 'string') {
41
+ emittableHandle = handle;
42
+ derivation = HandleDerivationMechanism.manual;
43
+ }
44
+ else if (typeof handle === 'function') {
45
+ const functionResult = handle(generatedHandle, options);
46
+ emittableHandle = !functionResult || typeof functionResult === 'string' ? functionResult : functionResult.handle;
47
+ if (!emittableHandle) {
48
+ return { handle: generatedHandle, derivation: HandleDerivationMechanism.generation };
49
+ }
50
+ derivation = HandleDerivationMechanism.manual;
51
+ }
52
+ else if (handle.niceName) {
53
+ emittableHandle = `${handlePrefix}/${handle.niceName}`;
54
+ derivation = handle.derivation ?? HandleDerivationMechanism.niceName;
55
+ let fallbackHandleProducer;
56
+ if (handle.fallbackNiceName) {
57
+ fallbackHandleProducer = () => {
58
+ const emittableHandle = `${handlePrefix}/${handle.fallbackNiceName}`;
59
+ return { handle: emittableHandle.replaceAll("{basename}", handleSuffix), derivation: HandleDerivationMechanism.generation };
60
+ };
61
+ }
62
+ return { handle: emittableHandle.replaceAll("{basename}", handleSuffix), fallbackHandleProducer, derivation };
63
+ }
64
+ else {
65
+ return { handle: generatedHandle, derivation: HandleDerivationMechanism.generation };
66
+ }
67
+ // A callback is free to return nothing, which means "use the handle you would have generated"
68
+ return { handle: emittableHandle.replaceAll("{basename}", handleSuffix), derivation };
69
+ }
70
+ function makeEmittableConfigPHP(data, asFullFile, parentIndent = "") {
71
+ const prettyPrintedMetadata = php_writer_1.json2php.make({ indent: "\t", linebreak: "\n", shortArraySyntax: true })(data, parentIndent)
72
+ .replaceAll(/(\n\t*)\[\s+],/gs, "$1[],")
73
+ .replaceAll(/\[\n\t+([^\n]+)\n\t+]/gs, (_, inner) => `[${inner.trim()}]`)
74
+ .replaceAll(/'rest' => \[\n\t+(\[(?:'[^']+')?]),\n\t+('[^']+')(?:,\n\t+(\[[^\n]+]))?\n\t+]/gs, (_, deps, hash, args) => `'rest' => [${[deps, hash, args].filter(value => !!value).join(", ")}]`);
75
+ return asFullFile ? `<?php return ${prettyPrintedMetadata};` : prettyPrintedMetadata.trim();
76
+ }
77
+ //# sourceMappingURL=handle-derivation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-derivation.js","sourceRoot":"","sources":["../../src/api/handle-derivation.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA6C;AAI7C;;;GAGG;AACH,IAAY,yBAiBX;AAjBD,WAAY,yBAAyB;IACpC;;;OAGG;IACH,6EAAM,CAAA;IACN;;;OAGG;IACH,iFAAQ,CAAA;IACR;;;;OAIG;IACH,qFAAU,CAAA;AACX,CAAC,EAjBW,yBAAyB,aAAzB,yBAAyB,GAAzB,yBAAyB,QAiBpC;AACD,oDAA2D,mBAA+F;IACzJ,OAAO,CAAC,OAAO,mBAAmB,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,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,CAAC;IACpG,OAAO,UAAU,CAAC,CAAC,CAAC,gBAAgB,qBAAqB,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from "./asset-information-emission";
2
+ export * from "./configuration";
3
+ export * from "./coordinatable-emitter";
4
+ export * from "./entries";
5
+ export * from "./handle-derivation";
6
+ export * from "./shared-types";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./asset-information-emission"), exports);
18
+ __exportStar(require("./configuration"), exports);
19
+ __exportStar(require("./coordinatable-emitter"), exports);
20
+ __exportStar(require("./entries"), exports);
21
+ __exportStar(require("./handle-derivation"), exports);
22
+ __exportStar(require("./shared-types"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,kDAAgC;AAChC,0DAAwC;AACxC,4CAA0B;AAC1B,sDAAoC;AACpC,iDAA+B"}