@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.
- package/CHANGELOG.md +13 -1
- package/USER-GUIDE.md +2 -1
- package/dist/api/asset-information-emission.d.ts +74 -0
- package/dist/api/asset-information-emission.d.ts.map +1 -0
- package/dist/api/asset-information-emission.js +398 -0
- package/dist/api/asset-information-emission.js.map +1 -0
- package/dist/api/configuration.d.ts +102 -0
- package/dist/api/configuration.d.ts.map +1 -0
- package/dist/api/configuration.js +83 -0
- package/dist/api/configuration.js.map +1 -0
- package/dist/api/coordinatable-emitter.d.ts +27 -0
- package/dist/api/coordinatable-emitter.d.ts.map +1 -0
- package/dist/api/coordinatable-emitter.js +20 -0
- package/dist/api/coordinatable-emitter.js.map +1 -0
- package/dist/api/entries/dependencies.d.ts +69 -0
- package/dist/api/entries/dependencies.d.ts.map +1 -0
- package/dist/api/entries/dependencies.js +61 -0
- package/dist/api/entries/dependencies.js.map +1 -0
- package/dist/api/entries/flag-logic.d.ts +37 -0
- package/dist/api/entries/flag-logic.d.ts.map +1 -0
- package/dist/api/entries/flag-logic.js +110 -0
- package/dist/api/entries/flag-logic.js.map +1 -0
- package/dist/api/entries/identifiers.d.ts +84 -0
- package/dist/api/entries/identifiers.d.ts.map +1 -0
- package/dist/api/entries/identifiers.js +590 -0
- package/dist/api/entries/identifiers.js.map +1 -0
- package/dist/api/entries/index.d.ts +6 -0
- package/dist/api/entries/index.d.ts.map +1 -0
- package/dist/{plugins → api/entries}/index.js +6 -8
- package/dist/api/entries/index.js.map +1 -0
- package/dist/api/entries/locations.d.ts +135 -0
- package/dist/api/entries/locations.d.ts.map +1 -0
- package/dist/api/entries/locations.js +174 -0
- package/dist/api/entries/locations.js.map +1 -0
- package/dist/api/entries/manager.d.ts +12 -0
- package/dist/api/entries/manager.d.ts.map +1 -0
- package/dist/api/entries/manager.js +35 -0
- package/dist/api/entries/manager.js.map +1 -0
- package/dist/api/handle-derivation.d.ts +32 -0
- package/dist/api/handle-derivation.d.ts.map +1 -0
- package/dist/api/handle-derivation.js +77 -0
- package/dist/api/handle-derivation.js.map +1 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +23 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/shared-types.d.ts +86 -0
- package/dist/api/shared-types.d.ts.map +1 -0
- package/dist/api/shared-types.js +3 -0
- package/dist/api/shared-types.js.map +1 -0
- package/dist/internal-utils/auto-registering-plugins-loader.d.ts +3 -0
- package/dist/internal-utils/auto-registering-plugins-loader.d.ts.map +1 -0
- package/dist/internal-utils/auto-registering-plugins-loader.js +42 -0
- package/dist/internal-utils/auto-registering-plugins-loader.js.map +1 -0
- package/dist/internal-utils/common-config-helpers.d.ts +14 -0
- package/dist/internal-utils/common-config-helpers.d.ts.map +1 -0
- package/dist/internal-utils/common-config-helpers.js +140 -0
- package/dist/internal-utils/common-config-helpers.js.map +1 -0
- package/dist/internal-utils/entrypoint-resolution-logic.d.ts +14 -0
- package/dist/internal-utils/entrypoint-resolution-logic.d.ts.map +1 -0
- package/dist/internal-utils/entrypoint-resolution-logic.js +223 -0
- package/dist/internal-utils/entrypoint-resolution-logic.js.map +1 -0
- package/dist/internal-utils/internal-pseudo-plugin.d.ts +6 -0
- package/dist/internal-utils/internal-pseudo-plugin.d.ts.map +1 -0
- package/dist/internal-utils/internal-pseudo-plugin.js +46 -0
- package/dist/internal-utils/internal-pseudo-plugin.js.map +1 -0
- package/dist/mocks/blocks.d.ts +32 -0
- package/dist/mocks/blocks.d.ts.map +1 -0
- package/dist/mocks/blocks.js +3 -0
- package/dist/mocks/blocks.js.map +1 -0
- package/dist/mocks/index.d.ts +2 -0
- package/dist/mocks/index.d.ts.map +1 -0
- package/dist/mocks/index.js +18 -0
- package/dist/mocks/index.js.map +1 -0
- package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts +4 -10
- package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts.map +1 -0
- package/dist/plugins/AdditionalDependencyInjectorPlugin.js +48 -47
- package/dist/plugins/AdditionalDependencyInjectorPlugin.js.map +1 -0
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +1 -0
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts.map +1 -0
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js +1 -0
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js.map +1 -0
- package/dist/plugins/PackageConfigSanityChecker.d.ts +1 -0
- package/dist/plugins/PackageConfigSanityChecker.d.ts.map +1 -0
- package/dist/plugins/PackageConfigSanityChecker.js +1 -0
- package/dist/plugins/PackageConfigSanityChecker.js.map +1 -0
- package/dist/plugins/RootCoordinatorPluginImpl.d.ts +56 -0
- package/dist/plugins/RootCoordinatorPluginImpl.d.ts.map +1 -0
- package/dist/plugins/RootCoordinatorPluginImpl.js +767 -0
- package/dist/plugins/RootCoordinatorPluginImpl.js.map +1 -0
- package/dist/plugins/VariablesJSMonitorPlugin.d.ts +2 -1
- package/dist/plugins/VariablesJSMonitorPlugin.d.ts.map +1 -0
- package/dist/plugins/VariablesJSMonitorPlugin.js +1 -0
- package/dist/plugins/VariablesJSMonitorPlugin.js.map +1 -0
- package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.d.ts +25 -0
- package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.d.ts.map +1 -0
- package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.js +458 -0
- package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.js.map +1 -0
- package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.d.ts +29 -0
- package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.d.ts.map +1 -0
- package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.js +290 -0
- package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.js.map +1 -0
- package/dist/plugins/blocks/register.d.ts +6 -0
- package/dist/plugins/blocks/register.d.ts.map +1 -0
- package/dist/plugins/blocks/register.js +14 -0
- package/dist/plugins/blocks/register.js.map +1 -0
- package/dist/plugins/blocks/registerEmitter.d.ts +4 -0
- package/dist/plugins/blocks/registerEmitter.d.ts.map +1 -0
- package/dist/plugins/blocks/registerEmitter.js +13 -0
- package/dist/plugins/blocks/registerEmitter.js.map +1 -0
- package/dist/plugins/blocks/registerProcessor.d.ts +4 -0
- package/dist/plugins/blocks/registerProcessor.d.ts.map +1 -0
- package/dist/plugins/blocks/registerProcessor.js +46 -0
- package/dist/plugins/blocks/registerProcessor.js.map +1 -0
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts +3 -2
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts.map +1 -0
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js +2 -1
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.d.ts +14 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.d.ts.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.js +191 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.js.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.d.ts +14 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.d.ts.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.js +102 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.js.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.d.ts +25 -0
- package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.d.ts.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.js +229 -0
- package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.js.map +1 -0
- package/dist/plugins/extensions/register.d.ts +6 -0
- package/dist/plugins/extensions/register.d.ts.map +1 -0
- package/dist/plugins/extensions/register.js +14 -0
- package/dist/plugins/extensions/register.js.map +1 -0
- package/dist/plugins/extensions/registerEmitter.d.ts +4 -0
- package/dist/plugins/extensions/registerEmitter.d.ts.map +1 -0
- package/dist/plugins/extensions/registerEmitter.js +18 -0
- package/dist/plugins/extensions/registerEmitter.js.map +1 -0
- package/dist/plugins/extensions/registerProcessor.d.ts +4 -0
- package/dist/plugins/extensions/registerProcessor.d.ts.map +1 -0
- package/dist/plugins/extensions/registerProcessor.js +42 -0
- package/dist/plugins/extensions/registerProcessor.js.map +1 -0
- package/dist/plugins/plain/PlainEntrypointProcessingPlugin.d.ts +18 -0
- package/dist/plugins/plain/PlainEntrypointProcessingPlugin.d.ts.map +1 -0
- package/dist/plugins/plain/PlainEntrypointProcessingPlugin.js +203 -0
- package/dist/plugins/plain/PlainEntrypointProcessingPlugin.js.map +1 -0
- package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.d.ts +13 -0
- package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.d.ts.map +1 -0
- package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.js +51 -0
- package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.js.map +1 -0
- package/dist/plugins/plain/register.d.ts +6 -0
- package/dist/plugins/plain/register.d.ts.map +1 -0
- package/dist/plugins/plain/register.js +14 -0
- package/dist/plugins/plain/register.js.map +1 -0
- package/dist/plugins/plain/registerEmitter.d.ts +4 -0
- package/dist/plugins/plain/registerEmitter.d.ts.map +1 -0
- package/dist/plugins/plain/registerEmitter.js +21 -0
- package/dist/plugins/plain/registerEmitter.js.map +1 -0
- package/dist/plugins/plain/registerProcessor.d.ts +4 -0
- package/dist/plugins/plain/registerProcessor.d.ts.map +1 -0
- package/dist/plugins/plain/registerProcessor.js +34 -0
- package/dist/plugins/plain/registerProcessor.js.map +1 -0
- package/dist/plugins/register.d.ts +3 -0
- package/dist/plugins/register.d.ts.map +1 -0
- package/dist/plugins/register.js +17 -0
- package/dist/plugins/register.js.map +1 -0
- package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.d.ts +20 -0
- package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.d.ts.map +1 -0
- package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.js +56 -0
- package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.js.map +1 -0
- package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.d.ts +13 -0
- package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.d.ts.map +1 -0
- package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.js +105 -0
- package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.js.map +1 -0
- package/dist/plugins/special-assets/register.d.ts +6 -0
- package/dist/plugins/special-assets/register.d.ts.map +1 -0
- package/dist/plugins/special-assets/register.js +14 -0
- package/dist/plugins/special-assets/register.js.map +1 -0
- package/dist/plugins/special-assets/registerEmitter.d.ts +4 -0
- package/dist/plugins/special-assets/registerEmitter.d.ts.map +1 -0
- package/dist/plugins/special-assets/registerEmitter.js +15 -0
- package/dist/plugins/special-assets/registerEmitter.js.map +1 -0
- package/dist/plugins/special-assets/registerProcessor.d.ts +4 -0
- package/dist/plugins/special-assets/registerProcessor.d.ts.map +1 -0
- package/dist/plugins/special-assets/registerProcessor.js +15 -0
- package/dist/plugins/special-assets/registerProcessor.js.map +1 -0
- package/dist/plugins/unified-loader/UnifiedLoaderGenerator.d.ts +22 -0
- package/dist/plugins/unified-loader/UnifiedLoaderGenerator.d.ts.map +1 -0
- package/dist/plugins/unified-loader/UnifiedLoaderGenerator.js +95 -0
- package/dist/plugins/unified-loader/UnifiedLoaderGenerator.js.map +1 -0
- package/dist/plugins/wpml-config/WPMLConfigBuilder.d.ts +24 -0
- package/dist/plugins/wpml-config/WPMLConfigBuilder.d.ts.map +1 -0
- package/dist/plugins/{WPMLConfigBuilder.js → wpml-config/WPMLConfigBuilder.js} +123 -53
- package/dist/plugins/wpml-config/WPMLConfigBuilder.js.map +1 -0
- package/dist/plugins/wpml-config/register.d.ts +6 -0
- package/dist/plugins/wpml-config/register.d.ts.map +1 -0
- package/dist/plugins/wpml-config/register.js +25 -0
- package/dist/plugins/wpml-config/register.js.map +1 -0
- package/dist/shared.d.ts +10 -283
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +32 -405
- package/dist/shared.js.map +1 -0
- package/dist/utils/error-helpers.d.ts +7 -0
- package/dist/utils/error-helpers.d.ts.map +1 -0
- package/dist/utils/error-helpers.js +73 -0
- package/dist/utils/error-helpers.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +22 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/misc.d.ts +4 -0
- package/dist/utils/misc.d.ts.map +1 -0
- package/dist/utils/misc.js +18 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/path-helpers.d.ts +16 -0
- package/dist/utils/path-helpers.d.ts.map +1 -0
- package/dist/utils/path-helpers.js +115 -0
- package/dist/utils/path-helpers.js.map +1 -0
- package/dist/utils/pseudo-semaphore.d.ts +1 -0
- package/dist/utils/pseudo-semaphore.d.ts.map +1 -0
- package/dist/utils/pseudo-semaphore.js +3 -5
- package/dist/utils/pseudo-semaphore.js.map +1 -0
- package/dist/utils/type-helpers.d.ts +27 -0
- package/dist/utils/type-helpers.d.ts.map +1 -0
- package/dist/utils/type-helpers.js +33 -0
- package/dist/utils/type-helpers.js.map +1 -0
- package/dist/utils/writer-utils.d.ts +8 -0
- package/dist/utils/writer-utils.d.ts.map +1 -0
- package/dist/utils/writer-utils.js +35 -0
- package/dist/utils/writer-utils.js.map +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts +2 -1
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts.map +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js +5 -7
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js.map +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts.map +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js.map +1 -0
- package/dist/wordpress-scripts-wrapper.d.ts +3 -2
- package/dist/wordpress-scripts-wrapper.d.ts.map +1 -0
- package/dist/wordpress-scripts-wrapper.js +137 -391
- package/dist/wordpress-scripts-wrapper.js.map +1 -0
- package/package.json +28 -50
- package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.d.ts +0 -25
- package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.js +0 -86
- package/dist/plugins/AbstractBiPhasicGroupPlugin.d.ts +0 -31
- package/dist/plugins/AbstractBiPhasicGroupPlugin.js +0 -91
- package/dist/plugins/EnhancedBlockJSONPlugin.d.ts +0 -47
- package/dist/plugins/EnhancedBlockJSONPlugin.js +0 -657
- package/dist/plugins/EnhancedDynamicEntryPlugin.d.ts +0 -8
- package/dist/plugins/EnhancedDynamicEntryPlugin.js +0 -14
- package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.d.ts +0 -20
- package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.js +0 -191
- package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.d.ts +0 -9
- package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.js +0 -45
- package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.d.ts +0 -6
- package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.js +0 -13
- package/dist/plugins/MixableBiPhasicGroupPlugin.d.ts +0 -6
- package/dist/plugins/MixableBiPhasicGroupPlugin.js +0 -13
- package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.d.ts +0 -26
- package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +0 -392
- package/dist/plugins/SpecialAssetHandlingPlugin.d.ts +0 -12
- package/dist/plugins/SpecialAssetHandlingPlugin.js +0 -134
- package/dist/plugins/UnifiedLoaderGenerator.d.ts +0 -21
- package/dist/plugins/UnifiedLoaderGenerator.js +0 -144
- package/dist/plugins/WPMLConfigBuilder.d.ts +0 -17
- package/dist/plugins/index.d.ts +0 -8
- package/dist/plugins/static-configs.d.ts +0 -3
- package/dist/plugins/static-configs.js +0 -44
- package/dist/utils/common-config-helpers.d.ts +0 -28
- package/dist/utils/common-config-helpers.js +0 -489
- package/dist/utils/css-writer.d.ts +0 -4
- package/dist/utils/css-writer.js +0 -46
- package/dist/utils/entrypoint-resolution-logic.d.ts +0 -13
- package/dist/utils/entrypoint-resolution-logic.js +0 -82
- package/dist/utils/location-encoding-filename-parser.d.ts +0 -30
- package/dist/utils/location-encoding-filename-parser.js +0 -120
- package/dist/utils/path-query-and-related-helpers.d.ts +0 -64
- package/dist/utils/path-query-and-related-helpers.js +0 -269
package/dist/shared.js
CHANGED
|
@@ -1,72 +1,19 @@
|
|
|
1
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.styleExtension = exports.scriptWithModuleExtension = exports.scriptWithoutModuleExtension = exports.scriptExtension = exports.entrypointFields = exports.standardLocationNamesMeta = void 0;
|
|
21
3
|
exports.isParsedAssetsJson = isParsedAssetsJson;
|
|
22
|
-
exports.isStandardLocationName = isStandardLocationName;
|
|
23
|
-
exports.iterableStandardLocationNamesMeta = iterableStandardLocationNamesMeta;
|
|
24
|
-
exports.normalizeLocationName = normalizeLocationName;
|
|
25
|
-
exports.isRegisterScriptArgsShorthandName = isRegisterScriptArgsShorthandName;
|
|
26
|
-
exports.isNormalizedUsageLocations = isNormalizedUsageLocations;
|
|
27
|
-
exports.convertHookLocationToNamesAndPriority = convertHookLocationToNamesAndPriority;
|
|
28
|
-
exports.hasDeferringStrategy = hasDeferringStrategy;
|
|
29
|
-
exports.canMergeHandles = canMergeHandles;
|
|
30
|
-
exports.constantKeys = constantKeys;
|
|
31
|
-
exports.constantEntries = constantEntries;
|
|
32
|
-
exports.determineCurrentSourceType = determineCurrentSourceType;
|
|
33
4
|
exports.shouldWriteDistDev = shouldWriteDistDev;
|
|
34
5
|
exports.isDistDevOutputPath = isDistDevOutputPath;
|
|
35
6
|
exports.applyStandards = applyStandards;
|
|
36
7
|
exports.resolveStandard = resolveStandard;
|
|
37
|
-
exports.convertUsageLocationsHandleToEmittableHandle = convertUsageLocationsHandleToEmittableHandle;
|
|
38
|
-
exports.makeEmittableConfigPHP = makeEmittableConfigPHP;
|
|
39
|
-
exports.convertEntrypointFieldForAssetType = convertEntrypointFieldForAssetType;
|
|
40
|
-
exports.leadingSlashIt = leadingSlashIt;
|
|
41
|
-
exports.scriptOrStyleTest = scriptOrStyleTest;
|
|
42
|
-
exports.isStyleField = isStyleField;
|
|
43
|
-
exports.isScriptModuleField = isScriptModuleField;
|
|
44
8
|
exports.mergeModuleDependencyArrays = mergeModuleDependencyArrays;
|
|
45
|
-
exports.getHandleGroup = getHandleGroup;
|
|
46
|
-
exports.hasAtLeastOneItem = hasAtLeastOneItem;
|
|
47
|
-
exports.arrayIsLength = arrayIsLength;
|
|
48
|
-
exports.kebabCase = kebabCase;
|
|
49
|
-
exports.camelCaseForPHPLabels = camelCaseForPHPLabels;
|
|
50
|
-
exports.newCleanWebpackError = newCleanWebpackError;
|
|
51
|
-
exports.newWebpackErrorForFile = newWebpackErrorForFile;
|
|
52
|
-
exports.emitResolveBaseUriFunction = emitResolveBaseUriFunction;
|
|
53
9
|
exports.getAssetsJson = getAssetsJson;
|
|
54
|
-
exports.
|
|
55
|
-
exports.emitPHPWriterAsAsset = emitPHPWriterAsAsset;
|
|
10
|
+
exports.tryGetAssetsJson = tryGetAssetsJson;
|
|
56
11
|
exports.dedent = dedent;
|
|
57
12
|
exports.resolveLegacyBlockScriptsInFolder = resolveLegacyBlockScriptsInFolder;
|
|
58
|
-
exports.
|
|
59
|
-
exports.wrapInlineAssetContents = wrapInlineAssetContents;
|
|
60
|
-
exports.synchronousDirIterator = synchronousDirIterator;
|
|
61
|
-
exports.instanceOfNodeError = instanceOfNodeError;
|
|
62
|
-
exports.shouldBeSkipped = shouldBeSkipped;
|
|
63
|
-
const node_crypto_1 = require("node:crypto");
|
|
13
|
+
exports.promiseWithResolversAndValue = promiseWithResolversAndValue;
|
|
64
14
|
const node_fs_1 = require("node:fs");
|
|
65
|
-
const node_path_1 =
|
|
66
|
-
const
|
|
67
|
-
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
68
|
-
const webpack_1 = require("webpack");
|
|
69
|
-
__exportStar(require("./utils/entrypoint-resolution-logic"), exports);
|
|
15
|
+
const node_path_1 = require("node:path");
|
|
16
|
+
const utils_1 = require("./utils");
|
|
70
17
|
function isParsedAssetsJson(thing) {
|
|
71
18
|
if (!thing || typeof thing !== 'object') {
|
|
72
19
|
return false;
|
|
@@ -80,149 +27,6 @@ function isParsedAssetsJson(thing) {
|
|
|
80
27
|
}
|
|
81
28
|
return true;
|
|
82
29
|
}
|
|
83
|
-
exports.standardLocationNamesMeta = {
|
|
84
|
-
clientView: { action: "wp_enqueue_scripts", alternate_names: ['client-view', 'view'] },
|
|
85
|
-
clientEditor: { action: "enqueue_block_editor_assets", alternate_names: ['client-editor', 'editor'] },
|
|
86
|
-
blockAssets: { action: "enqueue_block_assets", alternate_names: ['block-assets'] },
|
|
87
|
-
admin: { action: "admin_enqueue_scripts", supports_hook_name: true },
|
|
88
|
-
login: { action: "login_enqueue_scripts" },
|
|
89
|
-
customizer: { action: "customize_controls_enqueue_scripts" },
|
|
90
|
-
analytics: { action: "plaudit_enqueue_analytics" },
|
|
91
|
-
};
|
|
92
|
-
function isStandardLocationName(name) {
|
|
93
|
-
return Object.hasOwn(exports.standardLocationNamesMeta, name);
|
|
94
|
-
}
|
|
95
|
-
function iterableStandardLocationNamesMeta() {
|
|
96
|
-
return constantEntries(exports.standardLocationNamesMeta);
|
|
97
|
-
}
|
|
98
|
-
function normalizeLocationName(name) {
|
|
99
|
-
if (isStandardLocationName(name) || name === 'register') {
|
|
100
|
-
return name;
|
|
101
|
-
}
|
|
102
|
-
for (const [standardName, { alternate_names }] of iterableStandardLocationNamesMeta()) {
|
|
103
|
-
if (alternate_names?.includes(name)) {
|
|
104
|
-
return standardName;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
throw new Error(`"${name}" is neither a standard nor alternate location name`);
|
|
108
|
-
}
|
|
109
|
-
function isRegisterScriptArgsShorthandName(name) {
|
|
110
|
-
return ['lazy', 'eager', 'inline'].includes(name);
|
|
111
|
-
}
|
|
112
|
-
function isNormalizedUsageLocations(usageLocations) {
|
|
113
|
-
return typeof usageLocations.registerScriptArgs !== 'string';
|
|
114
|
-
}
|
|
115
|
-
function convertHookLocationToNamesAndPriority(hookLocation) {
|
|
116
|
-
if (typeof hookLocation === 'string') {
|
|
117
|
-
return [[hookLocation], 10];
|
|
118
|
-
}
|
|
119
|
-
if (typeof hookLocation === 'number') {
|
|
120
|
-
return [[], hookLocation];
|
|
121
|
-
}
|
|
122
|
-
if (typeof hookLocation === 'boolean') {
|
|
123
|
-
return [[], 10];
|
|
124
|
-
}
|
|
125
|
-
if (Array.isArray(hookLocation)) {
|
|
126
|
-
return [hookLocation, 10];
|
|
127
|
-
}
|
|
128
|
-
// if it's in object-form
|
|
129
|
-
return [typeof hookLocation.hook_name === 'string' ? [hookLocation.hook_name] : hookLocation.hook_name ?? [], hookLocation.priority ?? 10];
|
|
130
|
-
}
|
|
131
|
-
function hasDeferringStrategy(handle) {
|
|
132
|
-
return handle.rest[2]?.strategy === 'async' || handle.rest[2]?.strategy === 'defer';
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* @return {@code true} -> "can share the same handle", {@code false} -> "cannot be merged", {@code 'dependent'} -> "one handle can be listed as a dependency of the other"
|
|
136
|
-
*/
|
|
137
|
-
function canMergeHandles(handleA, handleB) {
|
|
138
|
-
if (handleA.inlinedAsset === undefined && handleB.inlinedAsset === undefined) {
|
|
139
|
-
return false; // We cannot merge handles for two non-inlined assets
|
|
140
|
-
}
|
|
141
|
-
if (handleA.lazyLoader !== handleB.lazyLoader) {
|
|
142
|
-
return false; // We cannot merge handles for assets that will be loaded under separate conditions
|
|
143
|
-
}
|
|
144
|
-
if (node_path_1.default.dirname(handleA.src) !== node_path_1.default.dirname(handleB.src)) {
|
|
145
|
-
return false; // We don't want assets from different locations to be able to have their handles overlap
|
|
146
|
-
}
|
|
147
|
-
const additionalArgsA = handleA.rest.length === 3 ? handleA.rest[2] : {};
|
|
148
|
-
const additionalArgsB = handleB.rest.length === 3 ? handleB.rest[2] : {};
|
|
149
|
-
if (additionalArgsA.module_dependencies !== additionalArgsB.module_dependencies) {
|
|
150
|
-
if (additionalArgsA.module_dependencies === undefined) {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
if (additionalArgsB.module_dependencies === undefined) {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
if (additionalArgsA.module_dependencies.length !== additionalArgsB.module_dependencies.length) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
for (const modDep of additionalArgsA.module_dependencies) {
|
|
160
|
-
if (!additionalArgsB.module_dependencies.includes(modDep)) {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (additionalArgsA.in_footer !== additionalArgsB.in_footer) {
|
|
166
|
-
return 'dependent';
|
|
167
|
-
}
|
|
168
|
-
if (hasDeferringStrategy(handleA) && handleB.inlinedAsset?.position === 'after') {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
if (hasDeferringStrategy(handleB) && handleA.inlinedAsset?.position === 'after') {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
if (handleA.locations.register !== handleB.locations.register) {
|
|
175
|
-
return false; //TODO: Maybe make this more granular?
|
|
176
|
-
}
|
|
177
|
-
for (const standardLocation of constantKeys(exports.standardLocationNamesMeta)) {
|
|
178
|
-
const locA = handleA.locations[standardLocation];
|
|
179
|
-
const locB = handleB.locations[standardLocation];
|
|
180
|
-
if (locA === locB) {
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
if (locA === undefined || locA === false || locB === undefined || locB === false) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
const [locAHookNames, locAPriority] = convertHookLocationToNamesAndPriority(locA);
|
|
187
|
-
const [locBHookNames, locBPriority] = convertHookLocationToNamesAndPriority(locB);
|
|
188
|
-
if (locAHookNames.length !== locBHookNames.length) {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
if (locAHookNames.length > 0) {
|
|
192
|
-
for (const hookName of locAHookNames) {
|
|
193
|
-
if (!locBHookNames.includes(hookName)) {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
if (locAPriority !== locBPriority) {
|
|
199
|
-
return 'dependent'; // We cannot merge hooks across priority boundaries, but we can have one require the other
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
function constantKeys(object) {
|
|
205
|
-
return Object.keys(object);
|
|
206
|
-
}
|
|
207
|
-
function constantEntries(object) {
|
|
208
|
-
return Object.entries(object);
|
|
209
|
-
}
|
|
210
|
-
function determineCurrentSourceType(dest, srcIsDirectory) {
|
|
211
|
-
if (typeof dest === 'string') {
|
|
212
|
-
return srcIsDirectory ? "blocks" /* SourceType.blocks */ : "plain" /* SourceType.plain */;
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
if (dest.directoryLayout === undefined) {
|
|
216
|
-
return srcIsDirectory ? "blocks" /* SourceType.blocks */ : "plain" /* SourceType.plain */;
|
|
217
|
-
}
|
|
218
|
-
if (dest.directoryLayout === "extensions" /* SourceType.extensions */ || dest.directoryLayout === "blocks" /* SourceType.blocks */) {
|
|
219
|
-
if (!srcIsDirectory) {
|
|
220
|
-
throw new Error(`The '${dest.directoryLayout}' source type must be associated with a directory`);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return dest.directoryLayout;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
30
|
/** Unified-loader watch output: `dist` → `dist-dev` when SERVER_MODE is development. */
|
|
227
31
|
function shouldWriteDistDev(config) {
|
|
228
32
|
return !!(config.outputDir && config.useUnifiedLoader && !config.omitDistDev && (process.env['SERVER_MODE'] ?? 'development') === 'development');
|
|
@@ -232,7 +36,7 @@ function shouldWriteDistDev(config) {
|
|
|
232
36
|
* @returns true for `dist-dev` (or any `*-dev` output folder produced by {@link shouldWriteDistDev}).
|
|
233
37
|
*/
|
|
234
38
|
function isDistDevOutputPath(outputPath) {
|
|
235
|
-
return node_path_1.
|
|
39
|
+
return (0, node_path_1.basename)(outputPath.replace(/[/\\]+$/, '')).endsWith('-dev');
|
|
236
40
|
}
|
|
237
41
|
function applyStandards(config) {
|
|
238
42
|
switch (config.standard) {
|
|
@@ -263,53 +67,6 @@ function resolveStandard(standard) {
|
|
|
263
67
|
return undefined;
|
|
264
68
|
}
|
|
265
69
|
}
|
|
266
|
-
function convertUsageLocationsHandleToEmittableHandle(handle, handlePrefix, handleSuffix) {
|
|
267
|
-
const generatedHandle = `${handlePrefix}/${handleSuffix}`;
|
|
268
|
-
let emittableHandle;
|
|
269
|
-
if (!handle) {
|
|
270
|
-
return generatedHandle;
|
|
271
|
-
}
|
|
272
|
-
if (typeof handle === 'string') {
|
|
273
|
-
emittableHandle = handle;
|
|
274
|
-
}
|
|
275
|
-
else if (typeof handle === 'function') {
|
|
276
|
-
emittableHandle = handle(generatedHandle);
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
emittableHandle = handle.niceName && `${handlePrefix}/${handle.niceName}`;
|
|
280
|
-
}
|
|
281
|
-
// A callback is free to return nothing, which means "use the handle you would have generated"
|
|
282
|
-
return emittableHandle ? emittableHandle.replaceAll("{basename}", handleSuffix) : generatedHandle;
|
|
283
|
-
}
|
|
284
|
-
function makeEmittableConfigPHP(data, asFullFile, parentIndent = "") {
|
|
285
|
-
const prettyPrintedMetadata = php_writer_1.json2php.make({ indent: "\t", linebreak: "\n", shortArraySyntax: true })(data, parentIndent)
|
|
286
|
-
.replaceAll(/(\n\t*)\[\s+],/gs, "$1[],")
|
|
287
|
-
.replaceAll(/\[\n\t+([^\n]+)\n\t+]/gs, (_, inner) => `[${inner.trim()}]`)
|
|
288
|
-
.replaceAll(/'rest' => \[\n\t+(\[(?:'[^']+')?]),\n\t+('[^']+')(?:,\n\t+(\[[^\n]+]))?\n\t+]/gs, (_, deps, hash, args) => `'rest' => [${[deps, hash, args].filter(value => !!value).join(", ")}]`);
|
|
289
|
-
return asFullFile ? `<?php return ${prettyPrintedMetadata};` : prettyPrintedMetadata.trim();
|
|
290
|
-
}
|
|
291
|
-
exports.entrypointFields = ["editorStyle", "viewStyle", "style", "editorScript", "viewScript", "script", "viewScriptModule"];
|
|
292
|
-
function convertEntrypointFieldForAssetType(entrypointField, assetType) {
|
|
293
|
-
// Using these word fragments instead of the full words allows us to avoid having to deal with the capitalization of the first letter
|
|
294
|
-
const searchRep = assetType === 'script' ? ['tyle', 'cript'] : [/cript(?:Module)?/, 'tyle'];
|
|
295
|
-
return entrypointField.replace(...searchRep);
|
|
296
|
-
}
|
|
297
|
-
function leadingSlashIt(pathOrSomething) {
|
|
298
|
-
return pathOrSomething.startsWith('/') ? pathOrSomething : ('/' + pathOrSomething);
|
|
299
|
-
}
|
|
300
|
-
exports.scriptExtension = /(?<filename>.+)(?<extension>\.m?[jt]sx?)$/i;
|
|
301
|
-
exports.scriptWithoutModuleExtension = /(?<filename>.+)(?<extension>\.[jt]sx?)($|\?)/i;
|
|
302
|
-
exports.scriptWithModuleExtension = /(?<filename>.+)(?<extension>\.m[jt]sx?)($|\?)/i;
|
|
303
|
-
exports.styleExtension = /(?<filename>.+)(?<extension>\.([ps]?c|sa)ss)($|\?)/i;
|
|
304
|
-
function scriptOrStyleTest(entryPath, scriptExtension) {
|
|
305
|
-
return scriptExtension.test(entryPath) ? "script" : (exports.styleExtension.test(entryPath) ? "style" : "");
|
|
306
|
-
}
|
|
307
|
-
function isStyleField(field) {
|
|
308
|
-
return field.endsWith("tyle");
|
|
309
|
-
}
|
|
310
|
-
function isScriptModuleField(field) {
|
|
311
|
-
return field.includes("odule");
|
|
312
|
-
}
|
|
313
70
|
function mergeModuleDependencyArrays(a, b) {
|
|
314
71
|
if (a === undefined || a.length === 0) {
|
|
315
72
|
return b;
|
|
@@ -330,7 +87,7 @@ function mergeModuleDependencyArrays(a, b) {
|
|
|
330
87
|
}
|
|
331
88
|
if (seenModuleDeps.has(id)) {
|
|
332
89
|
if (type !== seenModuleDeps.get(id)) {
|
|
333
|
-
throw newCleanWebpackError(`Encountered conflicting import types for the "${id}" module dependency`);
|
|
90
|
+
throw (0, utils_1.newCleanWebpackError)(`Encountered conflicting import types for the "${id}" module dependency`);
|
|
334
91
|
}
|
|
335
92
|
return false;
|
|
336
93
|
}
|
|
@@ -338,115 +95,24 @@ function mergeModuleDependencyArrays(a, b) {
|
|
|
338
95
|
return true;
|
|
339
96
|
});
|
|
340
97
|
}
|
|
341
|
-
|
|
342
|
-
if (isStyleField(field)) {
|
|
343
|
-
return 'styleHandles';
|
|
344
|
-
}
|
|
345
|
-
if (isScriptModuleField(field)) {
|
|
346
|
-
return 'scriptModuleHandles';
|
|
347
|
-
}
|
|
348
|
-
return 'scriptHandles';
|
|
349
|
-
}
|
|
350
|
-
function hasAtLeastOneItem(list) {
|
|
351
|
-
return list.length > 0 && list[0] !== undefined && list[0] !== null;
|
|
352
|
-
}
|
|
353
|
-
function arrayIsLength(arr, length) {
|
|
354
|
-
return !!arr && arr.length === length;
|
|
355
|
-
}
|
|
356
|
-
function kebabCase(value) {
|
|
357
|
-
const kebabCaseRegexes = [[/([a-z])([A-Z])/g, "$1-$2"], [/[\s_.\-]+/g, "-"]];
|
|
358
|
-
return kebabCaseRegexes.reduce((str, [pattern, replacement]) => str.replace(pattern, replacement), value).toLowerCase();
|
|
359
|
-
}
|
|
360
|
-
function camelCaseForPHPLabels(value) {
|
|
361
|
-
return value
|
|
362
|
-
.replaceAll("/", "\\")
|
|
363
|
-
.split("\\")
|
|
364
|
-
.map(part => {
|
|
365
|
-
part = part
|
|
366
|
-
.replaceAll(/[^a-zA-Z0-9\x7f-\xff](\w|$)/ig, (_, chr) => typeof chr === 'string' ? chr.toUpperCase() : "")
|
|
367
|
-
.replaceAll(/\d[a-z]/g, match => match.toUpperCase());
|
|
368
|
-
return part.length > 1 ? part.substring(0, 1).toUpperCase() + part.substring(1) : part.toUpperCase();
|
|
369
|
-
})
|
|
370
|
-
.join("\\");
|
|
371
|
-
}
|
|
372
|
-
function newCleanWebpackError(error) {
|
|
373
|
-
const res = typeof error === 'string' ? new webpack_1.WebpackError(error) : new webpack_1.WebpackError(...error);
|
|
374
|
-
res.hideStack = true;
|
|
375
|
-
return res;
|
|
376
|
-
}
|
|
377
|
-
function newWebpackErrorForFile(error, file) {
|
|
378
|
-
const res = newCleanWebpackError(error);
|
|
379
|
-
res.file = file;
|
|
380
|
-
return res;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* The primary benefit of emitting a function instead of baking its contents into each function that uses it is that it allows us to avoid recomputing the base uri multiple times
|
|
384
|
-
*/
|
|
385
|
-
function emitResolveBaseUriFunction(writer) {
|
|
386
|
-
const dir = new expressions_1.Var("dir");
|
|
387
|
-
const baseUris = new expressions_1.Var("base_uris");
|
|
388
|
-
const assignmentTarget = new expressions_1.ArrayAccess(baseUris, dir);
|
|
389
|
-
const path = new expressions_1.Var("path");
|
|
390
|
-
writer.function("plaudit_webpack_extensions__resolve_base_uri", [dir], writer => {
|
|
391
|
-
writer
|
|
392
|
-
.static(baseUris, { initializer: [] })
|
|
393
|
-
.if(expressions_1.Expr.isset(assignmentTarget))
|
|
394
|
-
.return(assignmentTarget)
|
|
395
|
-
.elseIf(expressions_1.Expr.call("str_starts_with", [dir, expressions_1.Constants.ABSPATH]))
|
|
396
|
-
.assign(path, expressions_1.Expr.call("ltrim", [expressions_1.Expr.call("substr", [dir, expressions_1.Expr.call("strlen", [expressions_1.Constants.ABSPATH])]), "/"]))
|
|
397
|
-
.elseIf(expressions_1.Expr.call("str_starts_with", [dir, "/workspace/website"]))
|
|
398
|
-
.assign(path, expressions_1.Expr.call("ltrim", [expressions_1.Expr.call("substr", [dir, 18]), "/"]))
|
|
399
|
-
.else()
|
|
400
|
-
.call("error_log", ["UNABLE TO FIGURE OUT WHAT THE RELATIVE PATH TO THE BUILT FILES DIRECTORY SHOULD BE"])
|
|
401
|
-
.assign(path, "")
|
|
402
|
-
.endIf()
|
|
403
|
-
.call("trailingslashit", [expressions_1.Expr.call("get_site_url", [new expressions_1.Argument(path, "path")])], { return: true, assignTo: assignmentTarget });
|
|
404
|
-
}, { returnType: "string", includeExistenceCheck: true });
|
|
405
|
-
}
|
|
98
|
+
const missingAssetsJsonMessage = "assets.json is unexpectedly missing";
|
|
406
99
|
function getAssetsJson(compilation) {
|
|
407
100
|
const asset = compilation.getAsset("assets.json");
|
|
408
101
|
if (asset && isParsedAssetsJson(asset.info["parsed-assets-json"])) {
|
|
409
102
|
return asset.info["parsed-assets-json"];
|
|
410
103
|
}
|
|
411
|
-
throw new Error(
|
|
104
|
+
throw new Error(missingAssetsJsonMessage);
|
|
412
105
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
const assetType = scriptOrStyleTest(metadata.absoluteSrc, exports.scriptExtension);
|
|
417
|
-
const chunkFiles = [dest.destination, ...entrypoint.chunks.flatMap(chunk => Array.from(chunk.files))]
|
|
418
|
-
.filter(chunkFile => scriptOrStyleTest(chunkFile, exports.scriptExtension) === assetType);
|
|
419
|
-
for (const chunkFile of chunkFiles) {
|
|
420
|
-
if (parsedAssetJson[chunkFile]) {
|
|
421
|
-
return { assetName: chunkFile, assetData: parsedAssetJson[chunkFile] };
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
if (assetType !== 'style' || !hasAtLeastOneItem(chunkFiles)) {
|
|
425
|
-
return undefined;
|
|
106
|
+
function tryGetAssetsJson(compilation) {
|
|
107
|
+
try {
|
|
108
|
+
return getAssetsJson(compilation);
|
|
426
109
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
for (const chunkFile of chunkFiles.toSorted()) {
|
|
431
|
-
const source = compilation.getAsset(chunkFile)?.source.buffer();
|
|
432
|
-
if (source !== undefined) {
|
|
433
|
-
hashBuilder.update(source);
|
|
110
|
+
catch (e) {
|
|
111
|
+
if (e instanceof Error && e.message === missingAssetsJsonMessage) {
|
|
112
|
+
return undefined; // If the file hasn't been created yet, return undefined
|
|
434
113
|
}
|
|
114
|
+
throw e; // Otherwise, re-throw the error
|
|
435
115
|
}
|
|
436
|
-
// Finalise hash.
|
|
437
|
-
const contentHash = hashBuilder
|
|
438
|
-
.digest(hashDigest)
|
|
439
|
-
.slice(0, hashDigestLength);
|
|
440
|
-
const assetData = {
|
|
441
|
-
dependencies: [],
|
|
442
|
-
version: contentHash,
|
|
443
|
-
};
|
|
444
|
-
compilation.updateAsset("assets.json", s => s, a => ({ ...a, "parsed-assets-json": { ...parsedAssetJson, [chunkFiles[0]]: assetData } }));
|
|
445
|
-
return { assetName: chunkFiles[0], assetData };
|
|
446
|
-
}
|
|
447
|
-
function emitPHPWriterAsAsset(writer, compilation, file, assetInfo) {
|
|
448
|
-
const contents = writer.toString() + "\n";
|
|
449
|
-
compilation[file in compilation.assets ? 'updateAsset' : 'emitAsset'](file, new webpack_1.sources.RawSource(contents), { size: Buffer.byteLength(contents), ...assetInfo });
|
|
450
116
|
}
|
|
451
117
|
function dedent(text, ...values) {
|
|
452
118
|
const lines = text.reduce((result, part, i) => result + String(values[i - 1]) + part).split(/\r?\n/);
|
|
@@ -470,67 +136,28 @@ function dedent(text, ...values) {
|
|
|
470
136
|
function resolveLegacyBlockScriptsInFolder(folder) {
|
|
471
137
|
const blockScriptEntrypoints = [];
|
|
472
138
|
for (const blockDir of (0, node_fs_1.readdirSync)(folder)) {
|
|
473
|
-
const fullBlockDir = node_path_1.
|
|
474
|
-
const packageJSON = node_path_1.
|
|
139
|
+
const fullBlockDir = (0, node_path_1.join)(folder, blockDir);
|
|
140
|
+
const packageJSON = (0, node_path_1.join)(fullBlockDir, 'package.json');
|
|
475
141
|
if ((0, node_fs_1.existsSync)(packageJSON)) {
|
|
476
142
|
const main = JSON.parse((0, node_fs_1.readFileSync)(packageJSON, 'utf8'))['main'];
|
|
477
|
-
if (main && (0, node_fs_1.existsSync)(node_path_1.
|
|
478
|
-
blockScriptEntrypoints.push(node_path_1.
|
|
143
|
+
if (main && (0, node_fs_1.existsSync)((0, node_path_1.join)(fullBlockDir, main))) {
|
|
144
|
+
blockScriptEntrypoints.push((0, node_path_1.join)(fullBlockDir, main));
|
|
479
145
|
}
|
|
480
146
|
}
|
|
481
147
|
}
|
|
482
148
|
return blockScriptEntrypoints;
|
|
483
149
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
compilation.errors.push(newWebpackErrorForFile("Inlined scripts MUST NOT have dependencies. It WILL cause runtime inconsistencies and potentially cause sever performance issues", handleData.src));
|
|
497
|
-
}
|
|
498
|
-
const args = [handle, wrapInlineAssetContents(compilation, `plaudit_inlined_${type}`, handle, handleData.assetContents)];
|
|
499
|
-
if (type === 'script' && handleData.inlinedAsset.position === 'before') {
|
|
500
|
-
args.push('before');
|
|
501
|
-
}
|
|
502
|
-
writer.call(`wp_add_inline_${type}`, args);
|
|
503
|
-
}
|
|
504
|
-
function wrapInlineAssetContents(compilation, wrapperIdPrefix, handle, contents) {
|
|
505
|
-
if (!compilation.outputOptions.path?.endsWith("-dev")) {
|
|
506
|
-
contents = contents.replaceAll(/\/\*#\s+sourceMappingURL=.*?\*\/|\/\/#\s+sourceMappingURL=[^\r\n]*?([\r\n]|$)/gis, "$1");
|
|
507
|
-
}
|
|
508
|
-
return new expressions_1.HereOrNowDoc(`${wrapperIdPrefix}_${(0, node_crypto_1.createHash)('md5').update(handle).digest("hex")}`, contents.trim(), false);
|
|
509
|
-
}
|
|
510
|
-
function* synchronousDirIterator(dirPath) {
|
|
511
|
-
try {
|
|
512
|
-
using dir = (0, node_fs_1.opendirSync)(dirPath);
|
|
513
|
-
for (let dirent; (dirent = dir.readSync()) !== null;) {
|
|
514
|
-
yield dirent;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
catch (e) {
|
|
518
|
-
if (!instanceOfNodeError(e, Error) || e.code !== 'ENOENT') {
|
|
519
|
-
throw e;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* A type-guarded version of `instanceof Error` for Node.js.
|
|
525
|
-
* @author Joseph JDBar Barron
|
|
526
|
-
* @link https://dev.to/jdbar
|
|
527
|
-
*/
|
|
528
|
-
function instanceOfNodeError(value, errorType) {
|
|
529
|
-
return !!value && value instanceof errorType;
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* This tests if the name starts with a "~", is equal to "example" or "examples", or includes "example" as a name segment
|
|
533
|
-
*/
|
|
534
|
-
function shouldBeSkipped(name) {
|
|
535
|
-
return name.startsWith("~") || name === "example" || name === "examples" || name.startsWith("example.") || name.includes(".example.");
|
|
150
|
+
function promiseWithResolversAndValue() {
|
|
151
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
152
|
+
const res = {
|
|
153
|
+
promise: promise.then(v => {
|
|
154
|
+
res.value = v;
|
|
155
|
+
return v;
|
|
156
|
+
}),
|
|
157
|
+
resolve,
|
|
158
|
+
reject,
|
|
159
|
+
value: undefined
|
|
160
|
+
};
|
|
161
|
+
return res;
|
|
536
162
|
}
|
|
163
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA8D;AAC9D,yCAAyC;AAKzC,mCAA6C;AAU7C,4BAAmC,KAAc;IAChD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAc,EAAE,CAAC;QACvD,IACC,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;YACrC,CAAC,CAAC,CAAC,cAAc,IAA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AY,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,IAAA,oBAAU,EAAC,WAAW,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YACnE,IAAI,IAAI,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,YAAY,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;gBAClD,sBAAsB,CAAC,IAAI,CAAC,IAAA,gBAAI,EAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;YACvD,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,sBAAsB,CAAC;AAC/B,CAAC;AAGD;IACC,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAC,GAAG,OAAO,CAAC,aAAa,EAAK,CAAC;IAC9D,MAAM,GAAG,GAAoC;QAC5C,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YACzB,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;YACd,OAAO,CAAC,CAAC;QACV,CAAC,CAAC;QACF,OAAO;QACP,MAAM;QACN,KAAK,EAAE,SAAS;KACP,CAAC;IACX,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WebpackError } from "webpack";
|
|
2
|
+
import type { DelegateContext, DiffErrorDesc } from "../api";
|
|
3
|
+
export declare function newCleanWebpackError(error: string | DiffErrorDesc | ConstructorParameters<typeof WebpackError>): WebpackError;
|
|
4
|
+
export declare function newWebpackErrorForFile(error: string | DiffErrorDesc | ConstructorParameters<typeof WebpackError>, file?: string): WebpackError;
|
|
5
|
+
export declare function emitError(message: string | DiffErrorDesc | Error, { rawIdentifier, compilation, errorBuilder }?: DelegateContext): undefined;
|
|
6
|
+
export declare function emitWarning(message: string | DiffErrorDesc | Error, { rawIdentifier, compilation, errorBuilder }?: DelegateContext): void;
|
|
7
|
+
//# sourceMappingURL=error-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/error-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAC,eAAe,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAC;AAE3D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAC,aAAa,GAAC,qBAAqB,CAAC,OAAO,YAAY,CAAC,gBA4B1G;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAC,aAAa,GAAC,qBAAqB,CAAC,OAAO,YAAY,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,gBAM3H;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAC,aAAa,GAAC,KAAK,EAAE,EAAC,aAAa,EAAE,WAAW,EAAE,YAAY,EAAC,GAAE,eAAoB,aAW9H;AACD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAC,aAAa,GAAC,KAAK,EAAE,EAAC,aAAa,EAAE,WAAW,EAAE,YAAY,EAAC,GAAE,eAAoB,QAUhI"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newCleanWebpackError = newCleanWebpackError;
|
|
4
|
+
exports.newWebpackErrorForFile = newWebpackErrorForFile;
|
|
5
|
+
exports.emitError = emitError;
|
|
6
|
+
exports.emitWarning = emitWarning;
|
|
7
|
+
const webpack_1 = require("webpack");
|
|
8
|
+
function newCleanWebpackError(error) {
|
|
9
|
+
let res;
|
|
10
|
+
if (typeof error === 'string') {
|
|
11
|
+
res = new webpack_1.WebpackError(error);
|
|
12
|
+
}
|
|
13
|
+
else if (Array.isArray(error)) {
|
|
14
|
+
res = new webpack_1.WebpackError(...error);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const display = error.display ?? 'text';
|
|
18
|
+
let received = error.received?.toString() ?? "UNKNOWN";
|
|
19
|
+
if (display === 'text') {
|
|
20
|
+
if (!received.includes('"')) {
|
|
21
|
+
received = `"${received}"`;
|
|
22
|
+
}
|
|
23
|
+
else if (!received.includes("'")) {
|
|
24
|
+
received = `'${received}'`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let expected = error.expected?.toString() ?? "UNKNOWN";
|
|
28
|
+
if (display === 'text') {
|
|
29
|
+
if (!expected.includes('"')) {
|
|
30
|
+
expected = `"${expected}"`;
|
|
31
|
+
}
|
|
32
|
+
else if (!expected.includes("'")) {
|
|
33
|
+
expected = `'${expected}'`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
res = new webpack_1.WebpackError(`${error.text}. Received: ${received}, Expected: ${expected}`);
|
|
37
|
+
}
|
|
38
|
+
res.hideStack = true;
|
|
39
|
+
return res;
|
|
40
|
+
}
|
|
41
|
+
function newWebpackErrorForFile(error, file) {
|
|
42
|
+
const res = newCleanWebpackError(error);
|
|
43
|
+
if (file) {
|
|
44
|
+
res.file = file;
|
|
45
|
+
}
|
|
46
|
+
return res;
|
|
47
|
+
}
|
|
48
|
+
function emitError(message, { rawIdentifier, compilation, errorBuilder } = {}) {
|
|
49
|
+
const err = message instanceof Error ? message : (errorBuilder ?? newWebpackErrorForFile)(message, rawIdentifier);
|
|
50
|
+
if (compilation !== undefined) {
|
|
51
|
+
compilation.errors.push(err);
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
if (err instanceof webpack_1.WebpackError && err.file) {
|
|
56
|
+
err.message = `${err.message}. For file: ${err.file}`;
|
|
57
|
+
}
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function emitWarning(message, { rawIdentifier, compilation, errorBuilder } = {}) {
|
|
62
|
+
const err = message instanceof Error ? message : (errorBuilder ?? newWebpackErrorForFile)(message, rawIdentifier);
|
|
63
|
+
if (compilation !== undefined) {
|
|
64
|
+
compilation.warnings.push(err);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if (err instanceof webpack_1.WebpackError && err.file) {
|
|
68
|
+
err.message = `${err.message}. For file: ${err.file}`;
|
|
69
|
+
}
|
|
70
|
+
console.warn(err.message);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=error-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-helpers.js","sourceRoot":"","sources":["../../src/utils/error-helpers.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAqC;AAIrC,8BAAqC,KAAsE;IAC1G,IAAI,GAAiB,CAAC;IACtB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,GAAG,GAAG,IAAI,sBAAY,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,GAAG,GAAG,IAAI,sBAAY,CAAC,GAAG,KAAK,CAAC,CAAC;IAClC,CAAC;SAAM,CAAC;QACP,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC;QACxC,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,SAAS,CAAC;QACvD,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7B,QAAQ,GAAG,IAAI,QAAQ,GAAG,CAAC;YAC5B,CAAC;iBAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpC,QAAQ,GAAG,IAAI,QAAQ,GAAG,CAAC;YAC5B,CAAC;QACF,CAA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IAAI,EAAE,CAAC;YAC7C,GAAG,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,eAAe,GAAG,CAAC,IAAI,EAAE,CAAA;QACtD,CAAC;QACD,MAAM,GAAG,CAAC;IACX,CAAC;AACF,CAAC;AACD,qBAA4B,OAAmC,EAAE,EAAC,aAAa,EAAE,WAAW,EAAE,YAAY,EAAC,GAAoB,EAAE;IAChI,MAAM,GAAG,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,sBAAsB,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAClH,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/B,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACP,IAAI,GAAG,YAAY,sBAAY,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;YAC7C,GAAG,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,eAAe,GAAG,CAAC,IAAI,EAAE,CAAA;QACtD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -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("./error-helpers"), exports);
|
|
18
|
+
__exportStar(require("./misc"), exports);
|
|
19
|
+
__exportStar(require("./path-helpers"), exports);
|
|
20
|
+
__exportStar(require("./type-helpers"), exports);
|
|
21
|
+
__exportStar(require("./writer-utils"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,yCAAuB;AACvB,iDAA+B;AAC/B,iDAA+B;AAC/B,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../src/utils/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,OAAO,CAAC;AAE5B,eAAO,MAAM,gBAAgB,OAAiC,CAAC;AAE/D,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,OASvC"}
|