@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.
Files changed (56) hide show
  1. package/README.md +508 -0
  2. package/bin/10up-build.js +11 -0
  3. package/config/postcss.config.js +36 -0
  4. package/dist/build.d.ts +11 -0
  5. package/dist/build.d.ts.map +1 -0
  6. package/dist/build.js +315 -0
  7. package/dist/build.js.map +1 -0
  8. package/dist/cli.d.ts +8 -0
  9. package/dist/cli.d.ts.map +1 -0
  10. package/dist/cli.js +122 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/config.d.ts +103 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/dist/config.js +230 -0
  15. package/dist/config.js.map +1 -0
  16. package/dist/index.d.ts +18 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +20 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/plugins/block-json.d.ts +18 -0
  21. package/dist/plugins/block-json.d.ts.map +1 -0
  22. package/dist/plugins/block-json.js +172 -0
  23. package/dist/plugins/block-json.js.map +1 -0
  24. package/dist/plugins/copy-assets.d.ts +15 -0
  25. package/dist/plugins/copy-assets.d.ts.map +1 -0
  26. package/dist/plugins/copy-assets.js +62 -0
  27. package/dist/plugins/copy-assets.js.map +1 -0
  28. package/dist/plugins/sass-plugin.d.ts +17 -0
  29. package/dist/plugins/sass-plugin.d.ts.map +1 -0
  30. package/dist/plugins/sass-plugin.js +163 -0
  31. package/dist/plugins/sass-plugin.js.map +1 -0
  32. package/dist/plugins/wp-dependency-extraction.d.ts +27 -0
  33. package/dist/plugins/wp-dependency-extraction.d.ts.map +1 -0
  34. package/dist/plugins/wp-dependency-extraction.js +306 -0
  35. package/dist/plugins/wp-dependency-extraction.js.map +1 -0
  36. package/dist/types.d.ts +540 -0
  37. package/dist/types.d.ts.map +1 -0
  38. package/dist/types.js +12 -0
  39. package/dist/types.js.map +1 -0
  40. package/dist/utils/entry-detection.d.ts +13 -0
  41. package/dist/utils/entry-detection.d.ts.map +1 -0
  42. package/dist/utils/entry-detection.js +218 -0
  43. package/dist/utils/entry-detection.js.map +1 -0
  44. package/dist/utils/externals.d.ts +62 -0
  45. package/dist/utils/externals.d.ts.map +1 -0
  46. package/dist/utils/externals.js +152 -0
  47. package/dist/utils/externals.js.map +1 -0
  48. package/dist/utils/paths.d.ts +40 -0
  49. package/dist/utils/paths.d.ts.map +1 -0
  50. package/dist/utils/paths.js +70 -0
  51. package/dist/utils/paths.js.map +1 -0
  52. package/dist/watch.d.ts +13 -0
  53. package/dist/watch.d.ts.map +1 -0
  54. package/dist/watch.js +214 -0
  55. package/dist/watch.js.map +1 -0
  56. package/package.json +73 -0
package/dist/config.js ADDED
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Configuration loading for @10up/build
3
+ *
4
+ * This module handles loading and merging configuration from multiple sources:
5
+ * 1. Default configuration values
6
+ * 2. `package.json["10up-toolkit"]` field
7
+ * 3. Configuration files (buildfiles.config.js, postcss.config.js)
8
+ *
9
+ * @packageDocumentation
10
+ * @module config
11
+ */
12
+ import { readFileSync, existsSync } from 'node:fs';
13
+ import { resolve } from 'node:path';
14
+ import { fromProjectRoot, fromPackageRoot } from './utils/paths.js';
15
+ /**
16
+ * Default paths configuration.
17
+ *
18
+ * These defaults follow the 10up-toolkit convention for WordPress
19
+ * theme and plugin development.
20
+ */
21
+ const defaultPaths = {
22
+ blocksDir: './includes/blocks/',
23
+ distDir: './dist/',
24
+ srcDir: './assets/',
25
+ copyAssetsDir: './assets/',
26
+ blocksStyles: './assets/css/blocks/',
27
+ globalStylesDir: './assets/css/globals/',
28
+ globalMixinsDir: './assets/css/mixins/',
29
+ };
30
+ /**
31
+ * Default filenames configuration.
32
+ *
33
+ * Uses esbuild-style placeholders for output naming.
34
+ */
35
+ const defaultFilenames = {
36
+ js: 'js/[name].js',
37
+ jsChunk: 'js/[name].[contenthash].chunk.js',
38
+ css: 'css/[name].css',
39
+ block: 'blocks/[name].js',
40
+ blockCSS: 'blocks/[name].css',
41
+ };
42
+ /**
43
+ * Default configuration values.
44
+ *
45
+ * These values are used when not overridden by user configuration.
46
+ * The configuration schema is designed to be compatible with
47
+ * 10up-toolkit's configuration format.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * import { defaultConfig } from '@10up/build/config';
52
+ * console.log(defaultConfig.wpDependencyExternals); // true
53
+ * ```
54
+ */
55
+ export const defaultConfig = {
56
+ // Entry points
57
+ entry: {},
58
+ moduleEntry: {},
59
+ // Paths
60
+ paths: defaultPaths,
61
+ // Output filenames
62
+ filenames: defaultFilenames,
63
+ // Features
64
+ useBlockAssets: false,
65
+ useScriptModules: false,
66
+ wpDependencyExternals: true,
67
+ loadBlockSpecificStyles: false,
68
+ // Development
69
+ hot: false,
70
+ devServerPort: 8887,
71
+ devURL: '',
72
+ // Build options
73
+ sourcemap: false,
74
+ publicPath: '/dist/',
75
+ // External namespaces for custom packages
76
+ externalNamespaces: {},
77
+ };
78
+ /**
79
+ * Load and merge configuration from all sources.
80
+ *
81
+ * Configuration is loaded in the following order (later sources override earlier):
82
+ * 1. Default configuration
83
+ * 2. `package.json["10up-toolkit"]` field
84
+ * 3. PostCSS configuration file detection
85
+ *
86
+ * @returns Merged build configuration
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * import { loadConfig } from '@10up/build';
91
+ *
92
+ * const config = loadConfig();
93
+ * console.log(config.paths.blocksDir); // "./includes/blocks/"
94
+ * ```
95
+ */
96
+ export function loadConfig() {
97
+ const projectPackageJson = loadProjectPackageJson();
98
+ const toolkitConfig = (projectPackageJson?.['10up-toolkit'] || {});
99
+ // Deep merge paths
100
+ const paths = {
101
+ ...defaultPaths,
102
+ ...(toolkitConfig.paths || {}),
103
+ };
104
+ // Deep merge filenames
105
+ const filenames = {
106
+ ...defaultFilenames,
107
+ ...(toolkitConfig.filenames || {}),
108
+ };
109
+ // Merge all config
110
+ const config = {
111
+ ...defaultConfig,
112
+ ...toolkitConfig,
113
+ paths,
114
+ filenames,
115
+ };
116
+ // Load additional config files
117
+ config.postcss = loadPostcssConfig(config);
118
+ return config;
119
+ }
120
+ /**
121
+ * Load the project's package.json file.
122
+ *
123
+ * Reads and parses the package.json from the current working directory.
124
+ *
125
+ * @returns Parsed package.json content, or null if not found/invalid
126
+ *
127
+ * @internal
128
+ */
129
+ function loadProjectPackageJson() {
130
+ const packageJsonPath = fromProjectRoot('package.json');
131
+ if (!existsSync(packageJsonPath)) {
132
+ return null;
133
+ }
134
+ try {
135
+ return JSON.parse(readFileSync(packageJsonPath, 'utf8'));
136
+ }
137
+ catch {
138
+ return null;
139
+ }
140
+ }
141
+ /**
142
+ * Load PostCSS configuration.
143
+ *
144
+ * Checks for a postcss.config.js in the project root.
145
+ * If not found, uses the default configuration with global styles and mixins.
146
+ *
147
+ * @param config - Current build configuration (for path resolution)
148
+ * @returns PostCSS configuration object
149
+ *
150
+ * @internal
151
+ */
152
+ function loadPostcssConfig(config) {
153
+ // Check for project postcss.config.js
154
+ const projectPostcssPath = fromProjectRoot('postcss.config.js');
155
+ if (existsSync(projectPostcssPath)) {
156
+ return { configPath: projectPostcssPath };
157
+ }
158
+ // Use default postcss config
159
+ return {
160
+ configPath: fromPackageRoot('config/postcss.config.js'),
161
+ globalStylesDir: resolve(process.cwd(), config.paths.globalStylesDir),
162
+ globalMixinsDir: resolve(process.cwd(), config.paths.globalMixinsDir),
163
+ };
164
+ }
165
+ /**
166
+ * Check if a configuration file exists in the project root.
167
+ *
168
+ * @param filename - Name of the configuration file to check
169
+ * @returns True if the file exists
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * if (hasConfigFile('postcss.config.js')) {
174
+ * console.log('Using custom PostCSS configuration');
175
+ * }
176
+ * ```
177
+ */
178
+ export function hasConfigFile(filename) {
179
+ return existsSync(fromProjectRoot(filename));
180
+ }
181
+ /**
182
+ * Get the output directory path.
183
+ *
184
+ * Returns the absolute path to the dist directory where
185
+ * compiled assets will be written.
186
+ *
187
+ * @param config - Build configuration
188
+ * @returns Absolute path to the output directory
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * const outputDir = getOutputDir(config);
193
+ * console.log(outputDir); // "/path/to/project/dist"
194
+ * ```
195
+ */
196
+ export function getOutputDir(config) {
197
+ return fromProjectRoot(config.paths.distDir);
198
+ }
199
+ /**
200
+ * Check if the build is running in production mode.
201
+ *
202
+ * Production mode is determined by `NODE_ENV=production`.
203
+ * In production mode:
204
+ * - Output is minified
205
+ * - Source maps are disabled (unless explicitly enabled)
206
+ * - Console output is optimized
207
+ *
208
+ * @returns True if NODE_ENV is "production"
209
+ *
210
+ * @example
211
+ * ```typescript
212
+ * if (isProduction()) {
213
+ * console.log('Building for production...');
214
+ * }
215
+ * ```
216
+ */
217
+ export function isProduction() {
218
+ return process.env.NODE_ENV === 'production';
219
+ }
220
+ /**
221
+ * Check if the build is running in watch mode.
222
+ *
223
+ * Watch mode is detected from command-line arguments.
224
+ *
225
+ * @returns True if --watch flag is present or command is "start"
226
+ */
227
+ export function isWatchMode() {
228
+ return process.argv.includes('--watch') || process.argv.includes('start');
229
+ }
230
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGpE;;;;;GAKG;AACH,MAAM,YAAY,GAAgB;IACjC,SAAS,EAAE,oBAAoB;IAC/B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,WAAW;IACnB,aAAa,EAAE,WAAW;IAC1B,YAAY,EAAE,sBAAsB;IACpC,eAAe,EAAE,uBAAuB;IACxC,eAAe,EAAE,sBAAsB;CACvC,CAAC;AAEF;;;;GAIG;AACH,MA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AM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY;IAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW;IAC1B,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 10up-build - esbuild-powered WordPress build tool
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export { build } from './build.js';
7
+ export { watch } from './watch.js';
8
+ export { cli } from './cli.js';
9
+ export { loadConfig, defaultConfig, isProduction, isWatchMode } from './config.js';
10
+ export type { BuildConfig, PathsConfig, FilenamesConfig, ExternalNamespaceConfig, PostCSSConfig, DetectedEntries, BuildResult, WatchOptions, BlockMetadata, DependencyInfo, } from './types.js';
11
+ export { detectEntries, getBlockSpecificStyles } from './utils/entry-detection.js';
12
+ export { resolveExternal, isWpScriptPackage, wpPackageToHandle, wpPackageToGlobal, vendorExternals, } from './utils/externals.js';
13
+ export { fromProjectRoot, fromPackageRoot, hasProjectFile, fileExists, getContentHash, getFileContentHash, normalizePath, } from './utils/paths.js';
14
+ export { wpDependencyExtractionPlugin } from './plugins/wp-dependency-extraction.js';
15
+ export { sassPlugin } from './plugins/sass-plugin.js';
16
+ export { transformBlockJson, processBlockJsonFiles } from './plugins/block-json.js';
17
+ export { copyStaticAssets } from './plugins/copy-assets.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGnF,YAAY,EACX,WAAW,EACX,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,eAAe,EACf,eAAe,EACf,cAAc,EACd,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,GACb,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 10up-build - esbuild-powered WordPress build tool
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ // Main exports
7
+ export { build } from './build.js';
8
+ export { watch } from './watch.js';
9
+ export { cli } from './cli.js';
10
+ export { loadConfig, defaultConfig, isProduction, isWatchMode } from './config.js';
11
+ // Utility exports
12
+ export { detectEntries, getBlockSpecificStyles } from './utils/entry-detection.js';
13
+ export { resolveExternal, isWpScriptPackage, wpPackageToHandle, wpPackageToGlobal, vendorExternals, } from './utils/externals.js';
14
+ export { fromProjectRoot, fromPackageRoot, hasProjectFile, fileExists, getContentHash, getFileContentHash, normalizePath, } from './utils/paths.js';
15
+ // Plugin exports
16
+ export { wpDependencyExtractionPlugin } from './plugins/wp-dependency-extraction.js';
17
+ export { sassPlugin } from './plugins/sass-plugin.js';
18
+ export { transformBlockJson, processBlockJsonFiles } from './plugins/block-json.js';
19
+ export { copyStaticAssets } from './plugins/copy-assets.js';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAe;AACf,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgBnF,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,eAAe,EACf,eAAe,EACf,cAAc,EACd,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,GACb,MAAM,kBAAkB,CAAC;AAE1B,iBAAiB;AACjB,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Block JSON Plugin for esbuild
3
+ *
4
+ * Transforms and copies block.json files to the output directory.
5
+ * - Converts .ts/.tsx references to .js
6
+ * - Converts .scss/.sass references to .css
7
+ * - Adds version hash for cache busting
8
+ */
9
+ import type { BuildConfig } from '../types.js';
10
+ /**
11
+ * Transform block.json content
12
+ */
13
+ export declare function transformBlockJson(content: string, absoluteFilename: string): string;
14
+ /**
15
+ * Copy and transform all block.json files to output directory
16
+ */
17
+ export declare function processBlockJsonFiles(config: BuildConfig, outputDir: string): Promise<void>;
18
+ //# sourceMappingURL=block-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-json.d.ts","sourceRoot":"","sources":["../../src/plugins/block-json.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAC;AAkG9D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAgDpF;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCjG"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Block JSON Plugin for esbuild
3
+ *
4
+ * Transforms and copies block.json files to the output directory.
5
+ * - Converts .ts/.tsx references to .js
6
+ * - Converts .scss/.sass references to .css
7
+ * - Adds version hash for cache busting
8
+ */
9
+ import { readFileSync, writeFileSync, mkdirSync, copyFileSync, existsSync } from 'node:fs';
10
+ import { dirname, join, resolve } from 'node:path';
11
+ import fastGlob from 'fast-glob';
12
+ const glob = fastGlob.sync;
13
+ import { normalizePath, getFileContentHash } from '../utils/paths.js';
14
+ /**
15
+ * Asset keys for standard JavaScript files (IIFE format)
16
+ */
17
+ const JS_ASSET_KEYS = [
18
+ 'script',
19
+ 'editorScript',
20
+ 'viewScript',
21
+ ];
22
+ /**
23
+ * Asset keys for ES module files (.mjs)
24
+ */
25
+ const MODULE_ASSET_KEYS = ['scriptModule', 'viewScriptModule'];
26
+ /**
27
+ * Asset keys for CSS files
28
+ */
29
+ const CSS_ASSET_KEYS = ['style', 'editorStyle', 'viewStyle'];
30
+ /**
31
+ * Transform TypeScript asset paths to JavaScript (.js)
32
+ */
33
+ function transformTSAsset(asset) {
34
+ const transform = (filePath) => {
35
+ if (!filePath.startsWith('file:')) {
36
+ return filePath;
37
+ }
38
+ return filePath.replace(/\.tsx?$/, '.js').replace(/\.js$/, '.js');
39
+ };
40
+ return Array.isArray(asset) ? asset.map(transform) : transform(asset);
41
+ }
42
+ /**
43
+ * Transform TypeScript/JS asset paths to ES modules (.mjs)
44
+ */
45
+ function transformModuleAsset(asset) {
46
+ const transform = (filePath) => {
47
+ if (!filePath.startsWith('file:')) {
48
+ return filePath;
49
+ }
50
+ // Convert .ts/.tsx/.js to .mjs
51
+ return filePath.replace(/\.(tsx?|js)$/, '.mjs');
52
+ };
53
+ return Array.isArray(asset) ? asset.map(transform) : transform(asset);
54
+ }
55
+ /**
56
+ * Transform SASS/SCSS asset paths to CSS
57
+ */
58
+ function transformSassAsset(asset) {
59
+ const transform = (filePath) => {
60
+ if (!filePath.startsWith('file:')) {
61
+ return filePath;
62
+ }
63
+ return filePath.replace(/\.s[ac]ss$/, '.css');
64
+ };
65
+ return Array.isArray(asset) ? asset.map(transform) : transform(asset);
66
+ }
67
+ /**
68
+ * Calculate version hash from style files
69
+ */
70
+ function calculateStyleVersion(metadata, blockDir) {
71
+ const styleArrays = [];
72
+ if (metadata.style)
73
+ styleArrays.push(metadata.style);
74
+ if (metadata.viewStyle)
75
+ styleArrays.push(metadata.viewStyle);
76
+ let combinedHash = '';
77
+ for (const styleField of styleArrays) {
78
+ const styles = Array.isArray(styleField) ? styleField : [styleField];
79
+ for (const rawStylePath of styles) {
80
+ if (!rawStylePath.startsWith('file:')) {
81
+ continue;
82
+ }
83
+ const stylePath = rawStylePath.replace('file:', '');
84
+ const absoluteStylePath = join(blockDir, stylePath);
85
+ if (existsSync(absoluteStylePath)) {
86
+ combinedHash += getFileContentHash(absoluteStylePath);
87
+ }
88
+ }
89
+ }
90
+ return combinedHash ? combinedHash.slice(0, 8) : '';
91
+ }
92
+ /**
93
+ * Transform block.json content
94
+ */
95
+ export function transformBlockJson(content, absoluteFilename) {
96
+ if (!content || content.trim() === '') {
97
+ return content;
98
+ }
99
+ try {
100
+ const metadata = JSON.parse(content);
101
+ const blockDir = dirname(absoluteFilename);
102
+ const newMetadata = { ...metadata };
103
+ // Add version hash if not present and has file: style references
104
+ if (!metadata.version) {
105
+ const versionHash = calculateStyleVersion(metadata, blockDir);
106
+ if (versionHash) {
107
+ newMetadata.version = versionHash;
108
+ }
109
+ }
110
+ // Transform standard JS asset paths
111
+ for (const key of JS_ASSET_KEYS) {
112
+ const asset = metadata[key];
113
+ if (asset) {
114
+ newMetadata[key] = transformTSAsset(asset);
115
+ }
116
+ }
117
+ // Transform ES module asset paths (.mjs)
118
+ for (const key of MODULE_ASSET_KEYS) {
119
+ const asset = metadata[key];
120
+ if (asset) {
121
+ newMetadata[key] = transformModuleAsset(asset);
122
+ }
123
+ }
124
+ // Transform CSS asset paths
125
+ for (const key of CSS_ASSET_KEYS) {
126
+ const asset = metadata[key];
127
+ if (asset) {
128
+ newMetadata[key] = transformSassAsset(asset);
129
+ }
130
+ }
131
+ return JSON.stringify(newMetadata, null, '\t');
132
+ }
133
+ catch {
134
+ // Return original content if parsing fails
135
+ return content;
136
+ }
137
+ }
138
+ /**
139
+ * Copy and transform all block.json files to output directory
140
+ */
141
+ export async function processBlockJsonFiles(config, outputDir) {
142
+ const blocksDir = resolve(process.cwd(), config.paths.blocksDir);
143
+ if (!existsSync(blocksDir)) {
144
+ return;
145
+ }
146
+ // Find all block.json files
147
+ const blockJsonFiles = glob(normalizePath(`${blocksDir}/**/block.json`), {
148
+ absolute: true,
149
+ });
150
+ for (const blockJsonPath of blockJsonFiles) {
151
+ // Calculate relative path from blocks directory
152
+ const relativePath = blockJsonPath.replace(blocksDir, '').replace(/^[/\\]/, '');
153
+ const outputPath = join(outputDir, 'blocks', relativePath);
154
+ // Ensure output directory exists
155
+ mkdirSync(dirname(outputPath), { recursive: true });
156
+ // Read, transform, and write
157
+ const content = readFileSync(blockJsonPath, 'utf8');
158
+ const transformed = transformBlockJson(content, blockJsonPath);
159
+ writeFileSync(outputPath, transformed, 'utf8');
160
+ }
161
+ // Also copy any PHP files from blocks directory
162
+ const phpFiles = glob(normalizePath(`${blocksDir}/**/*.php`), {
163
+ absolute: true,
164
+ });
165
+ for (const phpPath of phpFiles) {
166
+ const relativePath = phpPath.replace(blocksDir, '').replace(/^[/\\]/, '');
167
+ const outputPath = join(outputDir, 'blocks', relativePath);
168
+ mkdirSync(dirname(outputPath), { recursive: true });
169
+ copyFileSync(phpPath, outputPath);
170
+ }
171
+ }
172
+ //# sourceMappingURL=block-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-json.js","sourceRoot":"","sources":["../../src/plugins/block-json.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGtE;;GAEG;AACH,MAAM,aAAa,GAA4B;IAC9C,QAAQ;IACR,cAAc;IACd,YAAY;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,iBAAiB,GAA4B,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;AAExF;;GAEG;AACH,MAAM,cAAc,GAA4B,CAAC,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;AAEtF;;GAEG;AACH,SAAS,gBAAgB,CAAC,KAAwB;IACjD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AAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,SAAS,WAAW,CAAC,EAAE;QAC7D,QAAQ,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QAE3D,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;AACF,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copy Assets Plugin
3
+ *
4
+ * Copies static assets (images, fonts, etc.) to the output directory.
5
+ */
6
+ import type { BuildConfig } from '../types.js';
7
+ /**
8
+ * Copy static assets to output directory
9
+ */
10
+ export declare function copyStaticAssets(config: BuildConfig, outputDir: string): Promise<number>;
11
+ /**
12
+ * Check if a file is a static asset
13
+ */
14
+ export declare function isAssetFile(filePath: string): boolean;
15
+ //# sourceMappingURL=copy-assets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-assets.d.ts","sourceRoot":"","sources":["../../src/plugins/copy-assets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAqB/C;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA6B9F;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGrD"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Copy Assets Plugin
3
+ *
4
+ * Copies static assets (images, fonts, etc.) to the output directory.
5
+ */
6
+ import { copyFileSync, mkdirSync, existsSync } from 'node:fs';
7
+ import { dirname, join, resolve } from 'node:path';
8
+ import fastGlob from 'fast-glob';
9
+ const glob = fastGlob.sync;
10
+ import { normalizePath } from '../utils/paths.js';
11
+ /**
12
+ * Asset file extensions to copy
13
+ */
14
+ const ASSET_EXTENSIONS = [
15
+ 'jpg',
16
+ 'jpeg',
17
+ 'png',
18
+ 'gif',
19
+ 'webp',
20
+ 'avif',
21
+ 'ico',
22
+ 'svg',
23
+ 'eot',
24
+ 'ttf',
25
+ 'woff',
26
+ 'woff2',
27
+ 'otf',
28
+ ];
29
+ /**
30
+ * Copy static assets to output directory
31
+ */
32
+ export async function copyStaticAssets(config, outputDir) {
33
+ const assetsDir = resolve(process.cwd(), config.paths.copyAssetsDir);
34
+ if (!existsSync(assetsDir)) {
35
+ return 0;
36
+ }
37
+ const pattern = `**/*.{${ASSET_EXTENSIONS.join(',')}}`;
38
+ const assetFiles = glob(normalizePath(`${assetsDir}/${pattern}`), {
39
+ absolute: true,
40
+ ignore: ['**/node_modules/**'],
41
+ });
42
+ let copiedCount = 0;
43
+ for (const assetPath of assetFiles) {
44
+ // Calculate relative path from assets directory
45
+ const relativePath = assetPath.replace(assetsDir, '').replace(/^[/\\]/, '');
46
+ const outputPath = join(outputDir, relativePath);
47
+ // Ensure output directory exists
48
+ mkdirSync(dirname(outputPath), { recursive: true });
49
+ // Copy file
50
+ copyFileSync(assetPath, outputPath);
51
+ copiedCount++;
52
+ }
53
+ return copiedCount;
54
+ }
55
+ /**
56
+ * Check if a file is a static asset
57
+ */
58
+ export function isAssetFile(filePath) {
59
+ const ext = filePath.split('.').pop()?.toLowerCase();
60
+ return ext ? ASSET_EXTENSIONS.includes(ext) : false;
61
+ }
62
+ //# sourceMappingURL=copy-assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-assets.js","sourceRoot":"","sources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AC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAEjD,iCAAiC;QACjC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEpD,YAAY;QACZ,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACpC,WAAW,EAAE,CAAC;IACf,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC3C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC;IACrD,OAAO,GAAG,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC"}
@@ -0,0 +1,17 @@
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 type { Plugin } from 'esbuild';
8
+ import type { BuildConfig } from '../types.js';
9
+ /**
10
+ * Create the SASS plugin for esbuild
11
+ */
12
+ export declare function sassPlugin(config: BuildConfig, isProduction: boolean): Plugin;
13
+ /**
14
+ * Get file extension
15
+ */
16
+ export declare function isStyleFile(filePath: string): boolean;
17
+ //# sourceMappingURL=sass-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sass-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/sass-plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,OAAO,KAAK,EAAE,MAAM,EAA4B,MAAM,SAAS,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAY/C;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,CA2E7E;AAqED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGrD"}