@plaudit/webpack-extensions 3.21.2 → 4.0.0-rc.1
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 +9 -1
- package/USER-GUIDE.md +2 -1
- package/package.json +27 -49
- package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.d.ts +0 -25
- package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.js +0 -86
- package/dist/plugins/AbstractBiPhasicGroupPlugin.d.ts +0 -31
- package/dist/plugins/AbstractBiPhasicGroupPlugin.js +0 -91
- package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts +0 -11
- package/dist/plugins/AdditionalDependencyInjectorPlugin.js +0 -58
- package/dist/plugins/EnhancedBlockJSONPlugin.d.ts +0 -47
- package/dist/plugins/EnhancedBlockJSONPlugin.js +0 -657
- package/dist/plugins/EnhancedDynamicEntryPlugin.d.ts +0 -8
- package/dist/plugins/EnhancedDynamicEntryPlugin.js +0 -14
- package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.d.ts +0 -20
- package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.js +0 -191
- package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.d.ts +0 -9
- package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.js +0 -45
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +0 -4
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js +0 -15
- package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.d.ts +0 -6
- package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.js +0 -13
- package/dist/plugins/MixableBiPhasicGroupPlugin.d.ts +0 -6
- package/dist/plugins/MixableBiPhasicGroupPlugin.js +0 -13
- package/dist/plugins/PackageConfigSanityChecker.d.ts +0 -4
- package/dist/plugins/PackageConfigSanityChecker.js +0 -30
- package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.d.ts +0 -26
- package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +0 -392
- package/dist/plugins/SpecialAssetHandlingPlugin.d.ts +0 -12
- package/dist/plugins/SpecialAssetHandlingPlugin.js +0 -134
- package/dist/plugins/UnifiedLoaderGenerator.d.ts +0 -21
- package/dist/plugins/UnifiedLoaderGenerator.js +0 -144
- package/dist/plugins/VariablesJSMonitorPlugin.d.ts +0 -7
- package/dist/plugins/VariablesJSMonitorPlugin.js +0 -20
- package/dist/plugins/WPMLConfigBuilder.d.ts +0 -17
- package/dist/plugins/WPMLConfigBuilder.js +0 -472
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts +0 -4
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js +0 -147
- package/dist/plugins/index.d.ts +0 -8
- package/dist/plugins/index.js +0 -24
- package/dist/plugins/static-configs.d.ts +0 -3
- package/dist/plugins/static-configs.js +0 -44
- package/dist/shared.d.ts +0 -311
- package/dist/shared.js +0 -536
- package/dist/utils/common-config-helpers.d.ts +0 -28
- package/dist/utils/common-config-helpers.js +0 -489
- package/dist/utils/css-writer.d.ts +0 -4
- package/dist/utils/css-writer.js +0 -46
- package/dist/utils/entrypoint-resolution-logic.d.ts +0 -13
- package/dist/utils/entrypoint-resolution-logic.js +0 -82
- package/dist/utils/location-encoding-filename-parser.d.ts +0 -30
- package/dist/utils/location-encoding-filename-parser.js +0 -120
- package/dist/utils/path-query-and-related-helpers.d.ts +0 -64
- package/dist/utils/path-query-and-related-helpers.js +0 -269
- package/dist/utils/pseudo-semaphore.d.ts +0 -14
- package/dist/utils/pseudo-semaphore.js +0 -79
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts +0 -72
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js +0 -518
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts +0 -56
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js +0 -155
- package/dist/wordpress-scripts-wrapper.d.ts +0 -4
- package/dist/wordpress-scripts-wrapper.js +0 -698
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeDependencyExtractionPlugin = makeDependencyExtractionPlugin;
|
|
4
|
-
const dependency_extraction_webpack_plugin_1 = require("../wordpress-ports/dependency-extraction-webpack-plugin");
|
|
5
|
-
const util_1 = require("../wordpress-ports/dependency-extraction-webpack-plugin/util");
|
|
6
|
-
function makeDependencyExtractionPlugin(externals, assumeGlobalizedPlauditLibraries, externalizing) {
|
|
7
|
-
return new dependency_extraction_webpack_plugin_1.EnhancedDependencyExtractionWebpackPlugin(makeDependencyExtractionPluginProps(externals, assumeGlobalizedPlauditLibraries, externalizing));
|
|
8
|
-
}
|
|
9
|
-
function makeDependencyExtractionPluginProps(externals, assumeGlobalizedPlauditLibraries, externalizing) {
|
|
10
|
-
if (!externals) {
|
|
11
|
-
if (assumeGlobalizedPlauditLibraries) {
|
|
12
|
-
return {
|
|
13
|
-
requestToExternal: plauditRequestToExternal(externalizing),
|
|
14
|
-
requestToHandle: plauditRequestToHandle
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return {};
|
|
18
|
-
}
|
|
19
|
-
const exactExternals = {};
|
|
20
|
-
const suffixExternals = [];
|
|
21
|
-
for (const [key, value] of Object.entries(externals)) {
|
|
22
|
-
const normalizedValue = typeof value !== 'string' && value.import === undefined ? { ...value, import: key } : value;
|
|
23
|
-
if (key.startsWith("*/")) {
|
|
24
|
-
suffixExternals.push([key.substring(1), typeof normalizedValue === 'string' ? { import: normalizedValue, handle: key.substring(2) } : normalizedValue]);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
exactExternals[key] = normalizedValue;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const resolvePossibleExternal = (request) => {
|
|
31
|
-
if (request in exactExternals) {
|
|
32
|
-
return handleExternalizingEqualsPossibleExternal(exactExternals[request], externalizing);
|
|
33
|
-
}
|
|
34
|
-
for (const [key, value] of suffixExternals) {
|
|
35
|
-
if (request.endsWith(key)) {
|
|
36
|
-
return handleExternalizingEqualsPossibleExternal(value, externalizing);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return undefined;
|
|
40
|
-
};
|
|
41
|
-
const baselineRequestToExternal = request => {
|
|
42
|
-
const possibleExternal = resolvePossibleExternal(request);
|
|
43
|
-
if (typeof possibleExternal === 'string') {
|
|
44
|
-
return possibleExternal;
|
|
45
|
-
}
|
|
46
|
-
else if (possibleExternal !== undefined) {
|
|
47
|
-
return possibleExternal['import'];
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
50
|
-
};
|
|
51
|
-
const baselineRequestToHandle = request => {
|
|
52
|
-
const possibleExternal = resolvePossibleExternal(request);
|
|
53
|
-
if (possibleExternal !== undefined && typeof possibleExternal !== 'string') {
|
|
54
|
-
return possibleExternal.handle;
|
|
55
|
-
}
|
|
56
|
-
return undefined;
|
|
57
|
-
};
|
|
58
|
-
if (assumeGlobalizedPlauditLibraries) {
|
|
59
|
-
return {
|
|
60
|
-
requestToExternal: curryRequestHandlers(baselineRequestToExternal, plauditRequestToExternal(externalizing)),
|
|
61
|
-
requestToHandle: curryRequestHandlers(baselineRequestToHandle, plauditRequestToHandle),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
return {
|
|
66
|
-
requestToExternal: baselineRequestToExternal,
|
|
67
|
-
requestToHandle: baselineRequestToHandle,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function firstLayersEqual(first, second) {
|
|
72
|
-
if (first.length !== second.length) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
for (let i = 0; i < first.length; i++) {
|
|
76
|
-
if (first[i] !== second[i]) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
const PLAUDIT_NAMESPACE = '@plaudit/';
|
|
83
|
-
const EXTERNALIZABLE_PLAUDIT_LIBRARIES = {
|
|
84
|
-
...Object.fromEntries(['@plaudit/frontend-apis', '@plaudit/library-extensions', '@plaudit/block-supports', '@plaudit/gutenberg-api-extensions']
|
|
85
|
-
.map(req => {
|
|
86
|
-
return [req, {
|
|
87
|
-
import: ['plaudit', (0, util_1.camelCaseDash)(req.substring(PLAUDIT_NAMESPACE.length))],
|
|
88
|
-
handle: `plaudit-${req.substring(PLAUDIT_NAMESPACE.length)}`
|
|
89
|
-
}];
|
|
90
|
-
})),
|
|
91
|
-
"@plaudit/wp-consent-api": { handle: "wp-consent-api", import: ['plaudit'] },
|
|
92
|
-
"@plaudit/analytics-integrations-api": { handle: "plaudit/analytics-integrations/api", import: ['plaudit', 'analyticsIntegrations', 'api'] },
|
|
93
|
-
"google.maps": { handle: "plaudit-base/google-maps-api", import: 'google.maps' } // This import is completely fake. As a result, it must be a single string in order to prevent a NPE
|
|
94
|
-
};
|
|
95
|
-
function plauditRequestToExternal(ext) {
|
|
96
|
-
return function (request) {
|
|
97
|
-
const req = EXTERNALIZABLE_PLAUDIT_LIBRARIES[normalizeRequest(request)];
|
|
98
|
-
return req ? handleExternalizingEqualsPossibleExternal(req, ext)?.import : undefined;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function plauditRequestToHandle(request) {
|
|
102
|
-
return EXTERNALIZABLE_PLAUDIT_LIBRARIES[normalizeRequest(request)]?.handle;
|
|
103
|
-
}
|
|
104
|
-
function normalizeRequest(request) {
|
|
105
|
-
return request.startsWith("@plaudit/gutenberg-api-extensions/") ? "@plaudit/gutenberg-api-extensions" : request;
|
|
106
|
-
}
|
|
107
|
-
function curryRequestHandlers(primary, secondary) {
|
|
108
|
-
return (...args) => primary(...args) ?? secondary(...args);
|
|
109
|
-
}
|
|
110
|
-
function handleExternalizingEqualsPossibleExternal(possibleExternal, ext) {
|
|
111
|
-
if (!ext || !possibleExternal) {
|
|
112
|
-
return possibleExternal;
|
|
113
|
-
}
|
|
114
|
-
const possibleImport = typeof possibleExternal === 'string' ? possibleExternal : possibleExternal['import'];
|
|
115
|
-
if (!possibleImport) {
|
|
116
|
-
return possibleExternal;
|
|
117
|
-
}
|
|
118
|
-
if (typeof ext === 'string') {
|
|
119
|
-
if (typeof possibleImport === 'string') {
|
|
120
|
-
return ext !== possibleImport ? possibleExternal : undefined;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
return possibleImport.length !== 1 || ext !== possibleImport[0] ? possibleExternal : undefined;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
else if (Array.isArray(ext)) {
|
|
127
|
-
if (typeof possibleImport === 'string') {
|
|
128
|
-
return ext.length !== 1 || ext[0] !== possibleImport ? possibleExternal : undefined;
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
return !firstLayersEqual(ext, possibleImport) ? possibleExternal : undefined;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
else if ('name' in ext) {
|
|
135
|
-
return handleExternalizingEqualsPossibleExternal(possibleExternal, ext.name);
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
for (const key of ['amd', 'commonjs', 'root']) {
|
|
139
|
-
// The recursion returns the external when it should be kept and undefined when it matched, so
|
|
140
|
-
// only an undefined result means this umd name is the thing being built and must not externalize.
|
|
141
|
-
if (key in ext && handleExternalizingEqualsPossibleExternal(possibleExternal, ext[key]) === undefined) {
|
|
142
|
-
return undefined;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return possibleExternal;
|
|
147
|
-
}
|
package/dist/plugins/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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";
|
package/dist/plugins/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Options as PostcssFunctionsOptions } from "postcss-functions";
|
|
2
|
-
import type { PostCSSLoaderOptions } from "postcss-loader/dist/config";
|
|
3
|
-
export declare function postcssConfigBuilder(variables: (name: string) => string | number | undefined, postCSSFunctions: (variables: (name: string) => unknown) => PostcssFunctionsOptions['functions']): PostCSSLoaderOptions;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.postcssConfigBuilder = postcssConfigBuilder;
|
|
4
|
-
// Options: calc
|
|
5
|
-
const calcOptions = { precision: 4, mediaQueries: true, selectors: true };
|
|
6
|
-
// Options: autoprefixerOptions
|
|
7
|
-
const autoprefixerOptions = { grid: "autoplace" };
|
|
8
|
-
function makeDefaultPostCSSFunctions(variables) {
|
|
9
|
-
const magnitude = new Intl.NumberFormat("en-US", { maximumFractionDigits: 4 });
|
|
10
|
-
return {
|
|
11
|
-
pxAsRem(value) {
|
|
12
|
-
return value ? `${magnitude.format(parseFloat(value.toString()) / (variables("font_size") || 16))}rem` : "1rem";
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function unsafeRequire(id) {
|
|
17
|
-
try {
|
|
18
|
-
return require(id);
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
if (typeof e === 'object' && !!e && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
throw e;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function postcssConfigBuilder(variables, postCSSFunctions) {
|
|
28
|
-
return {
|
|
29
|
-
plugins: [
|
|
30
|
-
unsafeRequire("postcss-import")(), // Once
|
|
31
|
-
unsafeRequire("postcss-mixins")(), // Once
|
|
32
|
-
unsafeRequire("@plaudit/postcss-variables")?.({ variables }), // Once
|
|
33
|
-
unsafeRequire("postcss-functions")({ functions: { ...makeDefaultPostCSSFunctions(variables), ...postCSSFunctions(variables) } }),
|
|
34
|
-
unsafeRequire("postcss-property-lookup")({ logLevel: "warn" }), // Rule
|
|
35
|
-
unsafeRequire("@plaudit/postcss-strip-units")?.(), // AtRule, Declaration
|
|
36
|
-
unsafeRequire("postcss-nested")(), // Rule
|
|
37
|
-
unsafeRequire("postcss-url")(), // This is needed because PostCSS flattens everything to a single file, which break's WebPack's URL resolution unless PostCSS updates the URLs to account for the flattening itself
|
|
38
|
-
unsafeRequire("postcss-calc")(calcOptions), // OnceExit
|
|
39
|
-
unsafeRequire("@plaudit/postcss-color-function")?.(), // OnceExit
|
|
40
|
-
unsafeRequire("autoprefixer")(autoprefixerOptions), // OnceExit
|
|
41
|
-
unsafeRequire("postcss-reporter")({ clearReportedMessages: true }), // OnceExit
|
|
42
|
-
].filter(plugin => plugin !== undefined)
|
|
43
|
-
};
|
|
44
|
-
}
|
package/dist/shared.d.ts
DELETED
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
import { PHPFile, PHPWriter } from "@plaudit/php-writer";
|
|
2
|
-
import { HereOrNowDoc } from "@plaudit/php-writer/expressions";
|
|
3
|
-
import type { Options as PostcssFunctionsOptions } from "postcss-functions";
|
|
4
|
-
import { type AssetInfo, type Compilation, type Configuration, type Entrypoint, WebpackError } from "webpack";
|
|
5
|
-
import { SourceType } from "./utils/entrypoint-resolution-logic";
|
|
6
|
-
import type { NormalizedEnqueuingControlFlags } from "./utils/path-query-and-related-helpers";
|
|
7
|
-
export * from "./utils/entrypoint-resolution-logic";
|
|
8
|
-
export type WPModuleDependency = string | {
|
|
9
|
-
id: string;
|
|
10
|
-
import?: string;
|
|
11
|
-
};
|
|
12
|
-
export type ParsedAssetJson = {
|
|
13
|
-
dependencies: WPModuleDependency[];
|
|
14
|
-
module_dependencies?: WPModuleDependency[];
|
|
15
|
-
version: string;
|
|
16
|
-
type?: 'module';
|
|
17
|
-
handle?: string;
|
|
18
|
-
};
|
|
19
|
-
export type ParsedAssetsJson = Record<string, ParsedAssetJson>;
|
|
20
|
-
export declare function isParsedAssetsJson(thing: any): thing is ParsedAssetsJson;
|
|
21
|
-
type BaseRestType = [/* dependencies: */ WPModuleDependency[], /* version: */ string];
|
|
22
|
-
export type AssetMetaSegment = {
|
|
23
|
-
inlinedAsset: InlinedAsset;
|
|
24
|
-
assetContents: string;
|
|
25
|
-
};
|
|
26
|
-
export type BaseHandleData = {
|
|
27
|
-
src: string;
|
|
28
|
-
rest: BaseRestType | [...BaseRestType, ScriptArgsObject];
|
|
29
|
-
};
|
|
30
|
-
export type ScriptArgsObject = {
|
|
31
|
-
strategy?: 'defer' | 'async';
|
|
32
|
-
in_footer?: boolean;
|
|
33
|
-
fetchpriority?: 'auto' | 'low' | 'high';
|
|
34
|
-
module_dependencies?: WPModuleDependency[];
|
|
35
|
-
};
|
|
36
|
-
export type InlinedAsset = {
|
|
37
|
-
position?: 'before' | 'after';
|
|
38
|
-
omitRegistration?: boolean;
|
|
39
|
-
};
|
|
40
|
-
export type IAHandleData = BaseHandleData & AssetMetaSegment;
|
|
41
|
-
export type HandleData = BaseHandleData & (AssetMetaSegment | {
|
|
42
|
-
inlinedAsset?: undefined;
|
|
43
|
-
assetContents?: string;
|
|
44
|
-
});
|
|
45
|
-
type OptionalLocationMeta = {
|
|
46
|
-
supports_hook_name?: boolean;
|
|
47
|
-
additional_action_code?: {
|
|
48
|
-
before?(writer: PHPWriter): unknown;
|
|
49
|
-
after?(writer: PHPWriter): unknown;
|
|
50
|
-
};
|
|
51
|
-
alternate_names?: [string, ...string[]];
|
|
52
|
-
};
|
|
53
|
-
export declare const standardLocationNamesMeta: {
|
|
54
|
-
readonly clientView: {
|
|
55
|
-
readonly action: "wp_enqueue_scripts";
|
|
56
|
-
readonly alternate_names: ["client-view", "view"];
|
|
57
|
-
};
|
|
58
|
-
readonly clientEditor: {
|
|
59
|
-
readonly action: "enqueue_block_editor_assets";
|
|
60
|
-
readonly alternate_names: ["client-editor", "editor"];
|
|
61
|
-
};
|
|
62
|
-
readonly blockAssets: {
|
|
63
|
-
readonly action: "enqueue_block_assets";
|
|
64
|
-
readonly alternate_names: ["block-assets"];
|
|
65
|
-
};
|
|
66
|
-
readonly admin: {
|
|
67
|
-
readonly action: "admin_enqueue_scripts";
|
|
68
|
-
readonly supports_hook_name: true;
|
|
69
|
-
};
|
|
70
|
-
readonly login: {
|
|
71
|
-
readonly action: "login_enqueue_scripts";
|
|
72
|
-
};
|
|
73
|
-
readonly customizer: {
|
|
74
|
-
readonly action: "customize_controls_enqueue_scripts";
|
|
75
|
-
};
|
|
76
|
-
readonly analytics: {
|
|
77
|
-
readonly action: "plaudit_enqueue_analytics";
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
export type StandardLocationNameMeta = {
|
|
81
|
-
action: typeof standardLocationNamesMeta[keyof typeof standardLocationNamesMeta]['action'];
|
|
82
|
-
} & OptionalLocationMeta;
|
|
83
|
-
export type StandardLocationNames = keyof typeof standardLocationNamesMeta;
|
|
84
|
-
export declare function isStandardLocationName(name: string): name is StandardLocationNames;
|
|
85
|
-
export declare function iterableStandardLocationNamesMeta(): [StandardLocationNames, StandardLocationNameMeta][];
|
|
86
|
-
export declare function normalizeLocationName(name: string): StandardLocationNames | 'register';
|
|
87
|
-
type LocationWithHookNameSupport = boolean | number | string | string[] | {
|
|
88
|
-
hook_name?: string | string[];
|
|
89
|
-
priority?: number;
|
|
90
|
-
};
|
|
91
|
-
type InputRegisterScriptArgs = ScriptArgsObject | boolean | 'lazy' | 'eager' | 'inline';
|
|
92
|
-
export declare function isRegisterScriptArgsShorthandName(name: string): name is Extract<InputRegisterScriptArgs, string>;
|
|
93
|
-
export type RealUsageLocations = {
|
|
94
|
-
[K in StandardLocationNames]?: typeof standardLocationNamesMeta[K] extends {
|
|
95
|
-
supports_hook_name: true;
|
|
96
|
-
} ? LocationWithHookNameSupport : boolean | number;
|
|
97
|
-
};
|
|
98
|
-
export type UsageLocations = RealUsageLocations & {
|
|
99
|
-
register?: boolean | number;
|
|
100
|
-
inline?: number;
|
|
101
|
-
handle?: string | ((generatedHandle: string) => string) | {
|
|
102
|
-
niceName: string;
|
|
103
|
-
};
|
|
104
|
-
registerScriptArgs?: InputRegisterScriptArgs;
|
|
105
|
-
};
|
|
106
|
-
export type NormalizedUsageLocations = Omit<UsageLocations, 'registerScriptArgs'> & {
|
|
107
|
-
registerScriptArgs?: InputRegisterScriptArgs;
|
|
108
|
-
};
|
|
109
|
-
export declare function isNormalizedUsageLocations(usageLocations: UsageLocations): usageLocations is NormalizedUsageLocations;
|
|
110
|
-
export type EnqueuedAssetType = 'script' | 'script_module' | 'style';
|
|
111
|
-
export type ExtendedHandleData = HandleData & {
|
|
112
|
-
locations: UsageLocations;
|
|
113
|
-
handleName?: UsageLocations['handle'];
|
|
114
|
-
lazyLoader: string | undefined;
|
|
115
|
-
type: EnqueuedAssetType;
|
|
116
|
-
associatedInlinedHandles?: ExtendedHandleData[];
|
|
117
|
-
};
|
|
118
|
-
export declare function convertHookLocationToNamesAndPriority(hookLocation: NonNullable<Exclude<UsageLocations[keyof typeof standardLocationNamesMeta], false>>): [string[], number];
|
|
119
|
-
export declare function hasDeferringStrategy(handle: HandleData): boolean;
|
|
120
|
-
/**
|
|
121
|
-
* @return {@code true} -> "can share the same handle", {@code false} -> "cannot be merged", {@code 'dependent'} -> "one handle can be listed as a dependency of the other"
|
|
122
|
-
*/
|
|
123
|
-
export declare function canMergeHandles(handleA: ExtendedHandleData, handleB: ExtendedHandleData): boolean | 'dependent';
|
|
124
|
-
export declare function constantKeys<K extends string, V>(object: {
|
|
125
|
-
[k in K]?: V;
|
|
126
|
-
}): K[];
|
|
127
|
-
export declare function constantEntries<K extends string, V>(object: {
|
|
128
|
-
[k in K]: V;
|
|
129
|
-
}): [K, V][];
|
|
130
|
-
export declare function determineCurrentSourceType(dest: string | AdvancedOutputConfig, srcIsDirectory: boolean): SourceType;
|
|
131
|
-
export type ObjectIndividualExternalDepConfig = {
|
|
132
|
-
import?: string | [string, ...string[]];
|
|
133
|
-
handle: string;
|
|
134
|
-
};
|
|
135
|
-
export type IndividualExternalDepConfig = string | ObjectIndividualExternalDepConfig;
|
|
136
|
-
export type Externals = {
|
|
137
|
-
[dep: string]: IndividualExternalDepConfig;
|
|
138
|
-
};
|
|
139
|
-
export type AdvancedOutputConfig = {
|
|
140
|
-
destination?: string;
|
|
141
|
-
withLegacyBlocksIn?: string | undefined | false;
|
|
142
|
-
additionalDependencies?: string[];
|
|
143
|
-
directoryLayout?: SourceType;
|
|
144
|
-
assumeGlobalizedPlauditLibraries?: boolean;
|
|
145
|
-
externalize?: Required<Configuration>['output']['library'];
|
|
146
|
-
bundleAnalyzer?: boolean | 'no-auto-open';
|
|
147
|
-
locations?: UsageLocations | UsageLocations['handle'];
|
|
148
|
-
lazyLoader?: string;
|
|
149
|
-
enqueuingFlags?: NormalizedEnqueuingControlFlags;
|
|
150
|
-
};
|
|
151
|
-
type OptionalCfgFields = 'directoryLayout' | 'externalize' | 'lazyLoader';
|
|
152
|
-
export type VerifiedAdvancedOutputConfig = Required<Omit<AdvancedOutputConfig, 'locations' | 'enqueuingFlags' | OptionalCfgFields>> & Pick<AdvancedOutputConfig, OptionalCfgFields> & {
|
|
153
|
-
enqueuingFlags: NormalizedEnqueuingControlFlags | undefined;
|
|
154
|
-
locations: NormalizedUsageLocations;
|
|
155
|
-
pathQueryParameters?: PathQueryParameters;
|
|
156
|
-
};
|
|
157
|
-
export type SourcesObject = Record<string, string | AdvancedOutputConfig | boolean>;
|
|
158
|
-
export type PlauditWordpressWebpackConfig = {
|
|
159
|
-
standard?: '2026-03-13';
|
|
160
|
-
standaloneBlocks?: boolean;
|
|
161
|
-
variables?: Record<string, any>;
|
|
162
|
-
verbose?: boolean;
|
|
163
|
-
src?: string[] | SourcesObject;
|
|
164
|
-
stats?: Configuration['stats'];
|
|
165
|
-
postcss?: {
|
|
166
|
-
functions?: (variables: (name: string) => unknown) => PostcssFunctionsOptions['functions'];
|
|
167
|
-
};
|
|
168
|
-
externals?: Externals;
|
|
169
|
-
assumeGlobalizedPlauditLibraries?: boolean;
|
|
170
|
-
useWebpackResourceFiltering?: boolean;
|
|
171
|
-
outputDir?: string;
|
|
172
|
-
extensionsVersion?: 1 | 2 | 3;
|
|
173
|
-
targetHandlePrefix?: string;
|
|
174
|
-
plainEntrypointsVersion?: 1 | 2;
|
|
175
|
-
srcDir?: string;
|
|
176
|
-
srcPrefixes?: string[];
|
|
177
|
-
useUnifiedLoader?: boolean;
|
|
178
|
-
includePostInitFallback?: boolean;
|
|
179
|
-
omitDistDev?: boolean;
|
|
180
|
-
onlyRunPostCSSOnPCSS?: boolean;
|
|
181
|
-
targetNamespace?: string;
|
|
182
|
-
useBlockSupportsAsThemeJsonDefaults?: boolean;
|
|
183
|
-
};
|
|
184
|
-
export type VerifiedPlauditWordpressWebpackConfig = Required<Omit<PlauditWordpressWebpackConfig, 'variables' | 'src' | 'externals' | 'standard'>> & {
|
|
185
|
-
variablesFilePath?: string;
|
|
186
|
-
currentVariables: Record<string, any>;
|
|
187
|
-
} & Pick<PlauditWordpressWebpackConfig, 'externals'>;
|
|
188
|
-
/** Unified-loader watch output: `dist` → `dist-dev` when SERVER_MODE is development. */
|
|
189
|
-
export declare function shouldWriteDistDev(config: Pick<PlauditWordpressWebpackConfig, 'outputDir' | 'useUnifiedLoader' | 'omitDistDev'>): boolean;
|
|
190
|
-
/**
|
|
191
|
-
* This MUST be kept in sync with the copy in @plaudit/dev-webpack-plugin
|
|
192
|
-
* @returns true for `dist-dev` (or any `*-dev` output folder produced by {@link shouldWriteDistDev}).
|
|
193
|
-
*/
|
|
194
|
-
export declare function isDistDevOutputPath(outputPath: string): boolean;
|
|
195
|
-
export declare function applyStandards(config: PlauditWordpressWebpackConfig): {
|
|
196
|
-
readonly standard?: '2026-03-13';
|
|
197
|
-
readonly standaloneBlocks?: boolean;
|
|
198
|
-
readonly variables?: Record<string, any>;
|
|
199
|
-
readonly verbose?: boolean;
|
|
200
|
-
readonly src?: string[] | SourcesObject;
|
|
201
|
-
readonly stats?: Configuration['stats'];
|
|
202
|
-
readonly postcss?: {
|
|
203
|
-
functions?: (variables: (name: string) => unknown) => PostcssFunctionsOptions['functions'];
|
|
204
|
-
};
|
|
205
|
-
readonly externals?: Externals;
|
|
206
|
-
readonly assumeGlobalizedPlauditLibraries?: boolean;
|
|
207
|
-
readonly targetHandlePrefix?: string;
|
|
208
|
-
readonly srcPrefixes?: string[];
|
|
209
|
-
readonly includePostInitFallback?: boolean;
|
|
210
|
-
readonly omitDistDev?: boolean;
|
|
211
|
-
readonly targetNamespace?: string;
|
|
212
|
-
readonly useBlockSupportsAsThemeJsonDefaults?: boolean;
|
|
213
|
-
useWebpackResourceFiltering?: boolean | undefined;
|
|
214
|
-
extensionsVersion?: 1 | 2 | 3 | undefined;
|
|
215
|
-
plainEntrypointsVersion?: 1 | 2 | undefined;
|
|
216
|
-
srcDir?: string | undefined;
|
|
217
|
-
outputDir?: string | undefined;
|
|
218
|
-
useUnifiedLoader?: boolean | undefined;
|
|
219
|
-
onlyRunPostCSSOnPCSS?: boolean | undefined;
|
|
220
|
-
};
|
|
221
|
-
export declare function resolveStandard(standard: PlauditWordpressWebpackConfig['standard']): {
|
|
222
|
-
readonly useWebpackResourceFiltering: true;
|
|
223
|
-
readonly extensionsVersion: 3;
|
|
224
|
-
readonly plainEntrypointsVersion: 2;
|
|
225
|
-
readonly srcDir: "src";
|
|
226
|
-
readonly outputDir: "dist";
|
|
227
|
-
readonly useUnifiedLoader: true;
|
|
228
|
-
readonly onlyRunPostCSSOnPCSS: true;
|
|
229
|
-
} | undefined;
|
|
230
|
-
export type FileSegmentBlockEntrypointInfo = {
|
|
231
|
-
blockJsonOrigin: string;
|
|
232
|
-
entrypointField: EntrypointFields[number];
|
|
233
|
-
handleGroup: ReturnType<typeof getHandleGroup>;
|
|
234
|
-
originalValue: string;
|
|
235
|
-
entrypointName: string;
|
|
236
|
-
handle: string;
|
|
237
|
-
dest: VerifiedAdvancedOutputConfig;
|
|
238
|
-
absoluteSrc: string;
|
|
239
|
-
pathQueryParameters: PathQueryParameters | undefined;
|
|
240
|
-
enqueuingFlags: NormalizedEnqueuingControlFlags | undefined;
|
|
241
|
-
};
|
|
242
|
-
export type PathQueryParameters = Record<string, unknown | [unknown, ...unknown[]]>;
|
|
243
|
-
export type BlockEntrypointInfo = FileSegmentBlockEntrypointInfo | {
|
|
244
|
-
dest: VerifiedAdvancedOutputConfig;
|
|
245
|
-
purpose: string;
|
|
246
|
-
absoluteSrc: string;
|
|
247
|
-
};
|
|
248
|
-
export type MinimumViableMetadata = {
|
|
249
|
-
dest: VerifiedAdvancedOutputConfig;
|
|
250
|
-
absoluteSrc: string;
|
|
251
|
-
};
|
|
252
|
-
export declare function convertUsageLocationsHandleToEmittableHandle(handle: UsageLocations['handle'], handlePrefix: string, handleSuffix: string): string;
|
|
253
|
-
export declare function makeEmittableConfigPHP(data: any, asFullFile: boolean, parentIndent?: string): string;
|
|
254
|
-
export declare const entrypointFields: readonly ["editorStyle", "viewStyle", "style", "editorScript", "viewScript", "script", "viewScriptModule"];
|
|
255
|
-
export type EntrypointFields = (typeof entrypointFields[number])[];
|
|
256
|
-
export declare function convertEntrypointFieldForAssetType(entrypointField: EntrypointFields[number], assetType: 'script' | 'style'): EntrypointFields[number];
|
|
257
|
-
export declare function leadingSlashIt(pathOrSomething: string): string;
|
|
258
|
-
export declare const scriptExtension: RegExp;
|
|
259
|
-
export declare const scriptWithoutModuleExtension: RegExp;
|
|
260
|
-
export declare const scriptWithModuleExtension: RegExp;
|
|
261
|
-
export declare const styleExtension: RegExp;
|
|
262
|
-
export declare function scriptOrStyleTest(entryPath: string, scriptExtension: RegExp): "" | "script" | "style";
|
|
263
|
-
export declare function isStyleField(field: string): field is 'style' | 'viewStyle' | 'editorStyle';
|
|
264
|
-
export declare function isScriptModuleField(field: string): field is 'viewScriptModule';
|
|
265
|
-
export declare function mergeModuleDependencyArrays(a: WPModuleDependency[] | undefined, b: WPModuleDependency[] | undefined): WPModuleDependency[] | undefined;
|
|
266
|
-
export declare function getHandleGroup(field: string): 'styleHandles' | 'scriptHandles' | 'scriptModuleHandles';
|
|
267
|
-
export type StripFirstTwoItems<A extends any[]> = A extends [any, any, ...rest: infer R] ? R : never;
|
|
268
|
-
export declare function hasAtLeastOneItem<T>(list: T[]): list is [T, ...T[]];
|
|
269
|
-
export type TupleOf<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
|
|
270
|
-
type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : _TupleOf<T, N, [T, ...R]>;
|
|
271
|
-
export declare function arrayIsLength<T, N extends number>(arr: T[] | null | undefined, length: N): arr is TupleOf<T, N>;
|
|
272
|
-
export declare function kebabCase(value: string): string;
|
|
273
|
-
export declare function camelCaseForPHPLabels(value: string): string;
|
|
274
|
-
export declare function newCleanWebpackError(error: string | ConstructorParameters<typeof WebpackError>): WebpackError;
|
|
275
|
-
export declare function newWebpackErrorForFile(error: string | ConstructorParameters<typeof WebpackError>, file: string): WebpackError;
|
|
276
|
-
/**
|
|
277
|
-
* 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
|
|
278
|
-
*/
|
|
279
|
-
export declare function emitResolveBaseUriFunction(writer: PHPFile | PHPWriter): void;
|
|
280
|
-
export declare function getAssetsJson(compilation: Compilation): ParsedAssetsJson;
|
|
281
|
-
export type ParsedAssetJsonProvider = (entrypoint: Entrypoint, metadata: MinimumViableMetadata) => {
|
|
282
|
-
assetName: string;
|
|
283
|
-
assetData: ParsedAssetsJson[string];
|
|
284
|
-
} | undefined;
|
|
285
|
-
export declare function getParsedAssetsJsonDataForEntrypoint(compilation: Compilation, entrypoint: Entrypoint, metadata: MinimumViableMetadata): {
|
|
286
|
-
assetName: string;
|
|
287
|
-
assetData: ParsedAssetsJson[string];
|
|
288
|
-
} | undefined;
|
|
289
|
-
export declare function emitPHPWriterAsAsset(writer: PHPWriter | PHPFile, compilation: Compilation, file: string, assetInfo?: AssetInfo): void;
|
|
290
|
-
export declare function dedent(text: TemplateStringsArray, ...values: unknown[]): string;
|
|
291
|
-
export declare function resolveLegacyBlockScriptsInFolder(folder: string): string[];
|
|
292
|
-
/**
|
|
293
|
-
* @param compilation
|
|
294
|
-
* @param writer
|
|
295
|
-
* @param handle
|
|
296
|
-
* @param type 'script_module' is NOT supported at this time; however, it is *handled* in this function
|
|
297
|
-
* @param handleData
|
|
298
|
-
*/
|
|
299
|
-
export declare function appendAddInlineAssetCall(compilation: Compilation, writer: PHPWriter, handle: string, type: EnqueuedAssetType, handleData: IAHandleData): void;
|
|
300
|
-
export declare function wrapInlineAssetContents(compilation: Compilation, wrapperIdPrefix: string, handle: string, contents: string): HereOrNowDoc;
|
|
301
|
-
export declare function synchronousDirIterator(dirPath: string): Generator<import("node:fs").Dirent<string>, void, unknown>;
|
|
302
|
-
/**
|
|
303
|
-
* A type-guarded version of `instanceof Error` for Node.js.
|
|
304
|
-
* @author Joseph JDBar Barron
|
|
305
|
-
* @link https://dev.to/jdbar
|
|
306
|
-
*/
|
|
307
|
-
export declare function instanceOfNodeError<T extends new (...args: any) => Error>(value: unknown, errorType: T): value is InstanceType<T> & NodeJS.ErrnoException;
|
|
308
|
-
/**
|
|
309
|
-
* This tests if the name starts with a "~", is equal to "example" or "examples", or includes "example" as a name segment
|
|
310
|
-
*/
|
|
311
|
-
export declare function shouldBeSkipped(name: string): boolean;
|