@10up/build 1.0.0-alpha.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/README.md +508 -0
- package/bin/10up-build.js +11 -0
- package/config/postcss.config.js +36 -0
- package/dist/build.d.ts +11 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +315 -0
- package/dist/build.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +122 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +103 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +230 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/block-json.d.ts +18 -0
- package/dist/plugins/block-json.d.ts.map +1 -0
- package/dist/plugins/block-json.js +172 -0
- package/dist/plugins/block-json.js.map +1 -0
- package/dist/plugins/copy-assets.d.ts +15 -0
- package/dist/plugins/copy-assets.d.ts.map +1 -0
- package/dist/plugins/copy-assets.js +62 -0
- package/dist/plugins/copy-assets.js.map +1 -0
- package/dist/plugins/sass-plugin.d.ts +17 -0
- package/dist/plugins/sass-plugin.d.ts.map +1 -0
- package/dist/plugins/sass-plugin.js +163 -0
- package/dist/plugins/sass-plugin.js.map +1 -0
- package/dist/plugins/wp-dependency-extraction.d.ts +27 -0
- package/dist/plugins/wp-dependency-extraction.d.ts.map +1 -0
- package/dist/plugins/wp-dependency-extraction.js +306 -0
- package/dist/plugins/wp-dependency-extraction.js.map +1 -0
- package/dist/types.d.ts +540 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/entry-detection.d.ts +13 -0
- package/dist/utils/entry-detection.d.ts.map +1 -0
- package/dist/utils/entry-detection.js +218 -0
- package/dist/utils/entry-detection.js.map +1 -0
- package/dist/utils/externals.d.ts +62 -0
- package/dist/utils/externals.d.ts.map +1 -0
- package/dist/utils/externals.js +152 -0
- package/dist/utils/externals.js.map +1 -0
- package/dist/utils/paths.d.ts +40 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +70 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/watch.d.ts +13 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +214 -0
- package/dist/watch.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SASS/SCSS Plugin for esbuild
|
|
3
|
+
*
|
|
4
|
+
* Compiles SCSS files using the sass package,
|
|
5
|
+
* then processes with PostCSS and lightningcss.
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync } from 'node:fs';
|
|
8
|
+
import { dirname, resolve, extname } from 'node:path';
|
|
9
|
+
import * as sass from 'sass';
|
|
10
|
+
import postcss from 'postcss';
|
|
11
|
+
// @ts-expect-error - postcss-import doesn't have types
|
|
12
|
+
import postcssImport from 'postcss-import';
|
|
13
|
+
// @ts-expect-error - postcss-mixins doesn't have types
|
|
14
|
+
import postcssMixins from 'postcss-mixins';
|
|
15
|
+
// @ts-ignore - @csstools/postcss-global-data doesn't have types
|
|
16
|
+
import postcssGlobalData from '@csstools/postcss-global-data';
|
|
17
|
+
// @ts-ignore - postcss-custom-media doesn't have types
|
|
18
|
+
import postcssCustomMedia from 'postcss-custom-media';
|
|
19
|
+
import { transform, browserslistToTargets } from 'lightningcss';
|
|
20
|
+
import fastGlob from 'fast-glob';
|
|
21
|
+
const glob = fastGlob.sync;
|
|
22
|
+
import { normalizePath } from '../utils/paths.js';
|
|
23
|
+
/**
|
|
24
|
+
* Default browser targets for lightningcss
|
|
25
|
+
*/
|
|
26
|
+
const defaultTargets = browserslistToTargets([
|
|
27
|
+
'> 1%',
|
|
28
|
+
'last 2 versions',
|
|
29
|
+
'Firefox ESR',
|
|
30
|
+
'not dead',
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* Create the SASS plugin for esbuild
|
|
34
|
+
*/
|
|
35
|
+
export function sassPlugin(config, isProduction) {
|
|
36
|
+
return {
|
|
37
|
+
name: 'sass',
|
|
38
|
+
setup(build) {
|
|
39
|
+
// Handle .scss and .sass files
|
|
40
|
+
build.onLoad({ filter: /\.s[ac]ss$/ }, async (args) => {
|
|
41
|
+
try {
|
|
42
|
+
// Compile SCSS to CSS
|
|
43
|
+
const sassResult = sass.compile(args.path, {
|
|
44
|
+
loadPaths: [dirname(args.path), 'node_modules'],
|
|
45
|
+
sourceMap: !isProduction,
|
|
46
|
+
style: isProduction ? 'compressed' : 'expanded',
|
|
47
|
+
});
|
|
48
|
+
let css = sassResult.css;
|
|
49
|
+
// Process with PostCSS
|
|
50
|
+
css = await processWithPostCSS(css, args.path, config);
|
|
51
|
+
// Process with lightningcss for modern CSS features and minification
|
|
52
|
+
css = processWithLightningCSS(css, args.path, isProduction);
|
|
53
|
+
return {
|
|
54
|
+
contents: css,
|
|
55
|
+
loader: 'css',
|
|
56
|
+
watchFiles: sassResult.loadedUrls
|
|
57
|
+
.filter((url) => url.protocol === 'file:')
|
|
58
|
+
.map((url) => url.pathname),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return {
|
|
63
|
+
errors: [
|
|
64
|
+
{
|
|
65
|
+
text: error instanceof Error ? error.message : String(error),
|
|
66
|
+
location: { file: args.path },
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
// Handle regular .css files (also process with PostCSS and lightningcss)
|
|
73
|
+
build.onLoad({ filter: /\.css$/ }, async (args) => {
|
|
74
|
+
// Skip if this is a CSS module or already processed
|
|
75
|
+
if (args.path.includes('.module.') || args.namespace !== 'file') {
|
|
76
|
+
return { loader: 'css' };
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
let css = readFileSync(args.path, 'utf8');
|
|
80
|
+
// Process with PostCSS
|
|
81
|
+
css = await processWithPostCSS(css, args.path, config);
|
|
82
|
+
// Process with lightningcss
|
|
83
|
+
css = processWithLightningCSS(css, args.path, isProduction);
|
|
84
|
+
return {
|
|
85
|
+
contents: css,
|
|
86
|
+
loader: 'css',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
return {
|
|
91
|
+
errors: [
|
|
92
|
+
{
|
|
93
|
+
text: error instanceof Error ? error.message : String(error),
|
|
94
|
+
location: { file: args.path },
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Process CSS with PostCSS plugins
|
|
105
|
+
*/
|
|
106
|
+
async function processWithPostCSS(css, filePath, config) {
|
|
107
|
+
const plugins = [postcssImport()];
|
|
108
|
+
// Add global data plugin if global styles exist
|
|
109
|
+
const globalStylesDir = resolve(process.cwd(), config.paths.globalStylesDir);
|
|
110
|
+
const globalCssFiles = glob(normalizePath(`${globalStylesDir}/**/*.css`));
|
|
111
|
+
if (globalCssFiles.length > 0) {
|
|
112
|
+
plugins.push(postcssGlobalData({ files: globalCssFiles }));
|
|
113
|
+
}
|
|
114
|
+
// Add custom media plugin to transform @custom-media queries
|
|
115
|
+
// This must come after postcssGlobalData which makes the definitions available
|
|
116
|
+
plugins.push(postcssCustomMedia());
|
|
117
|
+
// Add mixins plugin if mixin files exist
|
|
118
|
+
const globalMixinsDir = resolve(process.cwd(), config.paths.globalMixinsDir);
|
|
119
|
+
const globalMixinFiles = glob(normalizePath(`${globalMixinsDir}/**/*.css`));
|
|
120
|
+
if (globalMixinFiles.length > 0) {
|
|
121
|
+
plugins.push(postcssMixins({ mixinsFiles: globalMixinFiles }));
|
|
122
|
+
}
|
|
123
|
+
const result = await postcss(plugins).process(css, {
|
|
124
|
+
from: filePath,
|
|
125
|
+
to: filePath,
|
|
126
|
+
});
|
|
127
|
+
return result.css;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Process CSS with lightningcss for modern features and minification
|
|
131
|
+
*/
|
|
132
|
+
function processWithLightningCSS(css, filePath, isProduction) {
|
|
133
|
+
// Handle empty CSS (or CSS with only comments/whitespace)
|
|
134
|
+
const trimmed = css.replace(/\/\*[\s\S]*?\*\//g, '').trim();
|
|
135
|
+
if (!trimmed) {
|
|
136
|
+
return isProduction ? '' : '/* empty */';
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const { code } = transform({
|
|
140
|
+
filename: filePath,
|
|
141
|
+
code: Buffer.from(css),
|
|
142
|
+
minify: isProduction,
|
|
143
|
+
sourceMap: !isProduction,
|
|
144
|
+
targets: defaultTargets,
|
|
145
|
+
// Note: customMedia is handled by postcss-custom-media in the PostCSS phase
|
|
146
|
+
});
|
|
147
|
+
return code.toString();
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
// If lightningcss fails, return the original CSS
|
|
151
|
+
// This can happen with certain edge cases
|
|
152
|
+
console.warn(`Warning: lightningcss failed for ${filePath}, using original CSS`);
|
|
153
|
+
return css;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get file extension
|
|
158
|
+
*/
|
|
159
|
+
export function isStyleFile(filePath) {
|
|
160
|
+
const ext = extname(filePath).toLowerCase();
|
|
161
|
+
return ['.css', '.scss', '.sass'].includes(ext);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=sass-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sass-plugin.js","sourceRoot":"","sources":["../../src/plugins/sass-plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WA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C;QAC1C,OAAO,CAAC,IAAI,CAAC,oCAAoC,QAAQ,sBAAsB,CAAC,CAAC;QACjF,OAAO,GAAG,CAAC;IACZ,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC3C,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress Dependency Extraction Plugin for esbuild
|
|
3
|
+
*
|
|
4
|
+
* Tracks @wordpress/* and vendor imports, externalizes them,
|
|
5
|
+
* and generates .asset.php files with dependency metadata.
|
|
6
|
+
*
|
|
7
|
+
* For ES Modules, generates a different format:
|
|
8
|
+
* <?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => 'xxx', 'type' => 'module');
|
|
9
|
+
*/
|
|
10
|
+
import type { Plugin } from 'esbuild';
|
|
11
|
+
import type { BuildConfig, DependencyInfo } from '../types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Create the WordPress Dependency Extraction plugin
|
|
14
|
+
* Each plugin instance has its own dependency tracking state
|
|
15
|
+
*/
|
|
16
|
+
export declare function wpDependencyExtractionPlugin(config: BuildConfig): Plugin;
|
|
17
|
+
/**
|
|
18
|
+
* Get all tracked dependencies (for testing/debugging)
|
|
19
|
+
* Note: This returns empty map since dependencies are now instance-specific
|
|
20
|
+
*/
|
|
21
|
+
export declare function getDependencies(): Map<string, DependencyInfo>;
|
|
22
|
+
/**
|
|
23
|
+
* Clear all tracked dependencies (for testing)
|
|
24
|
+
* Note: This is now a no-op since dependencies are instance-specific
|
|
25
|
+
*/
|
|
26
|
+
export declare function clearDependencies(): void;
|
|
27
|
+
//# sourceMappingURL=wp-dependency-extraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wp-dependency-extraction.d.ts","sourceRoot":"","sources":["../../src/plugins/wp-dependency-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,MAAM,EAA+C,MAAM,SAAS,CAAC;AAGnF,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAwF/D;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CA2PxE;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAE7D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress Dependency Extraction Plugin for esbuild
|
|
3
|
+
*
|
|
4
|
+
* Tracks @wordpress/* and vendor imports, externalizes them,
|
|
5
|
+
* and generates .asset.php files with dependency metadata.
|
|
6
|
+
*
|
|
7
|
+
* For ES Modules, generates a different format:
|
|
8
|
+
* <?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => 'xxx', 'type' => 'module');
|
|
9
|
+
*/
|
|
10
|
+
import { writeFileSync, readFileSync, mkdirSync } from 'node:fs';
|
|
11
|
+
import { dirname, resolve } from 'node:path';
|
|
12
|
+
import pc from 'picocolors';
|
|
13
|
+
import { resolveExternal, vendorExternals } from '../utils/externals.js';
|
|
14
|
+
import { getContentHash } from '../utils/paths.js';
|
|
15
|
+
/**
|
|
16
|
+
* Track which packages we've already warned about to avoid duplicate warnings
|
|
17
|
+
*/
|
|
18
|
+
const warnedPackages = new Set();
|
|
19
|
+
/**
|
|
20
|
+
* Warn about uninstalled @wordpress packages
|
|
21
|
+
*
|
|
22
|
+
* While packages will still be externalized (since they're available in WordPress),
|
|
23
|
+
* installing them provides TypeScript types and allows for better dependency tracking.
|
|
24
|
+
*
|
|
25
|
+
* @param packageName - The @wordpress/* package name
|
|
26
|
+
*/
|
|
27
|
+
function warnUninstalledPackage(packageName) {
|
|
28
|
+
if (warnedPackages.has(packageName)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
warnedPackages.add(packageName);
|
|
32
|
+
// Only warn once per build
|
|
33
|
+
if (warnedPackages.size === 1) {
|
|
34
|
+
console.log(pc.yellow('\nNote: ') +
|
|
35
|
+
pc.dim('Some @wordpress packages are not installed locally.'));
|
|
36
|
+
console.log(pc.dim('For better TypeScript support and dependency tracking, consider installing them:'));
|
|
37
|
+
console.log(pc.dim('npm install --save-optional @wordpress/blocks @wordpress/i18n ...\n'));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Generate PHP array syntax for dependencies (IIFE/classic scripts)
|
|
42
|
+
*/
|
|
43
|
+
function generatePhpArray(deps) {
|
|
44
|
+
if (deps.length === 0) {
|
|
45
|
+
return 'array()';
|
|
46
|
+
}
|
|
47
|
+
const items = deps.map((d) => `'${d}'`).join(', ');
|
|
48
|
+
return `array(${items})`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Generate .asset.php file content for classic scripts (IIFE)
|
|
52
|
+
*/
|
|
53
|
+
function generateAssetPhp(dependencies, version) {
|
|
54
|
+
return `<?php return array('dependencies' => ${generatePhpArray(dependencies)}, 'version' => '${version}');
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Generate .asset.php file content for ES Modules
|
|
59
|
+
* ES Modules use the package name directly (e.g., '@wordpress/interactivity')
|
|
60
|
+
* rather than the wp-handle format
|
|
61
|
+
*/
|
|
62
|
+
function generateModuleAssetPhp(dependencies, version) {
|
|
63
|
+
if (dependencies.length === 0) {
|
|
64
|
+
return `<?php return array('dependencies' => array(), 'version' => '${version}', 'type' => 'module');
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
// For modules, dependencies are the actual package names
|
|
68
|
+
const items = dependencies.map((d) => `'${d}'`).join(', ');
|
|
69
|
+
return `<?php return array('dependencies' => array(${items}), 'version' => '${version}', 'type' => 'module');
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Convert a handle back to package name for ES modules
|
|
74
|
+
* wp-interactivity -> @wordpress/interactivity
|
|
75
|
+
*/
|
|
76
|
+
function handleToPackageName(handle) {
|
|
77
|
+
if (handle.startsWith('wp-')) {
|
|
78
|
+
return `@wordpress/${handle.slice(3)}`;
|
|
79
|
+
}
|
|
80
|
+
// For vendor packages, return as-is (react, lodash, etc.)
|
|
81
|
+
return handle;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Normalize path for comparison (resolve and lowercase on Windows)
|
|
85
|
+
*/
|
|
86
|
+
function normalizePath(p) {
|
|
87
|
+
return resolve(p).replace(/\\/g, '/');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create the WordPress Dependency Extraction plugin
|
|
91
|
+
* Each plugin instance has its own dependency tracking state
|
|
92
|
+
*/
|
|
93
|
+
export function wpDependencyExtractionPlugin(config) {
|
|
94
|
+
// Instance-specific state
|
|
95
|
+
const entryDependencies = new Map();
|
|
96
|
+
const importerToEntry = new Map();
|
|
97
|
+
/**
|
|
98
|
+
* Get the entry point for an importer
|
|
99
|
+
*/
|
|
100
|
+
function getEntryForImporter(importer) {
|
|
101
|
+
const normalizedImporter = normalizePath(importer);
|
|
102
|
+
// If importer is itself an entry, return it
|
|
103
|
+
if (entryDependencies.has(normalizedImporter)) {
|
|
104
|
+
return normalizedImporter;
|
|
105
|
+
}
|
|
106
|
+
// Otherwise, look up the entry point
|
|
107
|
+
return importerToEntry.get(normalizedImporter);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Track a dependency for an entry point
|
|
111
|
+
*/
|
|
112
|
+
function trackDependency(importer, handle) {
|
|
113
|
+
const entry = getEntryForImporter(importer);
|
|
114
|
+
if (entry) {
|
|
115
|
+
const deps = entryDependencies.get(entry);
|
|
116
|
+
if (deps) {
|
|
117
|
+
deps.add(handle);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Register an importer-to-entry mapping
|
|
123
|
+
*/
|
|
124
|
+
function registerImporter(importer, entry) {
|
|
125
|
+
const normalizedImporter = normalizePath(importer);
|
|
126
|
+
const normalizedEntry = normalizePath(entry);
|
|
127
|
+
if (normalizedImporter !== normalizedEntry) {
|
|
128
|
+
importerToEntry.set(normalizedImporter, normalizedEntry);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
name: 'wp-dependency-extraction',
|
|
133
|
+
setup(build) {
|
|
134
|
+
// Get entry points to initialize tracking
|
|
135
|
+
const entryPoints = build.initialOptions.entryPoints;
|
|
136
|
+
if (entryPoints) {
|
|
137
|
+
if (Array.isArray(entryPoints)) {
|
|
138
|
+
for (const entry of entryPoints) {
|
|
139
|
+
if (typeof entry === 'string') {
|
|
140
|
+
// Resolve to absolute path for consistent matching later
|
|
141
|
+
entryDependencies.set(normalizePath(resolve(entry)), new Set());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else if (typeof entryPoints === 'object') {
|
|
146
|
+
for (const entry of Object.values(entryPoints)) {
|
|
147
|
+
// Resolve to absolute path for consistent matching later
|
|
148
|
+
entryDependencies.set(normalizePath(resolve(entry)), new Set());
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Handle @wordpress/* imports
|
|
153
|
+
build.onResolve({ filter: /^@wordpress\// }, (args) => {
|
|
154
|
+
const external = resolveExternal(args.path, config);
|
|
155
|
+
if (external) {
|
|
156
|
+
// Warn if package is not installed locally
|
|
157
|
+
if (external._isInstalled === false) {
|
|
158
|
+
warnUninstalledPackage(args.path);
|
|
159
|
+
}
|
|
160
|
+
// Track the dependency
|
|
161
|
+
if (args.importer) {
|
|
162
|
+
trackDependency(args.importer, external.handle);
|
|
163
|
+
// Map this importer to its entry
|
|
164
|
+
const entry = getEntryForImporter(args.importer);
|
|
165
|
+
if (entry) {
|
|
166
|
+
registerImporter(args.importer, entry);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
path: args.path,
|
|
171
|
+
external: true,
|
|
172
|
+
namespace: 'wp-external',
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return undefined;
|
|
176
|
+
});
|
|
177
|
+
// Handle vendor externals (react, lodash, etc.)
|
|
178
|
+
const vendorFilter = new RegExp(`^(${Object.keys(vendorExternals)
|
|
179
|
+
.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
|
180
|
+
.join('|')})$`);
|
|
181
|
+
build.onResolve({ filter: vendorFilter }, (args) => {
|
|
182
|
+
const external = vendorExternals[args.path];
|
|
183
|
+
if (external) {
|
|
184
|
+
// Track the dependency
|
|
185
|
+
if (args.importer) {
|
|
186
|
+
trackDependency(args.importer, external.handle);
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
path: args.path,
|
|
190
|
+
external: true,
|
|
191
|
+
namespace: 'vendor-external',
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return undefined;
|
|
195
|
+
});
|
|
196
|
+
// Handle custom namespace externals
|
|
197
|
+
if (config.externalNamespaces && Object.keys(config.externalNamespaces).length > 0) {
|
|
198
|
+
for (const [namespace, mapping] of Object.entries(config.externalNamespaces)) {
|
|
199
|
+
const namespaceFilter = new RegExp(`^${namespace.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/`);
|
|
200
|
+
build.onResolve({ filter: namespaceFilter }, (args) => {
|
|
201
|
+
const packageName = args.path.replace(`${namespace}/`, '');
|
|
202
|
+
const handle = `${mapping.handlePrefix}-${packageName}`;
|
|
203
|
+
// Track the dependency
|
|
204
|
+
if (args.importer) {
|
|
205
|
+
trackDependency(args.importer, handle);
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
path: args.path,
|
|
209
|
+
external: true,
|
|
210
|
+
namespace: 'custom-external',
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Track imports between modules to propagate entry point info
|
|
216
|
+
build.onResolve({ filter: /.*/ }, (args) => {
|
|
217
|
+
if (args.importer && args.kind !== 'entry-point') {
|
|
218
|
+
const entry = getEntryForImporter(args.importer);
|
|
219
|
+
if (entry) {
|
|
220
|
+
// Try to resolve the imported path
|
|
221
|
+
const resolvedPath = args.resolveDir
|
|
222
|
+
? resolve(args.resolveDir, args.path)
|
|
223
|
+
: args.path;
|
|
224
|
+
registerImporter(resolvedPath, entry);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return undefined;
|
|
228
|
+
});
|
|
229
|
+
// Generate .asset.php files at the end of build
|
|
230
|
+
build.onEnd(async (result) => {
|
|
231
|
+
if (result.errors.length > 0) {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
const metafile = result.metafile;
|
|
235
|
+
if (!metafile) {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
// Build a map from entry point paths to their output paths
|
|
239
|
+
const entryToOutput = new Map();
|
|
240
|
+
for (const [outputPath, outputMeta] of Object.entries(metafile.outputs)) {
|
|
241
|
+
if (!outputMeta.entryPoint) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
// Normalize the entry point path for matching
|
|
245
|
+
const entryPath = normalizePath(resolve(outputMeta.entryPoint));
|
|
246
|
+
// Check if it's a module
|
|
247
|
+
const isModule = outputPath.endsWith('.mjs');
|
|
248
|
+
// Skip chunks
|
|
249
|
+
if (outputPath.includes('/chunks/')) {
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
entryToOutput.set(entryPath, { path: outputPath, isModule });
|
|
253
|
+
}
|
|
254
|
+
// Generate .asset.php for each tracked entry
|
|
255
|
+
for (const [entryPath, deps] of entryDependencies) {
|
|
256
|
+
const outputInfo = entryToOutput.get(entryPath);
|
|
257
|
+
if (!outputInfo) {
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const { path: outputPath, isModule } = outputInfo;
|
|
261
|
+
// Read output file content for version hash
|
|
262
|
+
let content = '';
|
|
263
|
+
try {
|
|
264
|
+
content = readFileSync(outputPath, 'utf8');
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
// File might not exist yet, use empty content
|
|
268
|
+
}
|
|
269
|
+
const version = getContentHash(content);
|
|
270
|
+
// Generate .asset.php with appropriate format
|
|
271
|
+
const assetPhpPath = outputPath.replace(/\.(m?js)$/, '.asset.php');
|
|
272
|
+
const sortedDeps = Array.from(deps).sort();
|
|
273
|
+
let assetPhpContent;
|
|
274
|
+
if (isModule) {
|
|
275
|
+
// For ES modules, convert handles back to package names
|
|
276
|
+
const packageDeps = sortedDeps.map(handleToPackageName);
|
|
277
|
+
assetPhpContent = generateModuleAssetPhp(packageDeps, version);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
assetPhpContent = generateAssetPhp(sortedDeps, version);
|
|
281
|
+
}
|
|
282
|
+
// Ensure directory exists
|
|
283
|
+
mkdirSync(dirname(assetPhpPath), { recursive: true });
|
|
284
|
+
// Write asset file
|
|
285
|
+
writeFileSync(assetPhpPath, assetPhpContent, 'utf8');
|
|
286
|
+
}
|
|
287
|
+
return undefined;
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Get all tracked dependencies (for testing/debugging)
|
|
294
|
+
* Note: This returns empty map since dependencies are now instance-specific
|
|
295
|
+
*/
|
|
296
|
+
export function getDependencies() {
|
|
297
|
+
return new Map();
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Clear all tracked dependencies (for testing)
|
|
301
|
+
* Note: This is now a no-op since dependencies are instance-specific
|
|
302
|
+
*/
|
|
303
|
+
export function clearDependencies() {
|
|
304
|
+
// No-op - dependencies are now cleared per plugin instance
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=wp-dependency-extraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wp-dependency-extraction.js","sourceRoot":"","sources":["../../src/plugins/wp-dependency-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;GAEG;AACH,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;AAEzC;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAAC,WAAmB;IAClD,IAAI,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QACrC,OAAO;IACR,CAAC;IACD,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEhC,2BAA2B;IAC3B,IAAI,cAAc,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CACV,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC;YACpB,EAAE,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAC9D,CAAC;QACF,OAAO,CAAC,GAAG,CACV,EAAE,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAC1F,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC,CAAC;IAC5F,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,IAAc;IACvC,IAAI,IAAI,CAAC,MAAM,KA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