@plaudit/webpack-extensions 2.87.0 → 2.88.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 +8 -0
- package/USER-GUIDE.md +3 -2
- package/{build → dist}/plugins/EnhancedBlockJSONPlugin.d.ts +3 -2
- package/{build → dist}/plugins/EnhancedBlockJSONPlugin.js +46 -38
- package/{build → dist}/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +10 -13
- package/{build → dist}/shared.d.ts +2 -1
- package/{build → dist}/shared.js +6 -1
- package/{build → dist}/utils/common-config-helpers.js +69 -55
- package/{build → dist}/utils/path-query-and-related-helpers.d.ts +3 -2
- package/{build → dist}/utils/path-query-and-related-helpers.js +7 -4
- package/{build → dist}/wordpress-scripts-wrapper.js +1 -1
- package/package.json +7 -7
- /package/{build → dist}/plugins/AbstractBiPhasicGroupAndEntryPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/AbstractBiPhasicGroupAndEntryPlugin.js +0 -0
- /package/{build → dist}/plugins/AbstractBiPhasicGroupPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/AbstractBiPhasicGroupPlugin.js +0 -0
- /package/{build → dist}/plugins/AdditionalDependencyInjectorPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/AdditionalDependencyInjectorPlugin.js +0 -0
- /package/{build → dist}/plugins/BrowserSyncPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/BrowserSyncPlugin.js +0 -0
- /package/{build → dist}/plugins/EnhancedDynamicEntryPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/EnhancedDynamicEntryPlugin.js +0 -0
- /package/{build → dist}/plugins/ExtensionsConfigFileGeneratorPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/ExtensionsConfigFileGeneratorPlugin.js +0 -0
- /package/{build → dist}/plugins/ExtensionsConfigFileGeneratorPluginV1.d.ts +0 -0
- /package/{build → dist}/plugins/ExtensionsConfigFileGeneratorPluginV1.js +0 -0
- /package/{build → dist}/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +0 -0
- /package/{build → dist}/plugins/MiniCSSExtractPluginErrorCleaner.js +0 -0
- /package/{build → dist}/plugins/PackageConfigSanityChecker.d.ts +0 -0
- /package/{build → dist}/plugins/PackageConfigSanityChecker.js +0 -0
- /package/{build → dist}/plugins/PlainEntrypointsConfigFileGeneratorPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/SpecialAssetHandlingPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/SpecialAssetHandlingPlugin.js +0 -0
- /package/{build → dist}/plugins/UnifiedLoaderGenerator.d.ts +0 -0
- /package/{build → dist}/plugins/UnifiedLoaderGenerator.js +0 -0
- /package/{build → dist}/plugins/VariablesJSMonitorPlugin.d.ts +0 -0
- /package/{build → dist}/plugins/VariablesJSMonitorPlugin.js +0 -0
- /package/{build → dist}/plugins/WPMLConfigBuilder.d.ts +0 -0
- /package/{build → dist}/plugins/WPMLConfigBuilder.js +0 -0
- /package/{build → dist}/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts +0 -0
- /package/{build → dist}/plugins/dependency-extraction-webpack-plugin-config-builder.js +0 -0
- /package/{build → dist}/plugins/static-configs.d.ts +0 -0
- /package/{build → dist}/plugins/static-configs.js +0 -0
- /package/{build → dist}/utils/common-config-helpers.d.ts +0 -0
- /package/{build → dist}/utils/css-writer.d.ts +0 -0
- /package/{build → dist}/utils/css-writer.js +0 -0
- /package/{build → dist}/utils/entrypoint-resolution-logic.d.ts +0 -0
- /package/{build → dist}/utils/entrypoint-resolution-logic.js +0 -0
- /package/{build → dist}/utils/location-encoding-filename-parser.d.ts +0 -0
- /package/{build → dist}/utils/location-encoding-filename-parser.js +0 -0
- /package/{build → dist}/utils/pseduo-semaphore.d.ts +0 -0
- /package/{build → dist}/utils/pseduo-semaphore.js +0 -0
- /package/{build → dist}/wordpress-scripts-wrapper.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -60,6 +60,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
60
60
|
- Legacy PostCSS features that have been integrated into modern CSS
|
|
61
61
|
- `@extends` support
|
|
62
62
|
|
|
63
|
+
## [2.88.0] - 2026-03-30
|
|
64
|
+
### Added
|
|
65
|
+
- Support for explicitly setting the handle for block assets
|
|
66
|
+
|
|
67
|
+
## [2.87.1] - 2026-03-17
|
|
68
|
+
### Changed
|
|
69
|
+
- The `blockdir-loader.php` generation logic to use static wp_register_* calls like `plain-entrypoints-loader.php`
|
|
70
|
+
|
|
63
71
|
## [2.87.0] - 2026-03-16
|
|
64
72
|
### Added
|
|
65
73
|
- Support for a directory-based `extensions` layout
|
package/USER-GUIDE.md
CHANGED
|
@@ -400,7 +400,8 @@ This section covers the shared options for entrypoints. See the [Entrypoint Type
|
|
|
400
400
|
- These are URL-style queries added to the end of entrypoint *source* paths and are used to set entrypoint-specific properties in Plain and Block contexts.
|
|
401
401
|
- If you find yourself using these, consider switching to [Location-Encoding Filenames](#location-encoding-filenames)
|
|
402
402
|
- At present, this is only being used to configure inlining, but expansion to other systems is being considered
|
|
403
|
-
- The available options are: `strategy`, `inline`, `in_footer`, `fetchpriority`, and `
|
|
403
|
+
- The available options are: `strategy`, `inline`, `in_footer`, `fetchpriority`, `position`, and `handle`
|
|
404
|
+
- Handle is only available on blocks – declare the handle using the [Locations object](#the-locations-object)
|
|
404
405
|
|
|
405
406
|
### Boolean-form
|
|
406
407
|
- This is only available if `outputDir` has been set
|
|
@@ -520,7 +521,7 @@ Filenames **must** follow the pattern: `{kebab-case-block-name}-{type}.{ext}`
|
|
|
520
521
|
- This is only available in extensions v2 and up
|
|
521
522
|
|
|
522
523
|
#### Notes
|
|
523
|
-
-
|
|
524
|
+
- To have a directory be treated as `extensions`, the config **must** include `directoryLayout: 'extensions'`
|
|
524
525
|
- Extensions **should** be created with `pnpm @plaudit/scaffold create extension`
|
|
525
526
|
|
|
526
527
|
#### Per-Entrypoint Options
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Compilation } from "webpack";
|
|
2
|
+
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
1
3
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
4
|
import { ParsedAssetsJson, BlockEntrypointInfo, FileSegmentBlockEntrypointInfo, VerifiedAdvancedOutputConfig, ParsedAssetJsonProvider, ScriptArgsObject, InlinedAsset } from "../shared";
|
|
3
5
|
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
4
|
-
import { Compilation } from "webpack";
|
|
5
|
-
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
6
6
|
type WorkableBlockEntrypointInfo = Omit<FileSegmentBlockEntrypointInfo, 'originalValue' | 'pathQueryParameters'> & Partial<Pick<FileSegmentBlockEntrypointInfo, 'originalValue'>> & {
|
|
7
7
|
outputPath: string;
|
|
8
8
|
assetData: ParsedAssetsJson[string];
|
|
@@ -22,6 +22,7 @@ export declare class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEnt
|
|
|
22
22
|
constructor(config: VerifiedPlauditWordpressWebpackConfig, dest: VerifiedAdvancedOutputConfig, webpackRemoveEmptyScriptsPlugin: WebpackRemoveEmptyScriptsPlugin, context: string, entry: EntryProvider<BlockEntrypointInfo>);
|
|
23
23
|
protected processAssets(compilation: Compilation, parsedAssetJsonProvider: ParsedAssetJsonProvider): Promise<void>;
|
|
24
24
|
private emitBlockLoaderFile;
|
|
25
|
+
private callRegisterFunction;
|
|
25
26
|
private transformBlocks;
|
|
26
27
|
private static extractAssetSource;
|
|
27
28
|
private static convertToScriptHandles;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.EnhancedBlockJSONPlugin = void 0;
|
|
7
|
-
const node_crypto_1 =
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
5
|
const promises_1 = require("node:fs/promises");
|
|
9
|
-
const node_fs_1 =
|
|
10
|
-
const node_path_1 =
|
|
11
|
-
const AbstractBiPhasicGroupAndEntryPlugin_1 = require("./AbstractBiPhasicGroupAndEntryPlugin");
|
|
12
|
-
const UnifiedLoaderGenerator_1 = require("./UnifiedLoaderGenerator");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
13
8
|
const php_writer_1 = require("@plaudit/php-writer");
|
|
14
9
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
10
|
+
const webpack_1 = require("webpack");
|
|
11
|
+
const AbstractBiPhasicGroupAndEntryPlugin_1 = require("./AbstractBiPhasicGroupAndEntryPlugin");
|
|
12
|
+
const UnifiedLoaderGenerator_1 = require("./UnifiedLoaderGenerator");
|
|
15
13
|
const shared_1 = require("../shared");
|
|
16
14
|
const path_query_and_related_helpers_1 = require("../utils/path-query-and-related-helpers");
|
|
17
15
|
const pseduo_semaphore_1 = require("../utils/pseduo-semaphore");
|
|
18
|
-
const webpack_1 = require("webpack");
|
|
19
16
|
class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.AbstractBiPhasicGroupAndEntryPlugin {
|
|
20
17
|
dest;
|
|
21
18
|
webpackRemoveEmptyScriptsPlugin;
|
|
@@ -30,7 +27,7 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
30
27
|
const blockJsonOriginToOutputMapping = {};
|
|
31
28
|
const relevantEntrypoints = this.getRelevantEntrypoints(compilation).toArray();
|
|
32
29
|
for (const { entrypoint, metadata, srcPath } of relevantEntrypoints) {
|
|
33
|
-
if (node_path_1.
|
|
30
|
+
if ((0, node_path_1.basename)(srcPath).toLowerCase() !== "block.json" || !('purpose' in metadata) || metadata.purpose !== "block-json-inclusion-assurance") {
|
|
34
31
|
continue;
|
|
35
32
|
}
|
|
36
33
|
const asset = [...compilation.chunkGraph.getChunkEntryModulesIterable(entrypoint.getEntrypointChunk())][0]?.originalSource();
|
|
@@ -48,11 +45,11 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
for (const { entrypoint, metadata, srcPath } of relevantEntrypoints) {
|
|
51
|
-
if (node_path_1.
|
|
48
|
+
if ((0, node_path_1.basename)(srcPath).toLowerCase() === "block.json" || 'purpose' in metadata) {
|
|
52
49
|
continue;
|
|
53
50
|
}
|
|
54
51
|
const entrypointChunk = entrypoint.getEntrypointChunk();
|
|
55
|
-
const epBlockJson = entrypointChunk.auxiliaryFiles.values().find(auxFile => node_path_1.
|
|
52
|
+
const epBlockJson = entrypointChunk.auxiliaryFiles.values().find(auxFile => (0, node_path_1.basename)(auxFile) === "block.json")
|
|
56
53
|
?? blockJsonOriginToOutputMapping[metadata.blockJsonOrigin];
|
|
57
54
|
if (epBlockJson) {
|
|
58
55
|
const assetData = parsedAssetJsonProvider(entrypoint, metadata)?.assetData;
|
|
@@ -65,7 +62,7 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
65
62
|
.map(file => [file, (0, shared_1.scriptOrStyleTest)(file, shared_1.scriptExtension)])
|
|
66
63
|
.filter((item) => item[1] !== '')
|
|
67
64
|
.map(([file, assetType]) => {
|
|
68
|
-
const enqueuingFlags = (0, path_query_and_related_helpers_1.
|
|
65
|
+
const enqueuingFlags = (0, path_query_and_related_helpers_1.mergeTwoEnqueuingControlFlagSets)(file, metadata.enqueuingFlags, this.dest.enqueuingFlags);
|
|
69
66
|
const { scriptArgsObject, inlinedAsset } = (0, path_query_and_related_helpers_1.convertEnqueuingControlFlagsToScriptArgsObject)(compilation, file, enqueuingFlags);
|
|
70
67
|
const wasOriginallyAStyleField = (0, shared_1.isStyleField)(metadata.entrypointField);
|
|
71
68
|
const outputPath = this.stripOffBlocksDestPrefix(file);
|
|
@@ -88,10 +85,10 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
88
85
|
}
|
|
89
86
|
EnhancedBlockJSONPlugin.semaphore.resolve(this.id, {
|
|
90
87
|
collatableWorkableBlockInfo: applicableBlockJsonFiles, blocksDest: this.dest.destination,
|
|
91
|
-
emittingWpmlXml: compilation.getAsset(node_path_1.
|
|
88
|
+
emittingWpmlXml: compilation.getAsset((0, node_path_1.join)(this.dest.destination, "wpml-config.xml")) !== undefined
|
|
92
89
|
});
|
|
93
90
|
const generateLoader = (writer) => {
|
|
94
|
-
writer.require(node_path_1.
|
|
91
|
+
writer.require((0, node_path_1.join)(this.dest.destination, "blockdir-loader.php"), { dirRelative: true, once: true });
|
|
95
92
|
};
|
|
96
93
|
let action;
|
|
97
94
|
const lazyLoader = this.dest.lazyLoader;
|
|
@@ -136,15 +133,23 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
136
133
|
const finalizedMetadata = Object.fromEntries(Object.entries(metadata)
|
|
137
134
|
.map(([key, value]) => {
|
|
138
135
|
if (key === 'scriptHandles') {
|
|
139
|
-
return [key,
|
|
136
|
+
return [key, []];
|
|
140
137
|
}
|
|
141
138
|
if (key === 'styleHandles') {
|
|
142
|
-
return [key,
|
|
139
|
+
return [key, []];
|
|
140
|
+
}
|
|
141
|
+
if (key === 'scriptModuleHandles') {
|
|
142
|
+
return [key, []];
|
|
143
143
|
}
|
|
144
144
|
return [key, value];
|
|
145
145
|
}));
|
|
146
146
|
const writer = new php_writer_1.PHPWriter()
|
|
147
147
|
.action("init", writer => {
|
|
148
|
+
const baseUriVar = new expressions_1.Var("base_uri");
|
|
149
|
+
writer.call("plaudit_webpack_extensions__resolve_base_uri", [expressions_1.Constants.__DIR__], { assignTo: baseUriVar });
|
|
150
|
+
this.callRegisterFunction('script', writer, baseUriVar, Object.entries(finalizedScriptHandles));
|
|
151
|
+
this.callRegisterFunction('style', writer, baseUriVar, Object.entries(finalizedStyleHandles));
|
|
152
|
+
this.callRegisterFunction('script_module', writer, baseUriVar, Object.entries(metadata.scriptModuleHandles));
|
|
148
153
|
writer.call("\\Plaudit\\Common\\ACF\\BlockManager::autoloadSubfoldersV3", [
|
|
149
154
|
expressions_1.Constants.__DIR__, // string $dir
|
|
150
155
|
new expressions_1.EnclosedLiteral((0, shared_1.makeEmittableConfigPHP)(blockData, false, "\t")), // array $blockdirConfig
|
|
@@ -159,10 +164,15 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
159
164
|
(0, shared_1.appendAddInlineAssetCall)(compilation, writer, ...inlinableStyle);
|
|
160
165
|
}
|
|
161
166
|
}, { accountForAlreadyDoing: this.config.includePostInitFallback });
|
|
162
|
-
(0, shared_1.emitPHPWriterAsAsset)(writer, compilation, node_path_1.
|
|
167
|
+
(0, shared_1.emitPHPWriterAsAsset)(writer, compilation, (0, node_path_1.join)(this.dest.destination, "blockdir-loader.php"));
|
|
163
168
|
}
|
|
164
169
|
else {
|
|
165
|
-
compilation.emitAsset(node_path_1.
|
|
170
|
+
compilation.emitAsset((0, node_path_1.join)(this.dest.destination, "blockdir.config.php"), new webpack_1.sources.RawSource((0, shared_1.makeEmittableConfigPHP)(blockDirConfig, true)));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
callRegisterFunction(type, writer, baseUriVar, handles) {
|
|
174
|
+
for (const [name, { src, rest }] of handles) {
|
|
175
|
+
writer.call(`wp_register_${type}`, [name, src === false ? false : expressions_1.Op.concat(baseUriVar, src), ...rest]);
|
|
166
176
|
}
|
|
167
177
|
}
|
|
168
178
|
transformBlocks(compilation, collatedWorkableBlockInfo, emittingWpmlXml) {
|
|
@@ -179,8 +189,8 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
179
189
|
compilation.errors.push((0, shared_1.newWebpackErrorForFile)(`${blockJsonAssetName} does not have recorded text`, blockJsonAssetName));
|
|
180
190
|
continue;
|
|
181
191
|
}
|
|
182
|
-
const sourceDir = node_path_1.
|
|
183
|
-
const outputDir = node_path_1.
|
|
192
|
+
const sourceDir = (0, node_path_1.dirname)(blockJsonSourcePath);
|
|
193
|
+
const outputDir = (0, node_path_1.join)(compilation.compiler.outputPath, (0, node_path_1.dirname)(blockJsonAssetName));
|
|
184
194
|
const blockJson = JSON.parse(blockJsonText);
|
|
185
195
|
const pathsNeedRemapping = !this.config.standaloneBlocks && blockJson["plaudit"] !== "simple";
|
|
186
196
|
EnhancedBlockJSONPlugin.remapReferencedPHPFilesOnKey(blockJson, "setup", pathsNeedRemapping, sourceDir, outputDir, compilation, true);
|
|
@@ -194,11 +204,11 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
194
204
|
blockJson["version"] = hashForVersion;
|
|
195
205
|
}
|
|
196
206
|
EnhancedBlockJSONPlugin.normalizeRenderTemplate(blockJson, pathsNeedRemapping, sourceDir, outputDir, compilation);
|
|
197
|
-
const blockDirName = node_path_1.
|
|
207
|
+
const blockDirName = (0, node_path_1.dirname)((0, node_path_1.relative)(this.dest.destination, blockJsonAssetName));
|
|
198
208
|
blockData[blockDirName] = EnhancedBlockJSONPlugin
|
|
199
209
|
.doFileOrHandleReplacements(compilation, Object.fromEntries(Object.entries(blockJson).filter(([k]) => k !== '$schema')), workableBlockEntrypointsInfo, epi => epi.handle);
|
|
200
|
-
|
|
201
|
-
|
|
210
|
+
const emittableBlockJson = EnhancedBlockJSONPlugin.doFileOrHandleReplacements(compilation, blockJson, workableBlockEntrypointsInfo, epi => "file:./" + (0, node_path_1.relative)(blockDirName, epi.outputPath));
|
|
211
|
+
compilation[blockJsonAssetName in compilation.assets ? 'updateAsset' : 'emitAsset'](blockJsonAssetName, new webpack_1.sources.RawSource(JSON.stringify(emittableBlockJson, undefined, " ")));
|
|
202
212
|
}
|
|
203
213
|
return {
|
|
204
214
|
__metadata: {
|
|
@@ -284,13 +294,13 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
284
294
|
return this.dest.destination && file.startsWith(this.dest.destination + "/") ? file.substring(this.dest.destination.length + 1 /* we also need to drop the "/" */) : file;
|
|
285
295
|
}
|
|
286
296
|
static hashThingForAsset(thing) {
|
|
287
|
-
return node_crypto_1.
|
|
297
|
+
return (0, node_crypto_1.createHash)('md5').update(thing).digest("hex").substring(0, 20).toLowerCase();
|
|
288
298
|
}
|
|
289
299
|
static stripFilePrefix(file) {
|
|
290
300
|
return file.startsWith("file:./") ? file.substring(7) : file;
|
|
291
301
|
}
|
|
292
302
|
static findCommonAncestor(...paths) {
|
|
293
|
-
return paths.map(p => node_path_1.
|
|
303
|
+
return paths.map(p => (0, node_path_1.normalize)(p).split(node_path_1.sep)).reduce((prior, current) => {
|
|
294
304
|
for (let i = 0, limit = Math.min(prior.length, current.length); i < limit; i++) {
|
|
295
305
|
if (prior[i] !== current[i]) {
|
|
296
306
|
return prior.slice(0, i);
|
|
@@ -301,9 +311,7 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
301
311
|
}
|
|
302
312
|
static findRelativeRouteBetween(path1, path2) {
|
|
303
313
|
const commonAncestor = EnhancedBlockJSONPlugin.findCommonAncestor(path1, path2);
|
|
304
|
-
|
|
305
|
-
route.push(node_path_1.default.relative(commonAncestor.join(node_path_1.default.sep), path2));
|
|
306
|
-
return route.join(node_path_1.default.sep);
|
|
314
|
+
return (".." + node_path_1.sep).repeat(path1.split(node_path_1.sep).length - commonAncestor.length) + (0, node_path_1.relative)(commonAncestor.join(node_path_1.sep), path2);
|
|
307
315
|
}
|
|
308
316
|
static remapReferencedPHPFilesOnKey(blockJson, key, pathsNeedRemapping, sourceDir, outputDir, compilation, inPlaudit) {
|
|
309
317
|
const rawValue = (inPlaudit ? blockJson["plaudit"] : blockJson)?.[key];
|
|
@@ -319,7 +327,7 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
319
327
|
}
|
|
320
328
|
else {
|
|
321
329
|
if (fileReferences.length !== 0) {
|
|
322
|
-
compilation.warnings.push((0, shared_1.newWebpackErrorForFile)(`Encountered a block with a mixture of file-reference and non-file-reference elements in the "${inPlaudit ? 'plaudit.' : ''}${key}" property`, node_path_1.
|
|
330
|
+
compilation.warnings.push((0, shared_1.newWebpackErrorForFile)(`Encountered a block with a mixture of file-reference and non-file-reference elements in the "${inPlaudit ? 'plaudit.' : ''}${key}" property`, (0, node_path_1.join)(sourceDir, 'block.json')));
|
|
323
331
|
rawFiles = fileReferences;
|
|
324
332
|
}
|
|
325
333
|
else {
|
|
@@ -336,11 +344,11 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
336
344
|
}
|
|
337
345
|
const mappedFiles = pathsNeedRemapping
|
|
338
346
|
? rawFiles
|
|
339
|
-
.map(p => node_path_1.
|
|
340
|
-
.filter(
|
|
347
|
+
.map(p => (0, node_path_1.normalize)((0, node_path_1.join)(sourceDir, EnhancedBlockJSONPlugin.stripFilePrefix(p))))
|
|
348
|
+
.filter(node_fs_1.existsSync)
|
|
341
349
|
.map(p => `file:./${EnhancedBlockJSONPlugin.findRelativeRouteBetween(outputDir, p)}`)
|
|
342
350
|
: rawFiles
|
|
343
|
-
.filter(p => node_fs_1.
|
|
351
|
+
.filter(p => (0, node_fs_1.existsSync)((0, node_path_1.normalize)((0, node_path_1.join)(sourceDir, EnhancedBlockJSONPlugin.stripFilePrefix(p)))));
|
|
344
352
|
if (mappedFiles.length === 0) {
|
|
345
353
|
if (deleteOnEmpty && rawValue !== undefined) {
|
|
346
354
|
delete (inPlaudit ? blockJson["plaudit"] : blockJson)[key];
|
|
@@ -376,11 +384,11 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
376
384
|
: [`${blockName.substring(blockName.indexOf('/') + 1)}.php`, "template.php", "template.twig"]);
|
|
377
385
|
const renderTemplate = pathsNeedRemapping
|
|
378
386
|
? rawRenderTemplate
|
|
379
|
-
.map(p => node_path_1.
|
|
380
|
-
.filter(
|
|
387
|
+
.map(p => (0, node_path_1.normalize)((0, node_path_1.join)(sourceDir, EnhancedBlockJSONPlugin.stripFilePrefix(p))))
|
|
388
|
+
.filter(node_fs_1.existsSync)
|
|
381
389
|
.map(p => `file:./${EnhancedBlockJSONPlugin.findRelativeRouteBetween(outputDir, p)}`)
|
|
382
390
|
: rawRenderTemplate
|
|
383
|
-
.filter(p => node_fs_1.
|
|
391
|
+
.filter(p => (0, node_fs_1.existsSync)((0, node_path_1.normalize)((0, node_path_1.join)(sourceDir, EnhancedBlockJSONPlugin.stripFilePrefix(p)))));
|
|
384
392
|
if (renderTemplate.length === 0) {
|
|
385
393
|
delete blockJson["render_template"];
|
|
386
394
|
delete blockJson["render"];
|
|
@@ -399,7 +407,7 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
399
407
|
}
|
|
400
408
|
delete blockJson[invalidTemplateLocation];
|
|
401
409
|
if (renderTemplate.length > 1) {
|
|
402
|
-
compilation.warnings.push((0, shared_1.newWebpackErrorForFile)("Encountered a block with multiple possible render files", node_path_1.
|
|
410
|
+
compilation.warnings.push((0, shared_1.newWebpackErrorForFile)("Encountered a block with multiple possible render files", (0, node_path_1.join)(sourceDir, 'block.json')));
|
|
403
411
|
blockJson[validTemplateLocation] = renderTemplate.find(p => p.endsWith(".php")) ?? renderTemplate[0];
|
|
404
412
|
}
|
|
405
413
|
else {
|
|
@@ -446,7 +454,7 @@ class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.Abst
|
|
|
446
454
|
compilation.hooks.processAssets.tapPromise({ name: `${this.constructor.name}_CompileLoader`, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER }, async () => {
|
|
447
455
|
const relevantEntrypoints = this.getRelevantEntrypoints(compilation).toArray();
|
|
448
456
|
for (const { entrypoint, metadata, srcPath } of relevantEntrypoints) {
|
|
449
|
-
if (node_path_1.
|
|
457
|
+
if ((0, node_path_1.basename)(srcPath).toLowerCase() !== "block.json" || !('purpose' in metadata) || metadata.purpose !== "block-json-inclusion-assurance") {
|
|
450
458
|
continue;
|
|
451
459
|
}
|
|
452
460
|
const entrypointChunk = entrypoint.getEntrypointChunk();
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.PlainEntrypointsConfigFileGeneratorPlugin = void 0;
|
|
7
|
-
const node_path_1 =
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
8
5
|
const php_writer_1 = require("@plaudit/php-writer");
|
|
9
6
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
10
7
|
const shared_1 = require("../shared");
|
|
@@ -27,7 +24,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
27
24
|
this.useUnifiedLoader = useUnifiedLoader;
|
|
28
25
|
}
|
|
29
26
|
generatePlainEntrypointsLoader(compilation, assets) {
|
|
30
|
-
const emitDir = node_path_1.
|
|
27
|
+
const emitDir = (0, node_path_1.join)(this.buildRoot, this.outputDir);
|
|
31
28
|
const handleLists = {
|
|
32
29
|
register: [],
|
|
33
30
|
inline: [],
|
|
@@ -44,14 +41,14 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
44
41
|
const plainEntrypointsConfig = { scriptHandles: {}, script_moduleHandles: {}, styleHandles: {} };
|
|
45
42
|
for (const { handles, handlePrefix } of assets) {
|
|
46
43
|
for (const { src, rest, locations, type, handleName, lazyLoader, ...otherProps } of handles) {
|
|
47
|
-
const
|
|
44
|
+
const cleanBasename = (0, node_path_1.basename)(src).replace(/_(?:script(?:-\d+)?\.js|style(?:-\d+)?\.css)$|(?<!_(script|style))\.(js|css)$/, "");
|
|
48
45
|
let finalHandleName;
|
|
49
46
|
if (typeof handleName === 'string') {
|
|
50
|
-
finalHandleName = (0, shared_1.convertUsageLocationsHandleToEmittableHandle)(handleName,
|
|
47
|
+
finalHandleName = (0, shared_1.convertUsageLocationsHandleToEmittableHandle)(handleName, cleanBasename);
|
|
51
48
|
}
|
|
52
49
|
else {
|
|
53
50
|
const handleNameMap = usedHandleNames[type];
|
|
54
|
-
const baseFinalHandleName = finalHandleName = `${handlePrefix}.${(0, shared_1.convertUsageLocationsHandleToEmittableHandle)((0, shared_1.kebabCase)(
|
|
51
|
+
const baseFinalHandleName = finalHandleName = `${handlePrefix}.${(0, shared_1.convertUsageLocationsHandleToEmittableHandle)((0, shared_1.kebabCase)(cleanBasename), cleanBasename)}`;
|
|
55
52
|
for (let count = 0; finalHandleName in handleNameMap && handleNameMap[finalHandleName] !== src;) {
|
|
56
53
|
finalHandleName = `${baseFinalHandleName}-${++count}`;
|
|
57
54
|
}
|
|
@@ -83,7 +80,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
83
80
|
for (const { handle, type, data } of prioritizedHandleList) {
|
|
84
81
|
const { inlinedAsset, rest, src } = data;
|
|
85
82
|
const emittedSrc = inlinedAsset === undefined
|
|
86
|
-
? expressions_1.Op.concat(baseUriVar, node_path_1.
|
|
83
|
+
? expressions_1.Op.concat(baseUriVar, (0, node_path_1.relative)(emitDir, src))
|
|
87
84
|
: false;
|
|
88
85
|
writer.call(`wp_register_${type}`, [handle, emittedSrc, ...rest]);
|
|
89
86
|
if (inlinedAsset !== undefined) {
|
|
@@ -117,7 +114,7 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
117
114
|
if (sortedEditorStyleHandles.length > 0) {
|
|
118
115
|
writer.linebreak();
|
|
119
116
|
for (const handleSrc of sortedEditorStyleHandles) {
|
|
120
|
-
const handlePath = node_path_1.
|
|
117
|
+
const handlePath = (0, node_path_1.join)(this.outputDir, (0, node_path_1.relative)(emitDir, handleSrc));
|
|
121
118
|
writer.call("add_editor_style", [(0, shared_1.leadingSlashIt)(handlePath)]);
|
|
122
119
|
}
|
|
123
120
|
}
|
|
@@ -297,15 +294,15 @@ class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAnd
|
|
|
297
294
|
chunkFiles[0][1] = true;
|
|
298
295
|
}
|
|
299
296
|
for (const [file, useHandleName] of chunkFiles) {
|
|
300
|
-
const extension = node_path_1.
|
|
297
|
+
const extension = (0, node_path_1.extname)(file).toLowerCase();
|
|
301
298
|
const type = extension === ".js" ? 'script' : (extension === ".mjs" ? 'script_module' : 'style');
|
|
302
299
|
const isScript = type !== 'style';
|
|
303
300
|
const dependencies = isScript === entrypointChunkIsScript ? assetData.dependencies : [];
|
|
304
301
|
const { lazyLoader, locations } = this.dest;
|
|
305
302
|
const { flags } = (0, path_query_and_related_helpers_1.unpackEnqueuingControlFlagsFromPathQueryParameters)(typeof locations.registerScriptArgs === 'object' ? locations.registerScriptArgs : { strategy: locations.registerScriptArgs }, file, "registerScriptArgs");
|
|
306
|
-
const { inlinedAsset, scriptArgsObject } = (0, path_query_and_related_helpers_1.convertEnqueuingControlFlagsToScriptArgsObject)(compilation, file, (0, path_query_and_related_helpers_1.
|
|
303
|
+
const { inlinedAsset, scriptArgsObject } = (0, path_query_and_related_helpers_1.convertEnqueuingControlFlagsToScriptArgsObject)(compilation, file, (0, path_query_and_related_helpers_1.mergeTwoEnqueuingControlFlagSets)(file, flags, this.dest.enqueuingFlags));
|
|
307
304
|
const rest = isScript && scriptArgsObject !== undefined ? [dependencies, assetData.version, scriptArgsObject] : [dependencies, assetData.version];
|
|
308
|
-
const destPath = node_path_1.
|
|
305
|
+
const destPath = (0, node_path_1.join)(compilation.outputOptions.path, file);
|
|
309
306
|
handles.push({
|
|
310
307
|
src: destPath,
|
|
311
308
|
rest,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PHPWriter } from "@plaudit/php-writer";
|
|
2
2
|
import type { Options as PostcssFunctionsOptions } from "postcss-functions";
|
|
3
|
-
import { AssetInfo, Compilation, Configuration, Entrypoint, WebpackError, Compiler } from "webpack";
|
|
3
|
+
import { type AssetInfo, type Compilation, type Configuration, type Entrypoint, WebpackError, type Compiler } from "webpack";
|
|
4
4
|
import { SourceType } from "./utils/entrypoint-resolution-logic";
|
|
5
5
|
import type { NormalizedEnqueuingControlFlags } from "./utils/path-query-and-related-helpers";
|
|
6
6
|
export * from "./utils/entrypoint-resolution-logic";
|
|
@@ -221,6 +221,7 @@ export declare function arrayIsLength<T, N extends number>(arr: T[] | null | und
|
|
|
221
221
|
export declare function kebabCase(value: string): string;
|
|
222
222
|
export declare function loadEnvFile(filePath: string): Promise<Record<string, string>>;
|
|
223
223
|
export declare function parseEnvFile(contents: string): Record<string, string>;
|
|
224
|
+
export declare function newCleanWebpackError(error: string | ConstructorParameters<typeof WebpackError>): WebpackError;
|
|
224
225
|
export declare function newWebpackErrorForFile(error: string | ConstructorParameters<typeof WebpackError>, file: string): WebpackError;
|
|
225
226
|
/**
|
|
226
227
|
* 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
|
package/{build → dist}/shared.js
RENAMED
|
@@ -40,6 +40,7 @@ exports.arrayIsLength = arrayIsLength;
|
|
|
40
40
|
exports.kebabCase = kebabCase;
|
|
41
41
|
exports.loadEnvFile = loadEnvFile;
|
|
42
42
|
exports.parseEnvFile = parseEnvFile;
|
|
43
|
+
exports.newCleanWebpackError = newCleanWebpackError;
|
|
43
44
|
exports.newWebpackErrorForFile = newWebpackErrorForFile;
|
|
44
45
|
exports.emitResolveBaseUriFunction = emitResolveBaseUriFunction;
|
|
45
46
|
exports.getAssetsJson = getAssetsJson;
|
|
@@ -201,9 +202,13 @@ function parseEnvFile(contents) {
|
|
|
201
202
|
return equalsPos === -1 ? [line, ""] : [line.substring(0, equalsPos), line.substring(equalsPos + 1)];
|
|
202
203
|
}));
|
|
203
204
|
}
|
|
204
|
-
function
|
|
205
|
+
function newCleanWebpackError(error) {
|
|
205
206
|
const res = typeof error === 'string' ? new webpack_1.WebpackError(error) : new webpack_1.WebpackError(...error);
|
|
206
207
|
res.hideStack = true;
|
|
208
|
+
return res;
|
|
209
|
+
}
|
|
210
|
+
function newWebpackErrorForFile(error, file) {
|
|
211
|
+
const res = newCleanWebpackError(error);
|
|
207
212
|
res.file = file;
|
|
208
213
|
return res;
|
|
209
214
|
}
|
|
@@ -8,21 +8,21 @@ exports.groupEntrypointsByAssetFile = groupEntrypointsByAssetFile;
|
|
|
8
8
|
exports.resolveEntryFromDirectory = resolveEntryFromDirectory;
|
|
9
9
|
exports.commonMakeWebpackConfig = commonMakeWebpackConfig;
|
|
10
10
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
|
-
const promises_1 =
|
|
12
|
-
const node_path_1 =
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
13
|
const location_encoding_filename_parser_1 = require("./location-encoding-filename-parser");
|
|
14
14
|
const path_query_and_related_helpers_1 = require("./path-query-and-related-helpers");
|
|
15
15
|
const shared_1 = require("../shared");
|
|
16
16
|
const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
|
|
17
17
|
function joinPossiblyAbsolutePaths(...paths) {
|
|
18
18
|
return paths.filter((p) => !!p)
|
|
19
|
-
.reduce((res, p) => !res || node_path_1.
|
|
19
|
+
.reduce((res, p) => !res || (0, node_path_1.isAbsolute)(p) ? p : (0, node_path_1.join)(res, p), '') || '.';
|
|
20
20
|
}
|
|
21
21
|
function groupEntrypointsByAssetFile(entrypoints, entrypointNameExtractor) {
|
|
22
22
|
const seenPaths = new Map();
|
|
23
23
|
for (const entrypoint of entrypoints) {
|
|
24
24
|
const entrypointName = entrypointNameExtractor(entrypoint);
|
|
25
|
-
const key = entrypointName.substring(0, entrypointName.length - node_path_1.
|
|
25
|
+
const key = entrypointName.substring(0, entrypointName.length - (0, node_path_1.extname)(entrypointName).length);
|
|
26
26
|
let seen = seenPaths.get(key);
|
|
27
27
|
if (seen === undefined) {
|
|
28
28
|
seenPaths.set(key, seen = []);
|
|
@@ -38,7 +38,7 @@ function mapToRealEntrypoints(entrypoint, dir, supportedExtensions, args) {
|
|
|
38
38
|
.filter(ep => supportedExtensions(ep) && node_fs_1.default.statSync(ep, { throwIfNoEntry: false })?.isFile())
|
|
39
39
|
.map(path_query_and_related_helpers_1.unpackPotentiallyPrefixedFilePath)
|
|
40
40
|
.map(([ep, rawPathQueryParameters]) => {
|
|
41
|
-
const parsedEntrypoint = node_path_1.
|
|
41
|
+
const parsedEntrypoint = (0, node_path_1.parse)(ep);
|
|
42
42
|
const entrypointField = shared_1.styleExtension.test(ep) ? 'style' : shared_1.scriptWithModuleExtension.test(ep) ? 'viewScriptModule' : 'script';
|
|
43
43
|
const { flags: enqueuingFlags, remainder: pathQueryParameters } = (0, path_query_and_related_helpers_1.unpackEnqueuingControlFlagsFromPathQueryParameters)(rawPathQueryParameters, ep, 'path query parameters');
|
|
44
44
|
const fakeEntrypointInfo = {
|
|
@@ -53,12 +53,12 @@ function mapToRealEntrypoints(entrypoint, dir, supportedExtensions, args) {
|
|
|
53
53
|
pathQueryParameters,
|
|
54
54
|
enqueuingFlags,
|
|
55
55
|
};
|
|
56
|
-
return [joinPossiblyAbsolutePaths(dest.destination, node_path_1.
|
|
56
|
+
return [joinPossiblyAbsolutePaths(dest.destination, (0, node_path_1.basename)(parsedEntrypoint.dir), parsedEntrypoint.name),
|
|
57
57
|
{ import: [ep], plauditMetadata: fakeEntrypointInfo }];
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
function parseEntrypointsJSON(dir, dest, supportedExtensions) {
|
|
61
|
-
const entrypointJsonOrigin = node_path_1.
|
|
61
|
+
const entrypointJsonOrigin = (0, node_path_1.join)(dir, 'entrypoints.json');
|
|
62
62
|
const entrypointsJSON = JSON.parse(node_fs_1.default.readFileSync(entrypointJsonOrigin, 'utf8'));
|
|
63
63
|
if (Array.isArray(entrypointsJSON)) {
|
|
64
64
|
return mapToRealEntrypoints(entrypointsJSON, dir, supportedExtensions, { dest, entrypointJsonOrigin });
|
|
@@ -101,7 +101,7 @@ function determineEntrypointType(entrypoint, scriptExtension) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
function injectTypeAndCountToEntrypointName(entrypointName, type, typeCounts) {
|
|
104
|
-
const entrypointBasename = entrypointName.substring(0, entrypointName.length - node_path_1.
|
|
104
|
+
const entrypointBasename = entrypointName.substring(0, entrypointName.length - (0, node_path_1.extname)(entrypointName).length);
|
|
105
105
|
const parts = [];
|
|
106
106
|
if (type) {
|
|
107
107
|
parts.push(type);
|
|
@@ -110,7 +110,7 @@ function injectTypeAndCountToEntrypointName(entrypointName, type, typeCounts) {
|
|
|
110
110
|
parts.push(typeCounts[type].toString());
|
|
111
111
|
}
|
|
112
112
|
typeCounts[type] += 1;
|
|
113
|
-
return `${entrypointBasename}_${parts.join('-')}${node_path_1.
|
|
113
|
+
return `${entrypointBasename}_${parts.join('-')}${(0, node_path_1.extname)(entrypointName)}`;
|
|
114
114
|
}
|
|
115
115
|
function addPotentiallyDuplicatedEntrypointName(entry, entrypoint, typeCounts, scriptExtension) {
|
|
116
116
|
const type = determineEntrypointType(entrypoint, scriptExtension);
|
|
@@ -123,8 +123,9 @@ function addPotentiallyDuplicatedEntrypointName(entry, entrypoint, typeCounts, s
|
|
|
123
123
|
function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
124
124
|
const { entrypointFields, processingModules, scriptExtension } = commonConfig;
|
|
125
125
|
return async () => {
|
|
126
|
+
const seenExplicitHandles = { scriptHandles: {}, styleHandles: {}, scriptModuleHandles: {} };
|
|
126
127
|
const loadingEntrypoints = [];
|
|
127
|
-
for await (const dirent of await promises_1.
|
|
128
|
+
for await (const dirent of await (0, promises_1.opendir)(srcRoot)) {
|
|
128
129
|
if (!dirent.isDirectory() || dirent.name.startsWith("~")) {
|
|
129
130
|
continue;
|
|
130
131
|
}
|
|
@@ -133,9 +134,9 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
133
134
|
const rawEntrypoints = [];
|
|
134
135
|
const wpmlFiles = [];
|
|
135
136
|
try {
|
|
136
|
-
const blockJsonOrigin = node_path_1.
|
|
137
|
-
const blockJson = JSON.parse(await promises_1.
|
|
138
|
-
const blockJsonChunkName = node_path_1.
|
|
137
|
+
const blockJsonOrigin = (0, node_path_1.join)(dir, 'block.json');
|
|
138
|
+
const blockJson = JSON.parse(await (0, promises_1.readFile)(blockJsonOrigin, 'utf8'));
|
|
139
|
+
const blockJsonChunkName = (0, node_path_1.join)(dest.destination, (0, node_path_1.relative)(srcRoot, dir), "block");
|
|
139
140
|
const filesRegisteredByJson = [];
|
|
140
141
|
const presentEntrypoints = (await Promise.all(entrypointFields
|
|
141
142
|
.filter(entrypointField => entrypointField in blockJson)
|
|
@@ -143,34 +144,36 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
143
144
|
return (Array.isArray(blockJson[entrypointField]) ? blockJson[entrypointField] : [blockJson[entrypointField]])
|
|
144
145
|
.filter(originalValue => typeof originalValue === 'string')
|
|
145
146
|
.filter(originalValue => originalValue?.startsWith("file:"))
|
|
146
|
-
.map(originalValue => {
|
|
147
|
+
.map(async (originalValue) => {
|
|
147
148
|
const [entrypointPath, rawLocalPathQueryParameters] = (0, path_query_and_related_helpers_1.unpackPotentiallyPrefixedFilePath)(originalValue);
|
|
148
|
-
const absoluteSrc = node_path_1.
|
|
149
|
+
const absoluteSrc = (0, node_path_1.normalize)((0, node_path_1.join)(dir, entrypointPath));
|
|
149
150
|
filesRegisteredByJson.push(absoluteSrc);
|
|
150
|
-
const { flags: localEnqueuingFlags, remainder: localPathQueryParameters } = (0, path_query_and_related_helpers_1.unpackEnqueuingControlFlagsFromPathQueryParameters)(rawLocalPathQueryParameters, absoluteSrc, "path query parameters");
|
|
151
|
-
const enqueuingFlags = (0, path_query_and_related_helpers_1.
|
|
151
|
+
const { flags: localEnqueuingFlags, handle, remainder: localPathQueryParameters } = (0, path_query_and_related_helpers_1.unpackEnqueuingControlFlagsFromPathQueryParameters)(rawLocalPathQueryParameters, absoluteSrc, "path query parameters");
|
|
152
|
+
const enqueuingFlags = (0, path_query_and_related_helpers_1.mergeTwoEnqueuingControlFlagSets)(absoluteSrc, localEnqueuingFlags, dest.enqueuingFlags);
|
|
152
153
|
const pathQueryParameters = { ...dest.pathQueryParameters, ...localPathQueryParameters };
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (stats.isFile()) {
|
|
156
|
-
const parsedEntrypoint = node_path_1.default.parse(node_path_1.default.normalize(node_path_1.default.join(dest.destination, node_path_1.default.relative(srcRoot, dir), entrypointPath)));
|
|
157
|
-
const extensionlessExpectedSrc = node_path_1.default.normalize(node_path_1.default.join(parsedEntrypoint.dir, parsedEntrypoint.name));
|
|
158
|
-
const entrypointName = node_path_1.default.normalize(joinPossiblyAbsolutePaths(parsedEntrypoint.dir, parsedEntrypoint.name));
|
|
159
|
-
return { entrypointField, originalValue, entrypointName, extensionlessExpectedSrc, absoluteSrc, pathQueryParameters, enqueuingFlags };
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
154
|
+
try {
|
|
155
|
+
const stats = await (0, promises_1.stat)(absoluteSrc);
|
|
156
|
+
if (!stats.isFile()) {
|
|
162
157
|
return undefined;
|
|
163
158
|
}
|
|
164
|
-
|
|
159
|
+
const parsedEntrypoint = (0, node_path_1.parse)((0, node_path_1.normalize)((0, node_path_1.join)(dest.destination, (0, node_path_1.relative)(srcRoot, dir), entrypointPath)));
|
|
160
|
+
const extensionlessExpectedSrc = (0, node_path_1.normalize)((0, node_path_1.join)(parsedEntrypoint.dir, parsedEntrypoint.name));
|
|
161
|
+
const entrypointName = (0, node_path_1.normalize)(joinPossiblyAbsolutePaths(parsedEntrypoint.dir, parsedEntrypoint.name));
|
|
162
|
+
return { entrypointField, originalValue, entrypointName, extensionlessExpectedSrc, absoluteSrc, pathQueryParameters, enqueuingFlags, handle };
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
165
167
|
});
|
|
166
|
-
})))
|
|
167
|
-
|
|
168
|
+
})))
|
|
169
|
+
.filter(pe => pe !== undefined);
|
|
170
|
+
for await (const dirent of await (0, promises_1.opendir)(dir)) {
|
|
168
171
|
if (!dirent.isFile()) {
|
|
169
172
|
continue;
|
|
170
173
|
}
|
|
171
|
-
const absoluteSrc = node_path_1.
|
|
174
|
+
const absoluteSrc = (0, node_path_1.normalize)((0, node_path_1.join)(dir, dirent.name));
|
|
172
175
|
if (filesRegisteredByJson.includes(absoluteSrc)) {
|
|
173
|
-
continue;
|
|
176
|
+
continue; //TODO: Should we make it so that encoded location data is merged in for files loaded via block.json?
|
|
174
177
|
}
|
|
175
178
|
const parsedFilename = (0, location_encoding_filename_parser_1.parseLocationEncodingFilenameForBlock)(absoluteSrc);
|
|
176
179
|
if (!parsedFilename) {
|
|
@@ -200,10 +203,10 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
200
203
|
entrypointField = (location.substring(6).toLowerCase() + type.substring(0, 1).toUpperCase() + type.substring(1));
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
|
-
const parsedEntrypoint = node_path_1.
|
|
204
|
-
const extensionlessExpectedSrc = node_path_1.
|
|
205
|
-
const entrypointName = node_path_1.
|
|
206
|
-
const enqueuingFlags = (0, path_query_and_related_helpers_1.
|
|
206
|
+
const parsedEntrypoint = (0, node_path_1.parse)((0, node_path_1.normalize)((0, node_path_1.join)(dest.destination, (0, node_path_1.relative)(srcRoot, dir), `./${dirent.name}`)));
|
|
207
|
+
const extensionlessExpectedSrc = (0, node_path_1.normalize)((0, node_path_1.join)(parsedEntrypoint.dir, parsedEntrypoint.name));
|
|
208
|
+
const entrypointName = (0, node_path_1.normalize)(joinPossiblyAbsolutePaths(parsedEntrypoint.dir, parsedEntrypoint.name));
|
|
209
|
+
const enqueuingFlags = (0, path_query_and_related_helpers_1.mergeTwoEnqueuingControlFlagSets)(absoluteSrc, flags, dest.enqueuingFlags);
|
|
207
210
|
presentEntrypoints.push({
|
|
208
211
|
entrypointField,
|
|
209
212
|
originalValue: dirent.name,
|
|
@@ -211,7 +214,8 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
211
214
|
extensionlessExpectedSrc,
|
|
212
215
|
absoluteSrc,
|
|
213
216
|
pathQueryParameters: dest.pathQueryParameters,
|
|
214
|
-
enqueuingFlags
|
|
217
|
+
enqueuingFlags,
|
|
218
|
+
handle: undefined
|
|
215
219
|
});
|
|
216
220
|
}
|
|
217
221
|
const entrypointNamesWithEffectiveDuplicates = presentEntrypoints
|
|
@@ -224,12 +228,15 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
224
228
|
const allocatedDestinations = {};
|
|
225
229
|
const resolvedBlockEntrypoints = presentEntrypoints
|
|
226
230
|
.map(presentEntrypoint => {
|
|
227
|
-
const overallSource = node_path_1.
|
|
228
|
-
const overallSourceRelativeName = node_path_1.
|
|
231
|
+
const overallSource = (0, node_path_1.dirname)(blockJsonOrigin);
|
|
232
|
+
const overallSourceRelativeName = (0, node_path_1.relative)(overallSource, (0, node_path_1.normalize)((0, node_path_1.join)(blockJsonOrigin, (0, node_path_1.relative)(overallSource, presentEntrypoint.extensionlessExpectedSrc))));
|
|
229
233
|
const handleSuffix = (0, shared_1.convertUsageLocationsHandleToEmittableHandle)(dest.locations.handle, overallSourceRelativeName);
|
|
230
234
|
const handleGroup = (0, shared_1.getHandleGroup)(presentEntrypoint.entrypointField);
|
|
235
|
+
if (presentEntrypoint.handle) {
|
|
236
|
+
(seenExplicitHandles[handleGroup][presentEntrypoint.handle] ??= []).push(overallSource);
|
|
237
|
+
}
|
|
231
238
|
if (!entrypointNamesWithEffectiveDuplicates[presentEntrypoint.entrypointName]) {
|
|
232
|
-
return { blockJsonOrigin, ...presentEntrypoint, handle: `${handlePrefix}/${handleSuffix}`, dest, handleGroup };
|
|
239
|
+
return { blockJsonOrigin, ...presentEntrypoint, handle: presentEntrypoint.handle ?? `${handlePrefix}/${handleSuffix}`, dest, handleGroup };
|
|
233
240
|
}
|
|
234
241
|
const baseSuffix = `_${(0, shared_1.isStyleField)(presentEntrypoint.entrypointField) ? "style" : "script"}`;
|
|
235
242
|
let count = 0, suffix = baseSuffix, deduplicatedEntrypointName;
|
|
@@ -244,7 +251,7 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
244
251
|
...presentEntrypoint,
|
|
245
252
|
entrypointName: deduplicatedEntrypointName,
|
|
246
253
|
extensionlessExpectedSrc: deduplicatedExtensionlessExpectedSrc,
|
|
247
|
-
handle: `${handlePrefix}/${count ? handleSuffix + "_" + count : handleSuffix}`, handleGroup,
|
|
254
|
+
handle: presentEntrypoint.handle ?? `${handlePrefix}/${count ? handleSuffix + "_" + count : handleSuffix}`, handleGroup,
|
|
248
255
|
dest
|
|
249
256
|
};
|
|
250
257
|
});
|
|
@@ -259,12 +266,12 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
259
266
|
];
|
|
260
267
|
}));
|
|
261
268
|
rawEntrypoints.push([blockJsonChunkName, { import: [blockJsonOrigin], plauditMetadata: { purpose: "block-json-inclusion-assurance", dest, absoluteSrc: blockJsonOrigin } }]);
|
|
262
|
-
wpmlFiles.push(node_path_1.
|
|
269
|
+
wpmlFiles.push((0, node_path_1.join)(dir, 'block.json'));
|
|
263
270
|
}
|
|
264
271
|
catch (e) {
|
|
265
272
|
try {
|
|
266
|
-
const packageJsonOrigin = node_path_1.
|
|
267
|
-
const packageJson = JSON.parse(await promises_1.
|
|
273
|
+
const packageJsonOrigin = (0, node_path_1.join)(dir, 'package.json');
|
|
274
|
+
const packageJson = JSON.parse(await (0, promises_1.readFile)(packageJsonOrigin, 'utf8'));
|
|
268
275
|
if (packageJson['main']) {
|
|
269
276
|
rawEntrypoints.push(...mapToRealEntrypoints(packageJson['main'], dir, commonConfig.scriptExtension.test, { dest, entrypointJsonOrigin: packageJsonOrigin }));
|
|
270
277
|
}
|
|
@@ -283,8 +290,8 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
283
290
|
}
|
|
284
291
|
if (!processingModules) {
|
|
285
292
|
try {
|
|
286
|
-
const wpmlFilePath = node_path_1.
|
|
287
|
-
await promises_1.
|
|
293
|
+
const wpmlFilePath = (0, node_path_1.join)(dir, "wpml-config.xml");
|
|
294
|
+
await (0, promises_1.access)(wpmlFilePath);
|
|
288
295
|
wpmlFiles.push(wpmlFilePath);
|
|
289
296
|
}
|
|
290
297
|
catch (e) {
|
|
@@ -296,6 +303,13 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
296
303
|
}
|
|
297
304
|
const allEntrypoints = await Promise.all(loadingEntrypoints);
|
|
298
305
|
const perAssetPathGroupedEntrypoints = groupEntrypointsByAssetFile(allEntrypoints.flatMap(e => e[0]), e => e[0]);
|
|
306
|
+
const conflictingHandles = Object.values(seenExplicitHandles)
|
|
307
|
+
.flatMap(handles => Object.entries(handles))
|
|
308
|
+
.filter(([, sources]) => sources.length > 0)
|
|
309
|
+
.map(([handle, sources]) => `${handle}: ${sources.join(", ")}`);
|
|
310
|
+
if (conflictingHandles.length > 0) {
|
|
311
|
+
throw (0, shared_1.newCleanWebpackError)("Encountered conflicting explicitly-set handles:\n" + conflictingHandles.join("\n"));
|
|
312
|
+
}
|
|
299
313
|
const currentEntry = {};
|
|
300
314
|
for (const groupedEntrypoints of perAssetPathGroupedEntrypoints.values()) {
|
|
301
315
|
if (groupedEntrypoints.length === 1 && groupedEntrypoints[0] !== undefined) {
|
|
@@ -310,10 +324,10 @@ function resolveEntryFromDirectory(commonConfig, srcRoot, dest) {
|
|
|
310
324
|
}
|
|
311
325
|
if (!processingModules) {
|
|
312
326
|
const wpmlEntrypointFiles = allEntrypoints.flatMap(e => e[1]);
|
|
313
|
-
const absoluteSrc = node_path_1.
|
|
327
|
+
const absoluteSrc = (0, node_path_1.join)(srcRoot, "wpml-config.xml");
|
|
314
328
|
try {
|
|
315
|
-
await promises_1.
|
|
316
|
-
currentEntry["wpml-config.xml"] = { import: [node_path_1.
|
|
329
|
+
await (0, promises_1.access)(absoluteSrc);
|
|
330
|
+
currentEntry["wpml-config.xml"] = { import: [(0, node_path_1.join)(srcRoot, "wpml-config.xml"), ...wpmlEntrypointFiles], plauditMetadata: { purpose: "wpml-config-xml", dest, absoluteSrc } };
|
|
317
331
|
}
|
|
318
332
|
catch (e) {
|
|
319
333
|
// If the wpml-config.xml file does not exist, just "import" the other files that will be used to build the emitted version
|
|
@@ -333,14 +347,14 @@ function commonMakeWebpackConfig(config, commonConfig, webpackConfig, externaliz
|
|
|
333
347
|
let viableRoots = [...(Array.isArray(webpackConfig.context) ? webpackConfig.context : [webpackConfig.context ?? process.cwd()])];
|
|
334
348
|
let wpContentHolderDirectory = process.cwd();
|
|
335
349
|
while (wpContentHolderDirectory.length > 5) {
|
|
336
|
-
if (node_path_1.
|
|
337
|
-
wpContentHolderDirectory = node_path_1.
|
|
350
|
+
if ((0, node_path_1.basename)(wpContentHolderDirectory) === 'wp-content') {
|
|
351
|
+
wpContentHolderDirectory = (0, node_path_1.dirname)(wpContentHolderDirectory);
|
|
338
352
|
if (wpContentHolderDirectory.length > 5) {
|
|
339
353
|
viableRoots.push(wpContentHolderDirectory);
|
|
340
354
|
}
|
|
341
355
|
break;
|
|
342
356
|
}
|
|
343
|
-
wpContentHolderDirectory = node_path_1.
|
|
357
|
+
wpContentHolderDirectory = (0, node_path_1.dirname)(wpContentHolderDirectory);
|
|
344
358
|
}
|
|
345
359
|
const distinctViableRoots = new Set();
|
|
346
360
|
viableRoots = viableRoots.filter(value => distinctViableRoots.has(value) ? false : distinctViableRoots.add(value) && true);
|
|
@@ -387,16 +401,16 @@ function commonMakeWebpackConfig(config, commonConfig, webpackConfig, externaliz
|
|
|
387
401
|
...(webpackConfig.optimization?.splitChunks || {}),
|
|
388
402
|
cacheGroups: {
|
|
389
403
|
style: {
|
|
390
|
-
// This is a flagrant abuse of cache groups, but it fixes a persistent problem wherein the dependencies and versions of scripts and styles were bleeding into each
|
|
404
|
+
// This is a flagrant abuse of cache groups, but it fixes a persistent problem wherein the dependencies and versions of scripts and styles were bleeding into each other
|
|
391
405
|
type: 'css/mini-extract',
|
|
392
406
|
chunks: 'all',
|
|
393
407
|
enforce: true,
|
|
394
408
|
name(_, chunks, cacheGroupKey) {
|
|
395
409
|
const chunkName = chunks.find(chunk => chunk.name)?.name;
|
|
396
410
|
// We use "__${cacheGroupKey}__" instead of "${cacheGroupKey}-" to make it easier to remove when generating the filename
|
|
397
|
-
const filename = `__${cacheGroupKey}__${node_path_1.
|
|
398
|
-
const
|
|
399
|
-
return
|
|
411
|
+
const filename = `__${cacheGroupKey}__${(0, node_path_1.basename)(chunkName)}`;
|
|
412
|
+
const chunkDirname = (0, node_path_1.dirname)(chunkName);
|
|
413
|
+
return chunkDirname === '.' ? filename : `${chunkDirname}/${filename}`;
|
|
400
414
|
}
|
|
401
415
|
},
|
|
402
416
|
default: false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Compilation } from "webpack";
|
|
2
|
-
import { InlinedAsset, PathQueryParameters, ScriptArgsObject } from "../shared";
|
|
2
|
+
import { type InlinedAsset, type PathQueryParameters, type ScriptArgsObject } from "../shared";
|
|
3
3
|
export declare function getAssetFileContents(compilation: Compilation, name: string): string;
|
|
4
4
|
export declare function unpackPotentiallyPrefixedFilePath(filePath: string): [string, PathQueryParameters | undefined];
|
|
5
5
|
/**
|
|
@@ -36,9 +36,10 @@ export type NormalizedEnqueuingControlFlags = {
|
|
|
36
36
|
fetchpriority?: FetchPriority;
|
|
37
37
|
position?: 'before' | 'after';
|
|
38
38
|
};
|
|
39
|
-
export declare function
|
|
39
|
+
export declare function mergeTwoEnqueuingControlFlagSets(file: string, baseArgs: NormalizedEnqueuingControlFlags | undefined, ancestorArgs: NormalizedEnqueuingControlFlags | undefined): NormalizedEnqueuingControlFlags | undefined;
|
|
40
40
|
export declare function unpackEnqueuingControlFlagsFromPathQueryParameters(pathQueryParameters: PathQueryParameters | undefined, file: string, sourceType: 'registerScriptArgs' | 'path query parameters'): {
|
|
41
41
|
flags?: NormalizedEnqueuingControlFlags;
|
|
42
|
+
handle?: string;
|
|
42
43
|
remainder?: PathQueryParameters;
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
@@ -11,7 +11,7 @@ exports.isValidFetchPriority = isValidFetchPriority;
|
|
|
11
11
|
exports.newInvalidFetchPriorityError = newInvalidFetchPriorityError;
|
|
12
12
|
exports.isValidPositionForInlineStrategy = isValidPositionForInlineStrategy;
|
|
13
13
|
exports.newInvalidPositionForInlineStrategyError = newInvalidPositionForInlineStrategyError;
|
|
14
|
-
exports.
|
|
14
|
+
exports.mergeTwoEnqueuingControlFlagSets = mergeTwoEnqueuingControlFlagSets;
|
|
15
15
|
exports.unpackEnqueuingControlFlagsFromPathQueryParameters = unpackEnqueuingControlFlagsFromPathQueryParameters;
|
|
16
16
|
exports.convertEnqueuingControlFlagsToScriptArgsObject = convertEnqueuingControlFlagsToScriptArgsObject;
|
|
17
17
|
const node_path_1 = require("node:path");
|
|
@@ -102,7 +102,7 @@ function isValidPositionForInlineStrategy(position) {
|
|
|
102
102
|
function newInvalidPositionForInlineStrategyError(position, file) {
|
|
103
103
|
return (0, shared_1.newWebpackErrorForFile)(`The position value for the inlined asset was invalid. Received: ${position}, Expected: undefined|'before'|'after'`, file);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function mergeTwoEnqueuingControlFlagSets(file, baseArgs, ancestorArgs) {
|
|
106
106
|
if (baseArgs === undefined) {
|
|
107
107
|
return ancestorArgs;
|
|
108
108
|
}
|
|
@@ -126,7 +126,7 @@ function unpackEnqueuingControlFlagsFromPathQueryParameters(pathQueryParameters,
|
|
|
126
126
|
if (pathQueryParameters === undefined) {
|
|
127
127
|
return {};
|
|
128
128
|
}
|
|
129
|
-
const { strategy, in_footer: normalizedInFooter, 'in-footer': alternateInFooter, fetchpriority, position, ...remainder } = pathQueryParameters;
|
|
129
|
+
const { strategy, in_footer: normalizedInFooter, 'in-footer': alternateInFooter, fetchpriority, position, handle, ...remainder } = pathQueryParameters;
|
|
130
130
|
let flags;
|
|
131
131
|
switch (strategy) {
|
|
132
132
|
case 'defer':
|
|
@@ -175,7 +175,10 @@ function unpackEnqueuingControlFlagsFromPathQueryParameters(pathQueryParameters,
|
|
|
175
175
|
if (flags.inline && (pathQueryParameters['position'] === 'before' || pathQueryParameters['position'] === 'after')) {
|
|
176
176
|
flags.position = pathQueryParameters['position'];
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
if (handle !== undefined && (typeof handle !== 'string' || handle.length < 5)) {
|
|
179
|
+
throw (0, shared_1.newWebpackErrorForFile)(`The handle was invalid. Received: ${handle}. Expected: a string that is at least 5 characters long`, file);
|
|
180
|
+
}
|
|
181
|
+
return Object.keys(flags).length > 0 ? { flags, handle, remainder } : { handle, remainder };
|
|
179
182
|
}
|
|
180
183
|
/**
|
|
181
184
|
* This function does a few things:
|
|
@@ -213,7 +213,7 @@ function buildVerifiedConfig(config) {
|
|
|
213
213
|
const partiallyVerifiedSources = rawSources.map(rawSource => {
|
|
214
214
|
const { destination, additionalDependencies = [], assumeGlobalizedPlauditLibraries = cfg.assumeGlobalizedPlauditLibraries, bundleAnalyzer = false, directoryLayout, externalize, withLegacyBlocksIn = false, lazyLoader, pathQueryParameters: rawPathQueryParameters, enqueuingFlags: rawEnqueuingFlags } = rawSource[1];
|
|
215
215
|
const { flags: queryEnqueuingFlags, remainder: pathQueryParameters } = (0, path_query_and_related_helpers_1.unpackEnqueuingControlFlagsFromPathQueryParameters)(rawPathQueryParameters, rawSource[0], 'path query parameters');
|
|
216
|
-
const enqueuingFlags = (0, path_query_and_related_helpers_1.
|
|
216
|
+
const enqueuingFlags = (0, path_query_and_related_helpers_1.mergeTwoEnqueuingControlFlagSets)(rawSource[0], rawEnqueuingFlags, queryEnqueuingFlags);
|
|
217
217
|
const normalizedParts = { additionalDependencies, assumeGlobalizedPlauditLibraries, bundleAnalyzer, directoryLayout, externalize, withLegacyBlocksIn, lazyLoader };
|
|
218
218
|
const locations = typeof rawSource[1].locations === 'string' || typeof rawSource[1].locations === 'function'
|
|
219
219
|
? { handle: rawSource[1].locations } : rawSource[1].locations ?? {};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.88.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
|
-
"/
|
|
6
|
+
"/dist",
|
|
7
7
|
"README.md",
|
|
8
8
|
"LICENSE.md",
|
|
9
9
|
"CHANGELOG.md",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@plaudit/gutenberg-api-extensions": "^2.
|
|
31
|
+
"@plaudit/gutenberg-api-extensions": "^2.89.0",
|
|
32
32
|
"@types/browser-sync-webpack-plugin": "^2.2.5",
|
|
33
33
|
"@types/node": "^25.5.0",
|
|
34
34
|
"@types/postcss-functions": "^4.0.4",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/webpack-sources": "^3.2.3",
|
|
37
37
|
"postcss-load-config": "^4.0.2",
|
|
38
38
|
"postcss-loader": "^7.3.4",
|
|
39
|
-
"typescript": "^
|
|
39
|
+
"typescript": "^6.0.2",
|
|
40
40
|
"webpack-bundle-analyzer": "^4.10.2"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@plaudit/postcss-silent-extend": "^3.0.0",
|
|
47
47
|
"@plaudit/postcss-strip-units": "^3.0.0",
|
|
48
48
|
"@plaudit/postcss-variables": "^1.1.0",
|
|
49
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
50
|
-
"@wordpress/scripts": "^31.
|
|
49
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.42.0",
|
|
50
|
+
"@wordpress/scripts": "^31.7.0",
|
|
51
51
|
"autoprefixer": "^10.4.27",
|
|
52
52
|
"browser-sync": "^3.0.4",
|
|
53
53
|
"copy-webpack-plugin": "10.2.4",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build": "tsc",
|
|
79
|
-
"clean": "rm -rf
|
|
79
|
+
"clean": "rm -rf dist",
|
|
80
80
|
"build:clean": "pnpm run clean && pnpm run build",
|
|
81
81
|
"watch": "tsc -w"
|
|
82
82
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|