@10up/wp-vite-plugins 1.0.0-alpha.0 → 1.0.0-alpha.2
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/README.md +27 -2
- package/dist/build.d.ts +13 -0
- package/dist/build.js +396 -0
- package/dist/build.js.map +1 -0
- package/dist/cli.js +550 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +51 -1
- package/dist/index.js +613 -9
- package/dist/index.js.map +1 -1
- package/dist/runner-WUYCS-nx.d.ts +178 -0
- package/dist/watch.d.ts +12 -0
- package/dist/watch.js +381 -0
- package/dist/watch.js.map +1 -0
- package/package.json +12 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolve, join, relative, dirname, extname } from 'path';
|
|
2
|
-
import { readdirSync, existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { readdirSync, existsSync, readFileSync, realpathSync } from 'fs';
|
|
3
3
|
import crypto, { createHash } from 'crypto';
|
|
4
4
|
import fg from 'fast-glob';
|
|
5
5
|
import { init, parse } from 'es-module-lexer';
|
|
@@ -1586,8 +1586,36 @@ function discoverEntries(blocksDirAbs, buildType, skip) {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
return entries;
|
|
1588
1588
|
}
|
|
1589
|
+
function normalizePath(filePath) {
|
|
1590
|
+
try {
|
|
1591
|
+
return realpathSync.native(filePath);
|
|
1592
|
+
} catch {
|
|
1593
|
+
return filePath;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
var MARKER_PROPERTY = "--wp-vite-entry";
|
|
1597
|
+
var MARKER_DECLARATION_RE = new RegExp(
|
|
1598
|
+
`${MARKER_PROPERTY}\\s*:\\s*(?:"[^"]*"|'[^']*')\\s*;?`,
|
|
1599
|
+
"g"
|
|
1600
|
+
);
|
|
1601
|
+
var EMPTY_ROOT_RULE_RE = /:root\s*\{\s*\}/g;
|
|
1602
|
+
function markerRule(entryName, isIndentedSass) {
|
|
1603
|
+
if (isIndentedSass) {
|
|
1604
|
+
return `
|
|
1605
|
+
:root
|
|
1606
|
+
${MARKER_PROPERTY}: "${entryName}"
|
|
1607
|
+
`;
|
|
1608
|
+
}
|
|
1609
|
+
return `
|
|
1610
|
+
:root{${MARKER_PROPERTY}:"${entryName}"}
|
|
1611
|
+
`;
|
|
1612
|
+
}
|
|
1613
|
+
function stripMarker(source) {
|
|
1614
|
+
return source.replace(MARKER_DECLARATION_RE, "").replace(EMPTY_ROOT_RULE_RE, "");
|
|
1615
|
+
}
|
|
1589
1616
|
function wpBlockStyles(options) {
|
|
1590
1617
|
let stylesDirAbs;
|
|
1618
|
+
const entryNameByFile = /* @__PURE__ */ new Map();
|
|
1591
1619
|
return {
|
|
1592
1620
|
name: "wp-block-styles",
|
|
1593
1621
|
enforce: "pre",
|
|
@@ -1597,10 +1625,13 @@ function wpBlockStyles(options) {
|
|
|
1597
1625
|
`${stylesDirAbs.replace(/\\/g, "/")}/**/*.{css,scss,sass}`,
|
|
1598
1626
|
{ absolute: true }
|
|
1599
1627
|
);
|
|
1628
|
+
entryNameByFile.clear();
|
|
1600
1629
|
const entries = {};
|
|
1601
1630
|
for (const filePath of stylesheets) {
|
|
1602
1631
|
const blockName = relative(stylesDirAbs, filePath).replace(extname(filePath), "").replace(/\\/g, "/");
|
|
1603
|
-
|
|
1632
|
+
const entryName = `autoenqueue/${blockName}`;
|
|
1633
|
+
entries[entryName] = filePath;
|
|
1634
|
+
entryNameByFile.set(normalizePath(filePath), entryName);
|
|
1604
1635
|
}
|
|
1605
1636
|
return {
|
|
1606
1637
|
build: {
|
|
@@ -1609,6 +1640,38 @@ function wpBlockStyles(options) {
|
|
|
1609
1640
|
}
|
|
1610
1641
|
}
|
|
1611
1642
|
};
|
|
1643
|
+
},
|
|
1644
|
+
transform(code, id) {
|
|
1645
|
+
const [rawPath] = id.split("?");
|
|
1646
|
+
const filePath = normalizePath(rawPath);
|
|
1647
|
+
const entryName = entryNameByFile.get(filePath);
|
|
1648
|
+
if (!entryName) return null;
|
|
1649
|
+
return code + markerRule(entryName, extname(rawPath) === ".sass");
|
|
1650
|
+
},
|
|
1651
|
+
generateBundle(_options, bundle) {
|
|
1652
|
+
const expected = /* @__PURE__ */ new Map();
|
|
1653
|
+
for (const [filePath, entryName] of entryNameByFile) {
|
|
1654
|
+
expected.set(`${entryName}.css`, filePath);
|
|
1655
|
+
}
|
|
1656
|
+
for (const output of Object.values(bundle)) {
|
|
1657
|
+
if (output.type !== "asset" || !expected.has(output.fileName)) continue;
|
|
1658
|
+
if (typeof output.source === "string") {
|
|
1659
|
+
output.source = stripMarker(output.source);
|
|
1660
|
+
} else {
|
|
1661
|
+
output.source = Buffer.from(
|
|
1662
|
+
stripMarker(Buffer.from(output.source).toString("utf-8"))
|
|
1663
|
+
);
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
const missing = [];
|
|
1667
|
+
for (const [fileName, filePath] of expected) {
|
|
1668
|
+
if (!(fileName in bundle)) missing.push(`${fileName} (from ${filePath})`);
|
|
1669
|
+
}
|
|
1670
|
+
if (missing.length > 0) {
|
|
1671
|
+
throw new Error(
|
|
1672
|
+
"wpBlockStyles: expected stylesheet(s) missing from the build output \u2014 each source under blocksStylesDir must produce its own dist file:\n" + missing.map((entry) => ` - ${entry}`).join("\n")
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1612
1675
|
}
|
|
1613
1676
|
};
|
|
1614
1677
|
}
|
|
@@ -1683,8 +1746,75 @@ function isScriptModule(metadata, subpath) {
|
|
|
1683
1746
|
function camelize(kebabCaseName) {
|
|
1684
1747
|
return kebabCaseName.replace(/-(.)/g, (_match, letter) => letter.toUpperCase());
|
|
1685
1748
|
}
|
|
1749
|
+
function pickExportsEntry(value) {
|
|
1750
|
+
if (typeof value === "string") return value;
|
|
1751
|
+
if (Array.isArray(value)) {
|
|
1752
|
+
for (const candidate of value) {
|
|
1753
|
+
const picked = pickExportsEntry(candidate);
|
|
1754
|
+
if (picked) return picked;
|
|
1755
|
+
}
|
|
1756
|
+
return null;
|
|
1757
|
+
}
|
|
1758
|
+
if (!value || typeof value !== "object") return null;
|
|
1759
|
+
const record = value;
|
|
1760
|
+
if ("." in record) return pickExportsEntry(record["."]);
|
|
1761
|
+
for (const condition of ["module", "import", "browser", "default"]) {
|
|
1762
|
+
if (!(condition in record)) continue;
|
|
1763
|
+
const picked = pickExportsEntry(record[condition]);
|
|
1764
|
+
if (picked) return picked;
|
|
1765
|
+
}
|
|
1766
|
+
return null;
|
|
1767
|
+
}
|
|
1768
|
+
function resolvePackageEsmEntry(packageName, fromPaths) {
|
|
1769
|
+
for (const from of fromPaths) {
|
|
1770
|
+
const packageJsonPath = findPackageJson(packageName, from);
|
|
1771
|
+
if (!packageJsonPath) continue;
|
|
1772
|
+
let metadata;
|
|
1773
|
+
try {
|
|
1774
|
+
metadata = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
1775
|
+
} catch {
|
|
1776
|
+
continue;
|
|
1777
|
+
}
|
|
1778
|
+
const entry = pickExportsEntry(metadata.exports) ?? (typeof metadata.module === "string" ? metadata.module : null) ?? (typeof metadata.main === "string" ? metadata.main : null) ?? "./index.js";
|
|
1779
|
+
const entryPath = resolve(dirname(packageJsonPath), entry);
|
|
1780
|
+
if (!existsSync(entryPath)) continue;
|
|
1781
|
+
try {
|
|
1782
|
+
return realpathSync(entryPath);
|
|
1783
|
+
} catch {
|
|
1784
|
+
return entryPath;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
return null;
|
|
1788
|
+
}
|
|
1789
|
+
function findPackageJson(packageName, from) {
|
|
1790
|
+
try {
|
|
1791
|
+
return createRequire(from).resolve(`${packageName}/package.json`);
|
|
1792
|
+
} catch {
|
|
1793
|
+
}
|
|
1794
|
+
let dir = dirname(from);
|
|
1795
|
+
for (; ; ) {
|
|
1796
|
+
const candidate = join(dir, "node_modules", packageName, "package.json");
|
|
1797
|
+
if (existsSync(candidate)) return candidate;
|
|
1798
|
+
const parent = dirname(dir);
|
|
1799
|
+
if (parent === dir) return null;
|
|
1800
|
+
dir = parent;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1686
1803
|
|
|
1687
1804
|
// src/wp-externals.ts
|
|
1805
|
+
var DEFAULT_BUNDLED_PACKAGES = ["@wordpress/icons"];
|
|
1806
|
+
var BUNDLED_MARKER_PREFIX = "wp-vite-bundled:";
|
|
1807
|
+
var JS_SOURCE_EXTENSION = /\.[mc]?[jt]sx?$/;
|
|
1808
|
+
function escapeRegExp(value) {
|
|
1809
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1810
|
+
}
|
|
1811
|
+
function isBarePackageName(name) {
|
|
1812
|
+
if (name.startsWith("@")) {
|
|
1813
|
+
const parts = name.split("/");
|
|
1814
|
+
return parts.length === 2 && parts[0].length > 1 && !!parts[1];
|
|
1815
|
+
}
|
|
1816
|
+
return name.length > 0 && !name.includes("/") && !name.startsWith(".");
|
|
1817
|
+
}
|
|
1688
1818
|
var DEFAULT_VENDOR = {
|
|
1689
1819
|
react: { global: "React", handle: "react" },
|
|
1690
1820
|
"react-dom": { global: "ReactDOM", handle: "react-dom" },
|
|
@@ -1737,6 +1867,14 @@ function wpExternals(options = {}) {
|
|
|
1737
1867
|
const moduleEntryMatchers = options.moduleEntryMatchers ?? [];
|
|
1738
1868
|
const wpBuildAssetMatchers = options.wpBuildAssetMatchers ?? [];
|
|
1739
1869
|
const scriptModuleNamespaces = options.scriptModuleNamespaces ?? [];
|
|
1870
|
+
for (const name of options.bundle ?? []) {
|
|
1871
|
+
if (isBarePackageName(name)) continue;
|
|
1872
|
+
const { name: rootName, subpath } = splitImport(name);
|
|
1873
|
+
throw new Error(
|
|
1874
|
+
`wpExternals: \`bundle\` accepts bare package names only, got '${name}'.` + (subpath ? ` Force-bundling is a whole-package verdict \u2014 list '${rootName}' instead of the '${subpath}' subpath.` : "")
|
|
1875
|
+
);
|
|
1876
|
+
}
|
|
1877
|
+
const bundledPackages = /* @__PURE__ */ new Set([...DEFAULT_BUNDLED_PACKAGES, ...options.bundle ?? []]);
|
|
1740
1878
|
function matchesScriptModuleNamespace(packageName) {
|
|
1741
1879
|
if (!packageName.startsWith("@")) return false;
|
|
1742
1880
|
const slashIndex = packageName.indexOf("/");
|
|
@@ -1767,6 +1905,7 @@ function wpExternals(options = {}) {
|
|
|
1767
1905
|
return false;
|
|
1768
1906
|
}
|
|
1769
1907
|
function resolveExternal(specifier) {
|
|
1908
|
+
if (bundledPackages.has(splitImport(specifier).name)) return null;
|
|
1770
1909
|
if (vendorExternals[specifier]) {
|
|
1771
1910
|
const vendor = vendorExternals[specifier];
|
|
1772
1911
|
return {
|
|
@@ -1897,9 +2036,15 @@ function wpExternals(options = {}) {
|
|
|
1897
2036
|
await init;
|
|
1898
2037
|
let imports;
|
|
1899
2038
|
try {
|
|
1900
|
-
[imports] = parse(code);
|
|
1901
|
-
} catch {
|
|
1902
|
-
|
|
2039
|
+
[imports] = parse(code, id);
|
|
2040
|
+
} catch (error) {
|
|
2041
|
+
const filePath = id.split("?")[0] ?? id;
|
|
2042
|
+
if (!JS_SOURCE_EXTENSION.test(filePath)) return null;
|
|
2043
|
+
return this.error(
|
|
2044
|
+
`wp-externals could not parse the imports of ${filePath}: ${error instanceof Error ? error.message : String(error)}
|
|
2045
|
+
Its @wordpress/* imports would ship un-rewritten (broken window.wp.* reads and an incomplete .asset.php), so this is a hard error.
|
|
2046
|
+
Most likely cause: JSX in a file that isn't .jsx/.tsx. JSX must live in .jsx/.tsx files \u2014 do not use \`rollupOptions.moduleTypes\` to map .js to jsx; rename the files instead. The JSX transform runs *after* plugin transform hooks, so \`moduleTypes\` makes the build pass while this plugin still sees raw JSX and produces broken output.`
|
|
2047
|
+
);
|
|
1903
2048
|
}
|
|
1904
2049
|
if (imports.length === 0) return null;
|
|
1905
2050
|
const magicString = new MagicString(code);
|
|
@@ -2062,27 +2207,388 @@ function wpExternals(options = {}) {
|
|
|
2062
2207
|
}
|
|
2063
2208
|
}
|
|
2064
2209
|
};
|
|
2065
|
-
|
|
2210
|
+
const bundlePlugin = {
|
|
2211
|
+
name: `wp-externals-bundle(${buildType})`,
|
|
2212
|
+
enforce: "pre",
|
|
2213
|
+
transform(code, id) {
|
|
2214
|
+
if (bundledPackages.size === 0) return null;
|
|
2215
|
+
if (id.startsWith("\0")) return null;
|
|
2216
|
+
const filePath = (id.split("?")[0] ?? id).replace(/\\/g, "/");
|
|
2217
|
+
const magicString = new MagicString(code);
|
|
2218
|
+
let codeChanged = false;
|
|
2219
|
+
for (const packageName of bundledPackages) {
|
|
2220
|
+
if (!code.includes(packageName)) continue;
|
|
2221
|
+
if (filePath.includes(`/node_modules/${packageName}/`)) continue;
|
|
2222
|
+
const pattern = new RegExp(
|
|
2223
|
+
`(?:\\bfrom|\\bimport|\\brequire)\\s*\\(?\\s*(['"])${escapeRegExp(
|
|
2224
|
+
packageName
|
|
2225
|
+
)}\\1`,
|
|
2226
|
+
"g"
|
|
2227
|
+
);
|
|
2228
|
+
for (const match of code.matchAll(pattern)) {
|
|
2229
|
+
const end = match.index + match[0].length - 1;
|
|
2230
|
+
magicString.overwrite(
|
|
2231
|
+
end - packageName.length,
|
|
2232
|
+
end,
|
|
2233
|
+
BUNDLED_MARKER_PREFIX + packageName
|
|
2234
|
+
);
|
|
2235
|
+
codeChanged = true;
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
if (!codeChanged) return null;
|
|
2239
|
+
return {
|
|
2240
|
+
code: magicString.toString(),
|
|
2241
|
+
map: magicString.generateMap({ hires: true })
|
|
2242
|
+
};
|
|
2243
|
+
},
|
|
2244
|
+
resolveId(source, importer) {
|
|
2245
|
+
if (!source.startsWith(BUNDLED_MARKER_PREFIX)) return null;
|
|
2246
|
+
const packageName = source.slice(BUNDLED_MARKER_PREFIX.length);
|
|
2247
|
+
const fromPaths = [
|
|
2248
|
+
...importer && !importer.startsWith("\0") ? [importer.split("?")[0]] : [],
|
|
2249
|
+
join(projectRoot, "package.json")
|
|
2250
|
+
];
|
|
2251
|
+
const entry = resolvePackageEsmEntry(packageName, fromPaths);
|
|
2252
|
+
if (!entry) {
|
|
2253
|
+
return this.error(
|
|
2254
|
+
`wp-externals is configured to bundle '${packageName}' (see the \`bundle\` option), but the package is not installed${importer ? ` \u2014 resolved from ${importer} and ` : " under "}${projectRoot}.
|
|
2255
|
+
Force-bundling requires the package in node_modules, since its code has to be compiled into your output. Run \`npm install ${packageName}\`.`
|
|
2256
|
+
);
|
|
2257
|
+
}
|
|
2258
|
+
return entry;
|
|
2259
|
+
}
|
|
2260
|
+
};
|
|
2261
|
+
return [resolverPlugin, transformPlugin, bundlePlugin];
|
|
2262
|
+
}
|
|
2263
|
+
var MARKER_PARAM = "wp-entry";
|
|
2264
|
+
var MARKER_RE = new RegExp(`[?&]${MARKER_PARAM}=([^&]*)`);
|
|
2265
|
+
var PARTITIONABLE_EXTENSION = /\.[cm]?[jt]sx?$/;
|
|
2266
|
+
var INLINABLE_SYNTHETIC_ID = [/^\0?rolldown[:/]runtime(\.[cm]?js)?$/, /^\0wp-external-global:/];
|
|
2267
|
+
function markerOf(id) {
|
|
2268
|
+
return id.match(MARKER_RE)?.[1];
|
|
2269
|
+
}
|
|
2270
|
+
function withMarker(id, marker) {
|
|
2271
|
+
return `${id}${id.includes("?") ? "&" : "?"}${MARKER_PARAM}=${marker}`;
|
|
2272
|
+
}
|
|
2273
|
+
function stripEntryMarker(id) {
|
|
2274
|
+
return id.replace(
|
|
2275
|
+
new RegExp(`([?&])${MARKER_PARAM}=[^&]*&?`),
|
|
2276
|
+
(_match, lead) => lead === "?" ? "?" : "&"
|
|
2277
|
+
).replace(/[?&]$/, "");
|
|
2278
|
+
}
|
|
2279
|
+
function mintMarker(entryId) {
|
|
2280
|
+
return crypto.createHash("sha1").update(entryId).digest("hex").slice(0, 8);
|
|
2281
|
+
}
|
|
2282
|
+
function isPartitionable(id) {
|
|
2283
|
+
if (id.includes("\0") || id.includes("?")) return false;
|
|
2284
|
+
return PARTITIONABLE_EXTENSION.test(id);
|
|
2285
|
+
}
|
|
2286
|
+
function isInlinableSyntheticChunk(chunk) {
|
|
2287
|
+
const moduleIds = Object.keys(chunk.modules ?? {});
|
|
2288
|
+
if (moduleIds.length === 0) return false;
|
|
2289
|
+
return moduleIds.every((id) => INLINABLE_SYNTHETIC_ID.some((pattern) => pattern.test(id)));
|
|
2290
|
+
}
|
|
2291
|
+
function objectKey(name) {
|
|
2292
|
+
return JSON.stringify(name);
|
|
2293
|
+
}
|
|
2294
|
+
function parseImportClause(statement) {
|
|
2295
|
+
const match = statement.match(/^\s*import\s*(?:([\s\S]*?)\s*from\s*)?['"][^'"]*['"]\s*;?\s*$/);
|
|
2296
|
+
if (!match) return null;
|
|
2297
|
+
const bindings = match[1]?.trim();
|
|
2298
|
+
if (!bindings) return { named: [] };
|
|
2299
|
+
const clause = { named: [] };
|
|
2300
|
+
let rest = bindings;
|
|
2301
|
+
const leadingDefault = rest.match(/^([A-Za-z_$][\w$]*)\s*(?:,\s*([\s\S]*))?$/);
|
|
2302
|
+
if (leadingDefault) {
|
|
2303
|
+
clause.default = leadingDefault[1];
|
|
2304
|
+
rest = leadingDefault[2]?.trim() ?? "";
|
|
2305
|
+
}
|
|
2306
|
+
if (rest.startsWith("*")) {
|
|
2307
|
+
const namespace = rest.match(/^\*\s*as\s+([A-Za-z_$][\w$]*)$/);
|
|
2308
|
+
if (!namespace) return null;
|
|
2309
|
+
clause.namespace = namespace[1];
|
|
2310
|
+
return clause;
|
|
2311
|
+
}
|
|
2312
|
+
if (rest.startsWith("{")) {
|
|
2313
|
+
if (!rest.endsWith("}")) return null;
|
|
2314
|
+
for (const binding of rest.slice(1, -1).split(",")) {
|
|
2315
|
+
const trimmed = binding.trim();
|
|
2316
|
+
if (!trimmed) continue;
|
|
2317
|
+
const aliased = trimmed.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);
|
|
2318
|
+
if (aliased) {
|
|
2319
|
+
clause.named.push({ imported: aliased[1], local: aliased[2] });
|
|
2320
|
+
continue;
|
|
2321
|
+
}
|
|
2322
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(trimmed)) return null;
|
|
2323
|
+
clause.named.push({ imported: trimmed, local: trimmed });
|
|
2324
|
+
}
|
|
2325
|
+
return clause;
|
|
2326
|
+
}
|
|
2327
|
+
return rest === "" ? clause : null;
|
|
2328
|
+
}
|
|
2329
|
+
function exportClauseRange(code, exports) {
|
|
2330
|
+
let firstName = Number.POSITIVE_INFINITY;
|
|
2331
|
+
let lastName = -1;
|
|
2332
|
+
for (const record of exports) {
|
|
2333
|
+
firstName = Math.min(firstName, record.s, record.ls >= 0 ? record.ls : record.s);
|
|
2334
|
+
lastName = Math.max(lastName, record.e, record.le >= 0 ? record.le : record.e);
|
|
2335
|
+
}
|
|
2336
|
+
if (lastName < 0) return null;
|
|
2337
|
+
const brace = code.lastIndexOf("{", firstName);
|
|
2338
|
+
if (brace < 0) return null;
|
|
2339
|
+
const beforeBrace = code.slice(0, brace).trimEnd();
|
|
2340
|
+
if (!beforeBrace.endsWith("export")) return null;
|
|
2341
|
+
const start = beforeBrace.length - "export".length;
|
|
2342
|
+
if (start > 0 && /[\w$]/.test(code[start - 1])) return null;
|
|
2343
|
+
const close = code.indexOf("}", lastName);
|
|
2344
|
+
if (close < 0) return null;
|
|
2345
|
+
let end = close + 1;
|
|
2346
|
+
while (end < code.length && /\s/.test(code[end])) end += 1;
|
|
2347
|
+
if (code[end] === ";") end += 1;
|
|
2348
|
+
if (!/^export\s*\{[^{}]*\}\s*;?$/.test(code.slice(start, end))) return null;
|
|
2349
|
+
return { start, end };
|
|
2350
|
+
}
|
|
2351
|
+
function toInlineExpression(code) {
|
|
2352
|
+
const [imports, exports] = parse(code);
|
|
2353
|
+
if (imports.length > 0) return null;
|
|
2354
|
+
let body = code;
|
|
2355
|
+
if (exports.length > 0) {
|
|
2356
|
+
const range = exportClauseRange(code, exports);
|
|
2357
|
+
if (!range) return null;
|
|
2358
|
+
body = code.slice(0, range.start) + code.slice(range.end);
|
|
2359
|
+
}
|
|
2360
|
+
try {
|
|
2361
|
+
const [bodyImports, bodyExports] = parse(body);
|
|
2362
|
+
if (bodyImports.length > 0 || bodyExports.length > 0) return null;
|
|
2363
|
+
} catch {
|
|
2364
|
+
return null;
|
|
2365
|
+
}
|
|
2366
|
+
const returned = exports.map((record) => `${objectKey(record.n)}: ${record.ln ?? record.n}`).join(", ");
|
|
2367
|
+
return `(() => {
|
|
2368
|
+
${body.trim()}
|
|
2369
|
+
;
|
|
2370
|
+
return { ${returned} };
|
|
2371
|
+
})()`;
|
|
2372
|
+
}
|
|
2373
|
+
function resolveChunkSpecifier(hostFileName, specifier) {
|
|
2374
|
+
const segments = hostFileName.split("/").slice(0, -1);
|
|
2375
|
+
for (const segment of specifier.split("/")) {
|
|
2376
|
+
if (segment === "." || segment === "") continue;
|
|
2377
|
+
if (segment === "..") segments.pop();
|
|
2378
|
+
else segments.push(segment);
|
|
2379
|
+
}
|
|
2380
|
+
return segments.join("/");
|
|
2381
|
+
}
|
|
2382
|
+
function shiftMappings(map, atLine, addedLines) {
|
|
2383
|
+
if (!map || typeof map.mappings !== "string" || addedLines <= 0) return;
|
|
2384
|
+
const lines = map.mappings.split(";");
|
|
2385
|
+
if (atLine > lines.length) return;
|
|
2386
|
+
lines.splice(atLine + 1, 0, ...new Array(addedLines).fill(""));
|
|
2387
|
+
map.mappings = lines.join(";");
|
|
2388
|
+
}
|
|
2389
|
+
function wpScriptDedupe() {
|
|
2390
|
+
const inFlight = /* @__PURE__ */ new Set();
|
|
2391
|
+
return {
|
|
2392
|
+
name: "wp-script-dedupe",
|
|
2393
|
+
// Mandatory: normal-bucket `resolveId` hooks are never called during a
|
|
2394
|
+
// Vite 8 build — Rolldown's native resolver answers between the `pre`
|
|
2395
|
+
// and normal buckets.
|
|
2396
|
+
enforce: "pre",
|
|
2397
|
+
apply: "build",
|
|
2398
|
+
resolveId: {
|
|
2399
|
+
// `enforce: 'pre'` alone only puts this plugin in the pre bucket —
|
|
2400
|
+
// *within* it, array position decides, and any pre-bucket resolver
|
|
2401
|
+
// registered earlier answers first and hands back an untagged id.
|
|
2402
|
+
// wpExternals' force-bundle resolver is exactly that: it answers
|
|
2403
|
+
// `wp-vite-bundled:@wordpress/icons` itself, so the barrel came back
|
|
2404
|
+
// unpartitioned and its whole subtree inherited one marker minted
|
|
2405
|
+
// from the barrel — identical for every entry, i.e. a shared chunk
|
|
2406
|
+
// (issue #23). Hook-level `order: 'pre'` puts this resolver ahead of
|
|
2407
|
+
// every other resolveId hook no matter how the plugins are composed;
|
|
2408
|
+
// it delegates through `this.resolve`, so those resolvers still
|
|
2409
|
+
// decide *what* an id resolves to. This plugin only tags the answer.
|
|
2410
|
+
order: "pre",
|
|
2411
|
+
async handler(source, importer, options) {
|
|
2412
|
+
if (!importer) return null;
|
|
2413
|
+
if (source.includes("\0")) return null;
|
|
2414
|
+
const key = `${importer}
|
|
2415
|
+
${source}`;
|
|
2416
|
+
if (inFlight.has(key)) return null;
|
|
2417
|
+
const marker = markerOf(importer) ?? mintMarker(importer);
|
|
2418
|
+
inFlight.add(key);
|
|
2419
|
+
let resolved;
|
|
2420
|
+
try {
|
|
2421
|
+
resolved = await this.resolve(
|
|
2422
|
+
stripEntryMarker(source),
|
|
2423
|
+
stripEntryMarker(importer),
|
|
2424
|
+
{
|
|
2425
|
+
// `kind` rides along so plugins keying on `require-call`
|
|
2426
|
+
// (wpExternals' CJS shim) still see the truth.
|
|
2427
|
+
...options,
|
|
2428
|
+
skipSelf: true
|
|
2429
|
+
}
|
|
2430
|
+
);
|
|
2431
|
+
} finally {
|
|
2432
|
+
inFlight.delete(key);
|
|
2433
|
+
}
|
|
2434
|
+
if (!resolved || resolved.external) return resolved;
|
|
2435
|
+
if (!isPartitionable(resolved.id)) return resolved;
|
|
2436
|
+
return { ...resolved, id: withMarker(resolved.id, marker) };
|
|
2437
|
+
}
|
|
2438
|
+
},
|
|
2439
|
+
generateBundle: {
|
|
2440
|
+
// Load-bearing, not cosmetic: wpExternals emits its `.asset.php`
|
|
2441
|
+
// sidecars from `generateBundle`, unioning the dependencies of every
|
|
2442
|
+
// chunk an entry reaches — including the synthetic shim chunks this
|
|
2443
|
+
// hook inlines and deletes. Rolldown hands each plugin a freshly built
|
|
2444
|
+
// `bundle` object and drops `modules` mutations on write-back
|
|
2445
|
+
// (`collectChangedBundle` sends `modules: {}`), so the merge below
|
|
2446
|
+
// cannot be what keeps that union correct under Vite 8 — running after
|
|
2447
|
+
// the sidecars are emitted is.
|
|
2448
|
+
order: "post",
|
|
2449
|
+
async handler(_outputOptions, bundle) {
|
|
2450
|
+
await init;
|
|
2451
|
+
let inlinedSomething = true;
|
|
2452
|
+
while (inlinedSomething) {
|
|
2453
|
+
inlinedSomething = false;
|
|
2454
|
+
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
2455
|
+
if (chunk.type !== "chunk") continue;
|
|
2456
|
+
if (chunk.isEntry || chunk.isDynamicEntry) continue;
|
|
2457
|
+
if (!isInlinableSyntheticChunk(chunk)) continue;
|
|
2458
|
+
const expression = toInlineExpression(chunk.code);
|
|
2459
|
+
if (!expression) continue;
|
|
2460
|
+
let consumers = 0;
|
|
2461
|
+
let failures = 0;
|
|
2462
|
+
for (const [hostFileName, host] of Object.entries(bundle)) {
|
|
2463
|
+
if (host.type !== "chunk" || hostFileName === fileName) continue;
|
|
2464
|
+
if (!(host.imports ?? []).includes(fileName)) continue;
|
|
2465
|
+
consumers += 1;
|
|
2466
|
+
if (!inlineChunkInto(host, hostFileName, fileName, expression)) {
|
|
2467
|
+
failures += 1;
|
|
2468
|
+
continue;
|
|
2469
|
+
}
|
|
2470
|
+
absorbChunkMetadata(host, chunk, fileName);
|
|
2471
|
+
}
|
|
2472
|
+
if (consumers > 0 && failures === 0) {
|
|
2473
|
+
delete bundle[fileName];
|
|
2474
|
+
inlinedSomething = true;
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
2479
|
+
if (chunk.type !== "chunk" || chunk.isEntry || chunk.isDynamicEntry) continue;
|
|
2480
|
+
const consumers = Object.entries(bundle).filter(
|
|
2481
|
+
([, host]) => host.type === "chunk" && (host.imports ?? []).includes(fileName)
|
|
2482
|
+
).map(([hostFileName]) => hostFileName);
|
|
2483
|
+
if (consumers.length === 0) continue;
|
|
2484
|
+
const moduleIds = Object.keys(chunk.modules ?? {});
|
|
2485
|
+
const unpartitionable = moduleIds.filter(
|
|
2486
|
+
(id) => !id.includes("\0") && !PARTITIONABLE_EXTENSION.test(id.split("?")[0])
|
|
2487
|
+
);
|
|
2488
|
+
this.warn(
|
|
2489
|
+
`wp-script-dedupe: shared chunk ${fileName} could not be duplicated into its consumers (${consumers.join(", ")}). It holds: ${moduleIds.join(", ")}. ` + (unpartitionable.length > 0 ? `Only JS/TS modules can be partitioned per entry, so a shared non-JS module (${unpartitionable.join(", ")}) stays in a chunk a classic script cannot import. Re-export it from a per-entry .ts module, give each entry its own copy, or build these entries in module mode.` : `A classic script cannot import, so those entries will not load \u2014 report the module list above upstream.`)
|
|
2490
|
+
);
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
function absorbChunkMetadata(host, inlined, inlinedFileName) {
|
|
2497
|
+
host.modules = { ...host.modules, ...inlined.modules };
|
|
2498
|
+
host.moduleIds = [.../* @__PURE__ */ new Set([...host.moduleIds ?? [], ...inlined.moduleIds ?? []])];
|
|
2499
|
+
host.imports = (host.imports ?? []).filter((imported) => imported !== inlinedFileName);
|
|
2500
|
+
const importedBindings = host.importedBindings;
|
|
2501
|
+
if (importedBindings) delete importedBindings[inlinedFileName];
|
|
2502
|
+
mergeViteMetadata(host, inlined);
|
|
2503
|
+
}
|
|
2504
|
+
function mergeViteMetadata(host, inlined) {
|
|
2505
|
+
const hostMetadata = host.viteMetadata;
|
|
2506
|
+
const inlinedMetadata = inlined.viteMetadata;
|
|
2507
|
+
if (!hostMetadata || !inlinedMetadata) return;
|
|
2508
|
+
for (const cssFileName of inlinedMetadata.importedCss ?? []) {
|
|
2509
|
+
hostMetadata.importedCss?.add(cssFileName);
|
|
2510
|
+
}
|
|
2511
|
+
for (const assetFileName of inlinedMetadata.importedAssets ?? []) {
|
|
2512
|
+
hostMetadata.importedAssets?.add(assetFileName);
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
function inlineChunkInto(host, hostFileName, targetFileName, expression) {
|
|
2516
|
+
const [imports] = parse(host.code);
|
|
2517
|
+
const replacements = [];
|
|
2518
|
+
let counter = 0;
|
|
2519
|
+
for (const record of imports) {
|
|
2520
|
+
if (record.d !== -1) continue;
|
|
2521
|
+
if (!record.n) continue;
|
|
2522
|
+
if (resolveChunkSpecifier(hostFileName, record.n) !== targetFileName) continue;
|
|
2523
|
+
const clause = parseImportClause(host.code.slice(record.ss, record.se));
|
|
2524
|
+
if (!clause) return false;
|
|
2525
|
+
const named = clause.named.map(({ imported, local }) => `${objectKey(imported)}: ${local}`).join(", ");
|
|
2526
|
+
let code;
|
|
2527
|
+
if (clause.default || clause.namespace && clause.named.length > 0) {
|
|
2528
|
+
const temp = `__wpInlined${counter++}`;
|
|
2529
|
+
const parts = [`const ${temp} = ${expression};`];
|
|
2530
|
+
if (clause.default) parts.push(`const ${clause.default} = ${temp}["default"];`);
|
|
2531
|
+
if (clause.namespace) parts.push(`const ${clause.namespace} = ${temp};`);
|
|
2532
|
+
if (named) parts.push(`const { ${named} } = ${temp};`);
|
|
2533
|
+
code = parts.join("\n");
|
|
2534
|
+
} else if (clause.namespace) {
|
|
2535
|
+
code = `const ${clause.namespace} = ${expression};`;
|
|
2536
|
+
} else if (named) {
|
|
2537
|
+
code = `const { ${named} } = ${expression};`;
|
|
2538
|
+
} else {
|
|
2539
|
+
code = `${expression};`;
|
|
2540
|
+
}
|
|
2541
|
+
replacements.push({ start: record.ss, end: record.se, code });
|
|
2542
|
+
}
|
|
2543
|
+
if (replacements.length === 0) return false;
|
|
2544
|
+
const magicString = new MagicString(host.code);
|
|
2545
|
+
for (const replacement of replacements.reverse()) {
|
|
2546
|
+
magicString.overwrite(replacement.start, replacement.end, replacement.code);
|
|
2547
|
+
const line = host.code.slice(0, replacement.start).split("\n").length - 1;
|
|
2548
|
+
const addedLines = replacement.code.split("\n").length - host.code.slice(replacement.start, replacement.end).split("\n").length;
|
|
2549
|
+
shiftMappings(host.map, line, addedLines);
|
|
2550
|
+
}
|
|
2551
|
+
host.code = magicString.toString();
|
|
2552
|
+
return true;
|
|
2066
2553
|
}
|
|
2067
2554
|
|
|
2068
2555
|
// src/wp-script-iife.ts
|
|
2556
|
+
var CLASSIC_SCRIPT_DEFINE = {
|
|
2557
|
+
"import.meta.url": "document.currentScript && document.currentScript.src",
|
|
2558
|
+
"import.meta.resolve": "undefined"
|
|
2559
|
+
};
|
|
2560
|
+
var LIVE_MODULE_STATEMENT = /^[ \t]*(?:import\s*(?:[{*"']|[A-Za-z_$][\w$]*\s*(?:,|from\b))|export\s*(?:[{*]|(?:default|const|let|var|function|class|async)\b))[^\n]*/m;
|
|
2069
2561
|
function wpScriptIife() {
|
|
2070
2562
|
return {
|
|
2071
2563
|
name: "wp-script-iife",
|
|
2564
|
+
// Build-only. Vite filters plugins by `apply` before it runs `config`,
|
|
2565
|
+
// which is what keeps the `import.meta` define below out of `vite serve`
|
|
2566
|
+
// — the dev server ships real ESM to the browser, where `import.meta.url`
|
|
2567
|
+
// is both legal and load-bearing.
|
|
2568
|
+
apply: "build",
|
|
2569
|
+
config(userConfig) {
|
|
2570
|
+
const define = {};
|
|
2571
|
+
for (const [key, value] of Object.entries(CLASSIC_SCRIPT_DEFINE)) {
|
|
2572
|
+
if (userConfig.define && key in userConfig.define) continue;
|
|
2573
|
+
define[key] = value;
|
|
2574
|
+
}
|
|
2575
|
+
return Object.keys(define).length > 0 ? { define } : null;
|
|
2576
|
+
},
|
|
2072
2577
|
async writeBundle(options, bundle) {
|
|
2073
2578
|
const { readFile, writeFile } = await import('fs/promises');
|
|
2074
|
-
const { join:
|
|
2579
|
+
const { join: join5 } = await import('path');
|
|
2075
2580
|
const outDir = options.dir ?? ".";
|
|
2076
2581
|
for (const [fileName, output] of Object.entries(bundle)) {
|
|
2077
2582
|
if (output.type !== "chunk") continue;
|
|
2078
2583
|
if (!fileName.endsWith(".js") && !fileName.endsWith(".mjs")) continue;
|
|
2079
2584
|
if (!output.isEntry && !output.isDynamicEntry) continue;
|
|
2080
|
-
const filePath =
|
|
2585
|
+
const filePath = join5(outDir, fileName);
|
|
2081
2586
|
let chunkSource = await readFile(filePath, "utf8");
|
|
2082
2587
|
const sideEffectImport = /^\s*import\s+["'][^"']+["'];?\s*\n?/;
|
|
2083
2588
|
while (sideEffectImport.test(chunkSource)) {
|
|
2084
2589
|
chunkSource = chunkSource.replace(sideEffectImport, "");
|
|
2085
2590
|
}
|
|
2591
|
+
assertClassicScript(fileName, chunkSource, output.isEntry !== true);
|
|
2086
2592
|
await writeFile(filePath, `(()=>{
|
|
2087
2593
|
${chunkSource}
|
|
2088
2594
|
})();
|
|
@@ -2091,6 +2597,37 @@ ${chunkSource}
|
|
|
2091
2597
|
}
|
|
2092
2598
|
};
|
|
2093
2599
|
}
|
|
2600
|
+
function assertClassicScript(fileName, code, isDynamicOnly = false) {
|
|
2601
|
+
let parseError;
|
|
2602
|
+
try {
|
|
2603
|
+
new Function(code);
|
|
2604
|
+
return;
|
|
2605
|
+
} catch (error) {
|
|
2606
|
+
if (!(error instanceof SyntaxError)) throw error;
|
|
2607
|
+
parseError = error;
|
|
2608
|
+
}
|
|
2609
|
+
const liveStatement = code.match(LIVE_MODULE_STATEMENT);
|
|
2610
|
+
if (liveStatement) {
|
|
2611
|
+
const specifiers = [...code.matchAll(/^[ \t]*(?:import|export)\b[^\n]*?["']([^"']+)["']/gm)].map((match) => match[1]).filter((specifier, index, all) => all.indexOf(specifier) === index);
|
|
2612
|
+
throw new Error(
|
|
2613
|
+
`wp-script-iife: ${fileName} still contains a top-level module statement, which is a SyntaxError once WordPress enqueues it as a classic script:
|
|
2614
|
+
${liveStatement[0].trim()}
|
|
2615
|
+
` + (specifiers.length > 0 ? ` Imported chunk(s): ${specifiers.join(", ")}
|
|
2616
|
+
` : "") + (isDynamicOnly ? ` This file is a dynamic-import chunk, so it needs its \`export\`s and cannot be an IIFE. A script-mode entry can't lazily load one either (WP has no module context to resolve it in) \u2014 drop the dynamic \`import()\`, or build this entry in module mode.` : ` This is almost always a shared chunk: a module two or more script-mode entries import gets hoisted into its own chunk instead of being duplicated into each entry. Add the wpScriptDedupe() plugin (auto-included by wp() in script mode \u2014 check you haven't set \`scriptDedupe: false\`), or build this entry in module mode.`)
|
|
2617
|
+
);
|
|
2618
|
+
}
|
|
2619
|
+
if (/\bimport\.meta\b/.test(code)) {
|
|
2620
|
+
throw new Error(
|
|
2621
|
+
`wp-script-iife: ${fileName} references \`import.meta\`, which is a SyntaxError once WordPress enqueues it as a classic script.
|
|
2622
|
+
Vite injects its module-preload helper (which reads \`import.meta.url\`) whenever the bundled graph contains a dynamic \`import()\` \u2014 \`build.modulePreload: false\` does not remove it. This plugin's \`config()\` hook defines \`import.meta.url\`/\`import.meta.resolve\` away; a surviving reference means either that define was overridden, or the code touches another \`import.meta\` member. Extend \`define\` in your Vite config, or move this entry to module mode.`
|
|
2623
|
+
);
|
|
2624
|
+
}
|
|
2625
|
+
throw new Error(
|
|
2626
|
+
`wp-script-iife: ${fileName} does not parse as a classic script, so WordPress could not load it:
|
|
2627
|
+
${parseError.message}
|
|
2628
|
+
Nothing in this plugin's usual suspects (a shared chunk's \`import\`, an \`import.meta\` reference) explains it \u2014 inspect the written file, and report it upstream if the source is valid.`
|
|
2629
|
+
);
|
|
2630
|
+
}
|
|
2094
2631
|
|
|
2095
2632
|
// src/wp-clean-css-chunks.ts
|
|
2096
2633
|
function wpCleanCssChunks() {
|
|
@@ -2107,8 +2644,66 @@ function wpCleanCssChunks() {
|
|
|
2107
2644
|
}
|
|
2108
2645
|
};
|
|
2109
2646
|
}
|
|
2647
|
+
var STYLESHEET_EXTENSION = /\.(css|scss|sass)$/i;
|
|
2648
|
+
function wpCssAssetInfo() {
|
|
2649
|
+
const cssEntries = /* @__PURE__ */ new Map();
|
|
2650
|
+
return {
|
|
2651
|
+
name: "wp-css-asset-info",
|
|
2652
|
+
configResolved(config) {
|
|
2653
|
+
cssEntries.clear();
|
|
2654
|
+
const input = config.build?.rollupOptions?.input;
|
|
2655
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) return;
|
|
2656
|
+
for (const [entryName, source] of Object.entries(input)) {
|
|
2657
|
+
if (typeof source === "string" && STYLESHEET_EXTENSION.test(source)) {
|
|
2658
|
+
cssEntries.set(entryName, source);
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
},
|
|
2662
|
+
generateBundle: {
|
|
2663
|
+
// MUST be post: wpBlockStyles strips its dedup markers from CSS
|
|
2664
|
+
// assets in its own normal-order generateBundle, and the version has
|
|
2665
|
+
// to hash the FINAL shipped bytes, not the pre-strip content.
|
|
2666
|
+
order: "post",
|
|
2667
|
+
handler(_outputOptions, bundle) {
|
|
2668
|
+
for (const [entryName, sourcePath] of cssEntries) {
|
|
2669
|
+
const expectedFileName = `${entryName}.css`;
|
|
2670
|
+
const cssAsset = findCssAsset(bundle, expectedFileName, sourcePath);
|
|
2671
|
+
if (!cssAsset) continue;
|
|
2672
|
+
const assetPhpFileName = cssAsset.fileName.replace(/\.css$/i, ".asset.php");
|
|
2673
|
+
if (bundle[assetPhpFileName]) continue;
|
|
2674
|
+
const version = crypto.createHash("md5").update(cssAsset.source).digest("hex");
|
|
2675
|
+
this.emitFile({
|
|
2676
|
+
type: "asset",
|
|
2677
|
+
fileName: assetPhpFileName,
|
|
2678
|
+
source: `<?php return array( 'dependencies' => array(), 'version' => '${version}' );
|
|
2679
|
+
`
|
|
2680
|
+
});
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
};
|
|
2685
|
+
}
|
|
2686
|
+
function findCssAsset(bundle, expectedFileName, sourcePath) {
|
|
2687
|
+
const direct = bundle[expectedFileName];
|
|
2688
|
+
if (direct && direct.type === "asset") return direct;
|
|
2689
|
+
for (const output of Object.values(bundle)) {
|
|
2690
|
+
if (output.type !== "asset") continue;
|
|
2691
|
+
if (output.names?.includes(expectedFileName)) return output;
|
|
2692
|
+
if (output.originalFileNames?.some((name) => sourcePath.endsWith(name))) return output;
|
|
2693
|
+
}
|
|
2694
|
+
return void 0;
|
|
2695
|
+
}
|
|
2110
2696
|
|
|
2111
2697
|
// src/wp.ts
|
|
2698
|
+
function wpModuleEntrySignatures() {
|
|
2699
|
+
return {
|
|
2700
|
+
name: "wp-module-entry-signatures",
|
|
2701
|
+
config(userConfig) {
|
|
2702
|
+
if (userConfig.build?.rollupOptions?.preserveEntrySignatures !== void 0) return null;
|
|
2703
|
+
return { build: { rollupOptions: { preserveEntrySignatures: "exports-only" } } };
|
|
2704
|
+
}
|
|
2705
|
+
};
|
|
2706
|
+
}
|
|
2112
2707
|
function wp(options = {}) {
|
|
2113
2708
|
const buildType = options.buildType ?? "script";
|
|
2114
2709
|
const plugins = [];
|
|
@@ -2180,15 +2775,24 @@ function wp(options = {}) {
|
|
|
2180
2775
|
})
|
|
2181
2776
|
);
|
|
2182
2777
|
}
|
|
2778
|
+
if (buildType === "script" && options.scriptDedupe !== false) {
|
|
2779
|
+
plugins.push(wpScriptDedupe());
|
|
2780
|
+
}
|
|
2183
2781
|
if (buildType === "script" && options.iife !== false) {
|
|
2184
2782
|
plugins.push(wpScriptIife());
|
|
2185
2783
|
}
|
|
2186
2784
|
if (options.cleanCssChunks !== false) {
|
|
2187
2785
|
plugins.push(wpCleanCssChunks());
|
|
2188
2786
|
}
|
|
2787
|
+
if (options.cssAssetInfo !== false) {
|
|
2788
|
+
plugins.push(wpCssAssetInfo());
|
|
2789
|
+
}
|
|
2790
|
+
if (buildType === "module") {
|
|
2791
|
+
plugins.push(wpModuleEntrySignatures());
|
|
2792
|
+
}
|
|
2189
2793
|
return plugins;
|
|
2190
2794
|
}
|
|
2191
2795
|
|
|
2192
|
-
export { wp, wpAdminPages, wpBlockStyles, wpBlocks, wpCleanCssChunks, wpCopyAssets, wpExternals, wpScriptIife };
|
|
2796
|
+
export { DEFAULT_BUNDLED_PACKAGES, wp, wpAdminPages, wpBlockStyles, wpBlocks, wpCleanCssChunks, wpCopyAssets, wpCssAssetInfo, wpExternals, wpScriptDedupe, wpScriptIife };
|
|
2193
2797
|
//# sourceMappingURL=index.js.map
|
|
2194
2798
|
//# sourceMappingURL=index.js.map
|