@plaudit/webpack-extensions 2.98.0 → 2.99.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/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.d.ts +3 -3
- package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.js +2 -2
- package/dist/plugins/AbstractBiPhasicGroupPlugin.d.ts +2 -4
- package/dist/plugins/AbstractBiPhasicGroupPlugin.js +1 -3
- package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts +1 -2
- package/dist/plugins/AdditionalDependencyInjectorPlugin.js +2 -2
- package/dist/plugins/EnhancedBlockJSONPlugin.d.ts +2 -2
- package/dist/plugins/EnhancedBlockJSONPlugin.js +5 -3
- package/dist/plugins/EnhancedDynamicEntryPlugin.d.ts +2 -3
- package/dist/plugins/EnhancedDynamicEntryPlugin.js +2 -2
- package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.d.ts +2 -2
- package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.js +5 -3
- package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.d.ts +1 -2
- package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.js +2 -2
- package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.d.ts +6 -0
- package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.js +13 -0
- package/dist/plugins/MixableBiPhasicGroupPlugin.d.ts +6 -0
- package/dist/plugins/MixableBiPhasicGroupPlugin.js +13 -0
- package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.d.ts +2 -2
- package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +5 -3
- package/dist/plugins/SpecialAssetHandlingPlugin.d.ts +2 -1
- package/dist/plugins/SpecialAssetHandlingPlugin.js +5 -3
- package/dist/plugins/UnifiedLoaderGenerator.d.ts +3 -2
- package/dist/plugins/UnifiedLoaderGenerator.js +5 -3
- package/dist/plugins/VariablesJSMonitorPlugin.d.ts +1 -1
- package/dist/plugins/index.d.ts +8 -0
- package/dist/plugins/index.js +24 -0
- package/dist/shared.d.ts +4 -0
- package/dist/utils/common-config-helpers.d.ts +1 -5
- package/dist/wordpress-scripts-wrapper.js +4 -4
- package/package.json +4 -2
- /package/dist/utils/{pseduo-semaphore.d.ts → pseudo-semaphore.d.ts} +0 -0
- /package/dist/utils/{pseduo-semaphore.js → pseudo-semaphore.js} +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.99.0] - 2026-08-24
|
|
64
|
+
### Added
|
|
65
|
+
- Mixable versions of the `BiPhasicGroup...` plugins
|
|
66
|
+
- Entrypoints to allow other code to reference some of the plugins and utilities
|
|
67
|
+
|
|
68
|
+
### Internals
|
|
69
|
+
- Dropped unnecessary constructor parameters to make re-using the more general components easier
|
|
70
|
+
|
|
63
71
|
## [2.98.0] - 2026-08-18
|
|
64
72
|
### Added
|
|
65
73
|
- Automatic sync of WordPress's bundled packages list
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MinimumViableMetadata, ParsedAssetJsonProvider, ParsedAssetsJson } from "../shared";
|
|
2
|
-
import type { ExtensibleEntryObject
|
|
3
|
-
import { PseudoSemaphore } from "../utils/
|
|
2
|
+
import type { ExtensibleEntryObject } from "../utils/common-config-helpers";
|
|
3
|
+
import { PseudoSemaphore } from "../utils/pseudo-semaphore";
|
|
4
4
|
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
5
5
|
import { type Compilation, type Compiler, type Entrypoint } from "webpack";
|
|
6
6
|
export type EntryProvider<M extends MinimumViableMetadata = MinimumViableMetadata> = () => ExtensibleEntryObject<M> | Promise<ExtensibleEntryObject<M>>;
|
|
@@ -9,7 +9,7 @@ export declare abstract class AbstractBiPhasicGroupAndEntryPlugin<M extends Mini
|
|
|
9
9
|
private readonly entry;
|
|
10
10
|
private static readonly configuredCompilations;
|
|
11
11
|
private readonly entryMetadataRecord;
|
|
12
|
-
|
|
12
|
+
constructor(group: string, semaphores: PseudoSemaphore<any>[], context: string, entry: EntryProvider<M>);
|
|
13
13
|
apply(compiler: Compiler): void;
|
|
14
14
|
protected attachStandardPhase(compilation: Compilation): void;
|
|
15
15
|
/**
|
|
@@ -9,8 +9,8 @@ class AbstractBiPhasicGroupAndEntryPlugin extends AbstractBiPhasicGroupPlugin_1.
|
|
|
9
9
|
entry;
|
|
10
10
|
static configuredCompilations = new WeakSet();
|
|
11
11
|
entryMetadataRecord = {};
|
|
12
|
-
constructor(
|
|
13
|
-
super(
|
|
12
|
+
constructor(group, semaphores, context, entry) {
|
|
13
|
+
super(group, semaphores);
|
|
14
14
|
this.context = context;
|
|
15
15
|
this.entry = entry;
|
|
16
16
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Compilation, Compiler, type WebpackPluginInstance } from "webpack";
|
|
2
|
-
import { PseudoSemaphore } from "../utils/
|
|
3
|
-
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
2
|
+
import { PseudoSemaphore } from "../utils/pseudo-semaphore";
|
|
4
3
|
import { type ParsedAssetJsonProvider } from "../shared";
|
|
5
4
|
type TapWithAssetsJsonOptions = {
|
|
6
5
|
name?: string;
|
|
@@ -10,14 +9,13 @@ type TapWithAssetsJsonOptions = {
|
|
|
10
9
|
type TapWithAssetsJsonFn = Parameters<Compilation['hooks']['processAssets']['tapPromise']>[1];
|
|
11
10
|
type TapWithParsedAssetsJsonFn = (parsedAssetJsonProvider: ParsedAssetJsonProvider, assets: Parameters<TapWithAssetsJsonFn>[0]) => Promise<void> | void;
|
|
12
11
|
export declare abstract class AbstractBiPhasicGroupPlugin implements WebpackPluginInstance {
|
|
13
|
-
protected readonly config: VerifiedPlauditWordpressWebpackConfig;
|
|
14
12
|
readonly group: string;
|
|
15
13
|
private readonly semaphores;
|
|
16
14
|
protected static readonly uniquePhaseAttached: {
|
|
17
15
|
[key in string]: any;
|
|
18
16
|
};
|
|
19
17
|
protected readonly id: string;
|
|
20
|
-
|
|
18
|
+
constructor(group: string, semaphores: PseudoSemaphore<any>[]);
|
|
21
19
|
apply(compiler: Compiler): void;
|
|
22
20
|
protected resetSemaphores(): void;
|
|
23
21
|
protected rejectSemaphores(): void;
|
|
@@ -4,13 +4,11 @@ exports.AbstractBiPhasicGroupPlugin = void 0;
|
|
|
4
4
|
const webpack_1 = require("webpack");
|
|
5
5
|
const shared_1 = require("../shared");
|
|
6
6
|
class AbstractBiPhasicGroupPlugin {
|
|
7
|
-
config;
|
|
8
7
|
group;
|
|
9
8
|
semaphores;
|
|
10
9
|
static uniquePhaseAttached = {};
|
|
11
10
|
id;
|
|
12
|
-
constructor(
|
|
13
|
-
this.config = config;
|
|
11
|
+
constructor(group, semaphores) {
|
|
14
12
|
this.group = group;
|
|
15
13
|
this.semaphores = semaphores;
|
|
16
14
|
this.id = Math.random().toString();
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
2
2
|
import type { AbstractBiPhasicGroupAndEntryPlugin } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
3
|
-
import { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
4
3
|
import { Compilation } from "webpack";
|
|
5
4
|
export declare class AdditionalDependencyInjectorPlugin extends AbstractBiPhasicGroupPlugin {
|
|
6
5
|
private readonly processingModules;
|
|
7
6
|
private readonly addExternalizedDep;
|
|
8
7
|
private readonly referencePlugin;
|
|
9
|
-
constructor(
|
|
8
|
+
constructor(processingModules: boolean | undefined, addExternalizedDep: (dep: string) => void, referencePlugin: AbstractBiPhasicGroupAndEntryPlugin<any>);
|
|
10
9
|
protected attachStandardPhase(compilation: Compilation): void;
|
|
11
10
|
protected attachUniquePhase(): void;
|
|
12
11
|
}
|
|
@@ -12,8 +12,8 @@ class AdditionalDependencyInjectorPlugin extends AbstractBiPhasicGroupPlugin_1.A
|
|
|
12
12
|
processingModules;
|
|
13
13
|
addExternalizedDep;
|
|
14
14
|
referencePlugin;
|
|
15
|
-
constructor(
|
|
16
|
-
super(
|
|
15
|
+
constructor(processingModules, addExternalizedDep, referencePlugin) {
|
|
16
|
+
super("additional-dependency-injector-plugin", []);
|
|
17
17
|
this.processingModules = processingModules;
|
|
18
18
|
this.addExternalizedDep = addExternalizedDep;
|
|
19
19
|
this.referencePlugin = referencePlugin;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Compilation } from "webpack";
|
|
2
2
|
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
3
3
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
4
|
-
import { AssetMetaSegment, BlockEntrypointInfo, FileSegmentBlockEntrypointInfo, ParsedAssetJsonProvider, ParsedAssetsJson, ScriptArgsObject, VerifiedAdvancedOutputConfig } from "../shared";
|
|
5
|
-
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
4
|
+
import { AssetMetaSegment, BlockEntrypointInfo, FileSegmentBlockEntrypointInfo, ParsedAssetJsonProvider, ParsedAssetsJson, ScriptArgsObject, VerifiedAdvancedOutputConfig, VerifiedPlauditWordpressWebpackConfig } from "../shared";
|
|
6
5
|
type WorkableBlockEntrypointInfo = Omit<FileSegmentBlockEntrypointInfo, 'originalValue' | 'pathQueryParameters'> & Partial<Pick<FileSegmentBlockEntrypointInfo, 'originalValue'>> & {
|
|
7
6
|
outputPath: string;
|
|
8
7
|
assetData: ParsedAssetsJson[string];
|
|
@@ -18,6 +17,7 @@ type CollatedWorkableBlockInfo = Record<string, {
|
|
|
18
17
|
blockJsonText?: string;
|
|
19
18
|
}>;
|
|
20
19
|
export declare class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin<BlockEntrypointInfo> {
|
|
20
|
+
private readonly config;
|
|
21
21
|
private readonly dest;
|
|
22
22
|
private readonly webpackRemoveEmptyScriptsPlugin;
|
|
23
23
|
private static readonly semaphore;
|
|
@@ -12,13 +12,15 @@ const AbstractBiPhasicGroupAndEntryPlugin_1 = require("./AbstractBiPhasicGroupAn
|
|
|
12
12
|
const UnifiedLoaderGenerator_1 = require("./UnifiedLoaderGenerator");
|
|
13
13
|
const shared_1 = require("../shared");
|
|
14
14
|
const path_query_and_related_helpers_1 = require("../utils/path-query-and-related-helpers");
|
|
15
|
-
const
|
|
15
|
+
const pseudo_semaphore_1 = require("../utils/pseudo-semaphore");
|
|
16
16
|
class EnhancedBlockJSONPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.AbstractBiPhasicGroupAndEntryPlugin {
|
|
17
|
+
config;
|
|
17
18
|
dest;
|
|
18
19
|
webpackRemoveEmptyScriptsPlugin;
|
|
19
|
-
static semaphore = new
|
|
20
|
+
static semaphore = new pseudo_semaphore_1.PseudoSemaphore("Block JSON v3");
|
|
20
21
|
constructor(config, dest, webpackRemoveEmptyScriptsPlugin, context, entry) {
|
|
21
|
-
super(
|
|
22
|
+
super(`block-json-${dest.destination}`, [EnhancedBlockJSONPlugin.semaphore, UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore], context, entry);
|
|
23
|
+
this.config = config;
|
|
22
24
|
this.dest = dest;
|
|
23
25
|
this.webpackRemoveEmptyScriptsPlugin = webpackRemoveEmptyScriptsPlugin;
|
|
24
26
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Compilation } from "webpack";
|
|
2
2
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
3
|
-
import type {
|
|
4
|
-
import { ParsedAssetJsonProvider } from "../shared";
|
|
3
|
+
import type { ParsedAssetJsonProvider } from "../shared";
|
|
5
4
|
export declare class EnhancedDynamicEntryPlugin extends AbstractBiPhasicGroupAndEntryPlugin {
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(context: string, entry: EntryProvider);
|
|
7
6
|
protected attachUniquePhase(): void;
|
|
8
7
|
protected processAssets(compilation: Compilation, parsedAssetJsonProvider: ParsedAssetJsonProvider): void;
|
|
9
8
|
}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EnhancedDynamicEntryPlugin = void 0;
|
|
4
4
|
const AbstractBiPhasicGroupAndEntryPlugin_1 = require("./AbstractBiPhasicGroupAndEntryPlugin");
|
|
5
5
|
class EnhancedDynamicEntryPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.AbstractBiPhasicGroupAndEntryPlugin {
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
6
|
+
constructor(context, entry) {
|
|
7
|
+
super(`enhanced-dynamic-entries`, [], context, entry);
|
|
8
8
|
}
|
|
9
9
|
attachUniquePhase() { }
|
|
10
10
|
processAssets(compilation, parsedAssetJsonProvider) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
|
-
import { MinimumViableMetadata, ParsedAssetJsonProvider, VerifiedAdvancedOutputConfig } from "../shared";
|
|
3
|
-
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
2
|
+
import { MinimumViableMetadata, ParsedAssetJsonProvider, VerifiedAdvancedOutputConfig, VerifiedPlauditWordpressWebpackConfig } from "../shared";
|
|
4
3
|
import { Compilation, type Compiler } from "webpack";
|
|
5
4
|
export type ExtensionConfigFileGeneratorMetadata = MinimumViableMetadata & {
|
|
6
5
|
extensionId: string;
|
|
7
6
|
};
|
|
8
7
|
export declare class ExtensionsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryPlugin<ExtensionConfigFileGeneratorMetadata> {
|
|
8
|
+
private readonly config;
|
|
9
9
|
private readonly extensionsSrcPath;
|
|
10
10
|
private readonly dest;
|
|
11
11
|
private static readonly semaphore;
|
|
@@ -8,15 +8,17 @@ const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
|
8
8
|
const AbstractBiPhasicGroupAndEntryPlugin_1 = require("./AbstractBiPhasicGroupAndEntryPlugin");
|
|
9
9
|
const UnifiedLoaderGenerator_1 = require("./UnifiedLoaderGenerator");
|
|
10
10
|
const shared_1 = require("../shared");
|
|
11
|
-
const
|
|
11
|
+
const pseudo_semaphore_1 = require("../utils/pseudo-semaphore");
|
|
12
12
|
const webpack_1 = require("webpack");
|
|
13
13
|
class ExtensionsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.AbstractBiPhasicGroupAndEntryPlugin {
|
|
14
|
+
config;
|
|
14
15
|
extensionsSrcPath;
|
|
15
16
|
dest;
|
|
16
|
-
static semaphore = new
|
|
17
|
+
static semaphore = new pseudo_semaphore_1.PseudoSemaphore("Extensions");
|
|
17
18
|
setupFiles = [];
|
|
18
19
|
constructor(config, extensionsSrcPath, dest, context, entry) {
|
|
19
|
-
super(
|
|
20
|
+
super(`extensions-v2-${dest.destination}`, [ExtensionsConfigFileGeneratorPlugin.semaphore, UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore], context, entry);
|
|
21
|
+
this.config = config;
|
|
20
22
|
this.extensionsSrcPath = extensionsSrcPath;
|
|
21
23
|
this.dest = dest;
|
|
22
24
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
2
|
import type { ParsedAssetJsonProvider } from "../shared";
|
|
3
|
-
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
4
3
|
import { Compilation } from "webpack";
|
|
5
4
|
export declare class ExtensionsConfigFileGeneratorPluginV1 extends AbstractBiPhasicGroupAndEntryPlugin {
|
|
6
5
|
private readonly extensionsDest;
|
|
7
|
-
constructor(
|
|
6
|
+
constructor(extensionsDest: string, context: string, entry: EntryProvider);
|
|
8
7
|
protected attachUniquePhase(): void;
|
|
9
8
|
protected processAssets(compilation: Compilation, parsedAssetJsonProvider: ParsedAssetJsonProvider): void;
|
|
10
9
|
}
|
|
@@ -12,8 +12,8 @@ const UnifiedLoaderGenerator_1 = require("./UnifiedLoaderGenerator");
|
|
|
12
12
|
const webpack_1 = require("webpack");
|
|
13
13
|
class ExtensionsConfigFileGeneratorPluginV1 extends AbstractBiPhasicGroupAndEntryPlugin_1.AbstractBiPhasicGroupAndEntryPlugin {
|
|
14
14
|
extensionsDest;
|
|
15
|
-
constructor(
|
|
16
|
-
super(
|
|
15
|
+
constructor(extensionsDest, context, entry) {
|
|
16
|
+
super(`extensions-v1-${extensionsDest}`, [UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore], context, entry);
|
|
17
17
|
this.extensionsDest = extensionsDest;
|
|
18
18
|
}
|
|
19
19
|
attachUniquePhase() { }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
2
|
+
import { Compilation } from "webpack";
|
|
3
|
+
export declare class MixableBiPhasicGroupAndEntryPlugin extends AbstractBiPhasicGroupPlugin {
|
|
4
|
+
protected attachStandardPhase(compilation: Compilation): void;
|
|
5
|
+
protected attachUniquePhase(compilation: Compilation): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MixableBiPhasicGroupAndEntryPlugin = void 0;
|
|
4
|
+
const AbstractBiPhasicGroupPlugin_1 = require("./AbstractBiPhasicGroupPlugin");
|
|
5
|
+
class MixableBiPhasicGroupAndEntryPlugin extends AbstractBiPhasicGroupPlugin_1.AbstractBiPhasicGroupPlugin {
|
|
6
|
+
attachStandardPhase(compilation) {
|
|
7
|
+
throw new Error("This must be implemented");
|
|
8
|
+
}
|
|
9
|
+
attachUniquePhase(compilation) {
|
|
10
|
+
throw new Error("This must be implemented");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.MixableBiPhasicGroupAndEntryPlugin = MixableBiPhasicGroupAndEntryPlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
2
|
+
import { Compilation } from "webpack";
|
|
3
|
+
export declare class MixableBiPhasicGroupPlugin extends AbstractBiPhasicGroupPlugin {
|
|
4
|
+
protected attachStandardPhase(compilation: Compilation): void;
|
|
5
|
+
protected attachUniquePhase(compilation: Compilation): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MixableBiPhasicGroupPlugin = void 0;
|
|
4
|
+
const AbstractBiPhasicGroupPlugin_1 = require("./AbstractBiPhasicGroupPlugin");
|
|
5
|
+
class MixableBiPhasicGroupPlugin extends AbstractBiPhasicGroupPlugin_1.AbstractBiPhasicGroupPlugin {
|
|
6
|
+
attachStandardPhase(compilation) {
|
|
7
|
+
throw new Error("This must be implemented");
|
|
8
|
+
}
|
|
9
|
+
attachUniquePhase(compilation) {
|
|
10
|
+
throw new Error("This must be implemented");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.MixableBiPhasicGroupPlugin = MixableBiPhasicGroupPlugin;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BlockEntrypointInfo, ParsedAssetJsonProvider, VerifiedAdvancedOutputConfig } from "../shared";
|
|
2
|
-
import type { VerifiedPlauditWordpressWebpackConfig } from "../utils/common-config-helpers";
|
|
1
|
+
import { BlockEntrypointInfo, ParsedAssetJsonProvider, VerifiedAdvancedOutputConfig, VerifiedPlauditWordpressWebpackConfig } from "../shared";
|
|
3
2
|
import { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
4
3
|
import { Compilation } from "webpack";
|
|
5
4
|
export declare class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryPlugin<BlockEntrypointInfo> {
|
|
5
|
+
private readonly config;
|
|
6
6
|
private readonly buildRoot;
|
|
7
7
|
private readonly outputDir;
|
|
8
8
|
private readonly dest;
|
|
@@ -5,19 +5,21 @@ const node_path_1 = require("node:path");
|
|
|
5
5
|
const php_writer_1 = require("@plaudit/php-writer");
|
|
6
6
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
7
7
|
const shared_1 = require("../shared");
|
|
8
|
-
const
|
|
8
|
+
const pseudo_semaphore_1 = require("../utils/pseudo-semaphore");
|
|
9
9
|
const path_query_and_related_helpers_1 = require("../utils/path-query-and-related-helpers");
|
|
10
10
|
const AbstractBiPhasicGroupAndEntryPlugin_1 = require("./AbstractBiPhasicGroupAndEntryPlugin");
|
|
11
11
|
const UnifiedLoaderGenerator_1 = require("./UnifiedLoaderGenerator");
|
|
12
12
|
const webpack_1 = require("webpack");
|
|
13
13
|
class PlainEntrypointsConfigFileGeneratorPlugin extends AbstractBiPhasicGroupAndEntryPlugin_1.AbstractBiPhasicGroupAndEntryPlugin {
|
|
14
|
+
config;
|
|
14
15
|
buildRoot;
|
|
15
16
|
outputDir;
|
|
16
17
|
dest;
|
|
17
18
|
useUnifiedLoader;
|
|
18
|
-
static semaphore = new
|
|
19
|
+
static semaphore = new pseudo_semaphore_1.PseudoSemaphore("Plain");
|
|
19
20
|
constructor(config, buildRoot, outputDir, dest, useUnifiedLoader, context, entry) {
|
|
20
|
-
super(
|
|
21
|
+
super("plain-entrypoints-v2", [PlainEntrypointsConfigFileGeneratorPlugin.semaphore, UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore], context, entry);
|
|
22
|
+
this.config = config;
|
|
21
23
|
this.buildRoot = buildRoot;
|
|
22
24
|
this.outputDir = outputDir;
|
|
23
25
|
this.dest = dest;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { VerifiedPlauditWordpressWebpackConfig } from "../shared";
|
|
2
2
|
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
3
3
|
import { Compilation } from "webpack";
|
|
4
4
|
export declare class SpecialAssetHandlingPlugin extends AbstractBiPhasicGroupPlugin {
|
|
5
|
+
private readonly config;
|
|
5
6
|
private static readonly semaphore;
|
|
6
7
|
private static validPathname?;
|
|
7
8
|
constructor(config: VerifiedPlauditWordpressWebpackConfig);
|
|
@@ -8,15 +8,17 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
8
8
|
const php_writer_1 = require("@plaudit/php-writer");
|
|
9
9
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
10
10
|
const shared_1 = require("../shared");
|
|
11
|
-
const
|
|
11
|
+
const pseudo_semaphore_1 = require("../utils/pseudo-semaphore");
|
|
12
12
|
const AbstractBiPhasicGroupPlugin_1 = require("./AbstractBiPhasicGroupPlugin");
|
|
13
13
|
const UnifiedLoaderGenerator_1 = require("./UnifiedLoaderGenerator");
|
|
14
14
|
const webpack_1 = require("webpack");
|
|
15
15
|
class SpecialAssetHandlingPlugin extends AbstractBiPhasicGroupPlugin_1.AbstractBiPhasicGroupPlugin {
|
|
16
|
-
|
|
16
|
+
config;
|
|
17
|
+
static semaphore = new pseudo_semaphore_1.PseudoSemaphore("Special");
|
|
17
18
|
static validPathname = undefined;
|
|
18
19
|
constructor(config) {
|
|
19
|
-
super(
|
|
20
|
+
super("special-assets", [SpecialAssetHandlingPlugin.semaphore, UnifiedLoaderGenerator_1.UnifiedLoaderGenerator.semaphore]);
|
|
21
|
+
this.config = config;
|
|
20
22
|
}
|
|
21
23
|
attachStandardPhase(compilation) {
|
|
22
24
|
compilation.hooks.processAssets.tapPromise({ name: this.constructor.name, stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_ANALYSE }, async (assets) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PHPWriter } from "@plaudit/php-writer";
|
|
2
2
|
import { AbstractBiPhasicGroupPlugin } from "./AbstractBiPhasicGroupPlugin";
|
|
3
|
-
import
|
|
4
|
-
import { PseudoSemaphore } from "../utils/
|
|
3
|
+
import { VerifiedPlauditWordpressWebpackConfig } from "../shared";
|
|
4
|
+
import { PseudoSemaphore } from "../utils/pseudo-semaphore";
|
|
5
5
|
import { Compilation } from "webpack";
|
|
6
6
|
export type LoaderInfo = {
|
|
7
7
|
group: string;
|
|
@@ -11,6 +11,7 @@ export type LoaderInfo = {
|
|
|
11
11
|
priority?: number;
|
|
12
12
|
};
|
|
13
13
|
export declare class UnifiedLoaderGenerator extends AbstractBiPhasicGroupPlugin {
|
|
14
|
+
private readonly config;
|
|
14
15
|
static readonly semaphore: PseudoSemaphore<LoaderInfo>;
|
|
15
16
|
constructor(config: VerifiedPlauditWordpressWebpackConfig);
|
|
16
17
|
protected attachStandardPhase(compilation: Compilation): void;
|
|
@@ -39,13 +39,15 @@ const php_writer_1 = require("@plaudit/php-writer");
|
|
|
39
39
|
const expressions_1 = require("@plaudit/php-writer/expressions");
|
|
40
40
|
const AbstractBiPhasicGroupPlugin_1 = require("./AbstractBiPhasicGroupPlugin");
|
|
41
41
|
const shared_1 = require("../shared");
|
|
42
|
-
const
|
|
42
|
+
const pseudo_semaphore_1 = require("../utils/pseudo-semaphore");
|
|
43
43
|
const webpack_1 = require("webpack");
|
|
44
44
|
const promises_1 = require("node:fs/promises");
|
|
45
45
|
class UnifiedLoaderGenerator extends AbstractBiPhasicGroupPlugin_1.AbstractBiPhasicGroupPlugin {
|
|
46
|
-
|
|
46
|
+
config;
|
|
47
|
+
static semaphore = new pseudo_semaphore_1.PseudoSemaphore("Unified");
|
|
47
48
|
constructor(config) {
|
|
48
|
-
super(
|
|
49
|
+
super("unified-loader", []);
|
|
50
|
+
this.config = config;
|
|
49
51
|
}
|
|
50
52
|
attachStandardPhase(compilation) {
|
|
51
53
|
compilation.hooks.afterProcessAssets.tap(this.constructor.name, () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VerifiedPlauditWordpressWebpackConfig } from "../
|
|
1
|
+
import type { VerifiedPlauditWordpressWebpackConfig } from "../shared";
|
|
2
2
|
import type { Compiler, WebpackPluginInstance } from "webpack";
|
|
3
3
|
export declare class VariablesJSMonitorPlugin implements WebpackPluginInstance {
|
|
4
4
|
private readonly config;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
|
+
export * from "./AbstractBiPhasicGroupPlugin";
|
|
3
|
+
export * from "./EnhancedBlockJSONPlugin";
|
|
4
|
+
export * from "./ExtensionsConfigFileGeneratorPlugin";
|
|
5
|
+
export * from "./MixableBiPhasicGroupAndEntryPlugin";
|
|
6
|
+
export * from "./MixableBiPhasicGroupPlugin";
|
|
7
|
+
export * from "./PlainEntrypointsConfigFileGeneratorPlugin";
|
|
8
|
+
export * from "./UnifiedLoaderGenerator";
|
|
@@ -0,0 +1,24 @@
|
|
|
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("./AbstractBiPhasicGroupAndEntryPlugin"), exports);
|
|
18
|
+
__exportStar(require("./AbstractBiPhasicGroupPlugin"), exports);
|
|
19
|
+
__exportStar(require("./EnhancedBlockJSONPlugin"), exports);
|
|
20
|
+
__exportStar(require("./ExtensionsConfigFileGeneratorPlugin"), exports);
|
|
21
|
+
__exportStar(require("./MixableBiPhasicGroupAndEntryPlugin"), exports);
|
|
22
|
+
__exportStar(require("./MixableBiPhasicGroupPlugin"), exports);
|
|
23
|
+
__exportStar(require("./PlainEntrypointsConfigFileGeneratorPlugin"), exports);
|
|
24
|
+
__exportStar(require("./UnifiedLoaderGenerator"), exports);
|
package/dist/shared.d.ts
CHANGED
|
@@ -155,6 +155,10 @@ export type PlauditWordpressWebpackConfig = {
|
|
|
155
155
|
onlyRunPostCSSOnPCSS?: boolean;
|
|
156
156
|
useBlockSupportsAsThemeJsonDefaults?: boolean;
|
|
157
157
|
};
|
|
158
|
+
export type VerifiedPlauditWordpressWebpackConfig = Required<Omit<PlauditWordpressWebpackConfig, 'variables' | 'src' | 'externals' | 'standard'>> & {
|
|
159
|
+
variablesFilePath?: string;
|
|
160
|
+
currentVariables: Record<string, any>;
|
|
161
|
+
} & Pick<PlauditWordpressWebpackConfig, 'externals'>;
|
|
158
162
|
/** Unified-loader watch output: `dist` → `dist-dev` when SERVER_MODE is development. */
|
|
159
163
|
export declare function shouldWriteDistDev(config: Pick<PlauditWordpressWebpackConfig, 'outputDir' | 'useUnifiedLoader' | 'omitDistDev'>): boolean;
|
|
160
164
|
/**
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { AbstractBiPhasicGroupAndEntryPlugin, EntryProvider } from "../plugins/AbstractBiPhasicGroupAndEntryPlugin";
|
|
2
2
|
import type { AdditionalDependencyInjectorPlugin } from "../plugins/AdditionalDependencyInjectorPlugin";
|
|
3
|
-
import { EntrypointFields,
|
|
3
|
+
import { EntrypointFields, VerifiedPlauditWordpressWebpackConfig, BlockEntrypointInfo, VerifiedAdvancedOutputConfig, MinimumViableMetadata } from "../shared";
|
|
4
4
|
import type { Compiler, Configuration, DynamicEntryPlugin, WebpackPluginInstance } from "webpack";
|
|
5
5
|
import type WebpackRemoveEmptyScriptsPlugin from "webpack-remove-empty-scripts";
|
|
6
|
-
export type VerifiedPlauditWordpressWebpackConfig = Required<Omit<PlauditWordpressWebpackConfig, 'variables' | 'src' | 'externals' | 'standard'>> & {
|
|
7
|
-
variablesFilePath?: string;
|
|
8
|
-
currentVariables: Record<string, any>;
|
|
9
|
-
} & Pick<PlauditWordpressWebpackConfig, 'externals'>;
|
|
10
6
|
export type CommonPluginConfig = {
|
|
11
7
|
plugins: (WebpackPluginInstance | ((this: Compiler, compiler: Compiler) => void))[];
|
|
12
8
|
removeEmptyScriptsPlugin: WebpackRemoveEmptyScriptsPlugin;
|
|
@@ -450,14 +450,14 @@ function buildCommonPluginConfig(webpackConfig, config, bundleAnalyzer, assumeGl
|
|
|
450
450
|
if ((0, shared_1.isDistDevOutputPath)(config.outputDir)) {
|
|
451
451
|
try {
|
|
452
452
|
const { PlauditDevPlugin } = require("@plaudit/dev-webpack-plugin");
|
|
453
|
-
plugins.push(new PlauditDevPlugin());
|
|
453
|
+
plugins.push(new PlauditDevPlugin(config));
|
|
454
454
|
}
|
|
455
455
|
catch { }
|
|
456
456
|
}
|
|
457
457
|
return {
|
|
458
458
|
plugins, removeEmptyScriptsPlugin,
|
|
459
459
|
makeAdditionalDependencyInjectorPlugin(referencePlugin) {
|
|
460
|
-
return new AdditionalDependencyInjectorPlugin_1.AdditionalDependencyInjectorPlugin(
|
|
460
|
+
return new AdditionalDependencyInjectorPlugin_1.AdditionalDependencyInjectorPlugin(webpackConfig.output?.module, builtDependencyExtractionWebpackPlugin.addExternalizedDep, referencePlugin);
|
|
461
461
|
}
|
|
462
462
|
};
|
|
463
463
|
}
|
|
@@ -582,7 +582,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, canClean
|
|
|
582
582
|
};
|
|
583
583
|
plugin = config.extensionsVersion > 1
|
|
584
584
|
? new ExtensionsConfigFileGeneratorPlugin_1.ExtensionsConfigFileGeneratorPlugin(config, srcRoot, dest, contextPath, entry)
|
|
585
|
-
: new ExtensionsConfigFileGeneratorPluginV1_1.ExtensionsConfigFileGeneratorPluginV1(
|
|
585
|
+
: new ExtensionsConfigFileGeneratorPluginV1_1.ExtensionsConfigFileGeneratorPluginV1(dest.destination, contextPath, entry);
|
|
586
586
|
plugins.push(plugin);
|
|
587
587
|
}
|
|
588
588
|
else if (sourceType === "plain" /* SourceType.plain */) {
|
|
@@ -602,7 +602,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources, canClean
|
|
|
602
602
|
console.error("Using directory mode with legacy plain entrypoint handling is not supported");
|
|
603
603
|
continue;
|
|
604
604
|
}
|
|
605
|
-
plugin = new EnhancedDynamicEntryPlugin_1.EnhancedDynamicEntryPlugin(
|
|
605
|
+
plugin = new EnhancedDynamicEntryPlugin_1.EnhancedDynamicEntryPlugin(contextPath, () => ({ [baseDest]: { import: Array.isArray(srcRoot) ? srcRoot : [srcRoot], plauditMetadata: { purpose: "plain-entrypoint", dest, absoluteSrc } } }));
|
|
606
606
|
}
|
|
607
607
|
plugins.push(plugin);
|
|
608
608
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/webpack-extensions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.99.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
"./wordpress-scripts-wrapper": "./dist/wordpress-scripts-wrapper.js",
|
|
18
18
|
"./location-encoding-filename-parser": "./dist/utils/location-encoding-filename-parser.js",
|
|
19
|
-
"./shared": "./dist/shared.js"
|
|
19
|
+
"./shared": "./dist/shared.js",
|
|
20
|
+
"./plugins": "./dist/plugins/index.js",
|
|
21
|
+
"./utils/pseudo-semaphore": "./dist/utils/pseudo-semaphore.js"
|
|
20
22
|
},
|
|
21
23
|
"typesVersions": {
|
|
22
24
|
"*": {
|
|
File without changes
|
|
File without changes
|