@aemvite/aem-config 0.1.0 → 0.2.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/CHANGELOG.md +13 -0
- package/README.md +131 -11
- package/dist/buildClientlibs.d.ts +19 -37
- package/dist/buildClientlibs.d.ts.map +1 -1
- package/dist/buildClientlibs.js +111 -31
- package/dist/buildClientlibs.js.map +1 -1
- package/dist/cli.js +6 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/mergeDefaults.d.ts.map +1 -1
- package/dist/mergeDefaults.js +2 -0
- package/dist/mergeDefaults.js.map +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -8
- package/dist/clientlibEmitter.d.ts +0 -21
- package/dist/clientlibEmitter.d.ts.map +0 -1
- package/dist/clientlibEmitter.js +0 -26
- package/dist/clientlibEmitter.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to **@aemvite/aem-config** will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.2] - 2026-06-26
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Declare `esbuild` (range `^0.27.0 || ^0.28.0`, matching Vite 8's optional
|
|
13
|
+
peer range) as a **required** peer dependency. `esbuild` was already needed
|
|
14
|
+
at runtime — Vite uses it for TS/JS transpilation and is the default
|
|
15
|
+
`build.minify` engine — but Vite 8 demoted it to an *optional* peer, so npm
|
|
16
|
+
did not auto-install it. Re-declaring it as a required peer here means
|
|
17
|
+
`npm install @aemvite/aem-config` (npm 7+ / pnpm 8+ with `auto-install-peers`)
|
|
18
|
+
pulls `esbuild` in automatically, eliminating the
|
|
19
|
+
`Cannot find package 'esbuild'` failure during `aem-build --mode prod`.
|
|
20
|
+
|
|
8
21
|
## [0.1.0] - 2026-06-25
|
|
9
22
|
|
|
10
23
|
### Added
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ npm i -D sass
|
|
|
26
26
|
|
|
27
27
|
- **Peer dependency:** `vite` `^7 || ^8` (with Vite 8 also requires `esbuild` `^0.27.0 || ^0.28.0` — Vite declares it as an optional peer, so consumers must install it explicitly)
|
|
28
28
|
- **Engines:** Node `^20.19.0 || >=22.12.0`
|
|
29
|
-
- Depends on `@aemvite/vite-plugin-aem-clientlib`
|
|
29
|
+
- Depends on all three plugin packages — `@aemvite/vite-plugin-aem-clientlib`, `@aemvite/vite-plugin-glob`, `@aemvite/vite-plugin-aem-resources` — all installed automatically.
|
|
30
30
|
|
|
31
31
|
## What it does
|
|
32
32
|
|
|
@@ -36,10 +36,19 @@ npm i -D sass
|
|
|
36
36
|
pre-compile step.
|
|
37
37
|
- Resolves per-clientlib build options (`minify`, `sourcemap`, `target`) in
|
|
38
38
|
three layers: mode baseline → global → per-clientlib.
|
|
39
|
-
- Runs one Vite library build per entry with `inlineDynamicImports: true
|
|
40
|
-
|
|
39
|
+
- Runs one Vite library build per entry with `inlineDynamicImports: true`,
|
|
40
|
+
automatically wiring `@aemvite/vite-plugin-glob` (SCSS/CSS glob expansion)
|
|
41
|
+
and `@aemvite/vite-plugin-aem-resources` (resources copy). Descriptor-only
|
|
42
|
+
clientlibs (`entry: ''`) skip the Vite build entirely but still emit their
|
|
43
|
+
`.content.xml` / `js.txt` / `css.txt`.
|
|
44
|
+
- Names outputs after the clientlib (`<name>.js` / `<name>.css`) so the emitted
|
|
45
|
+
`js.txt` / `css.txt` are byte-identical to the AEM archetype golden reference.
|
|
46
|
+
- Accepts optional `plugins` / `vite` passthrough in the config so advanced
|
|
47
|
+
adopters never need to write a custom build script (see
|
|
48
|
+
[Plugin and Vite config passthrough](#plugin-and-vite-config-passthrough)).
|
|
41
49
|
- Ships an `aem-build` CLI you can call from `npm` scripts (so Maven's
|
|
42
|
-
`frontend-maven-plugin` stays unchanged).
|
|
50
|
+
`frontend-maven-plugin` stays unchanged). See
|
|
51
|
+
[CLI: `aem-build`](#cli-aem-build) for where the binary comes from.
|
|
43
52
|
|
|
44
53
|
## Quick start
|
|
45
54
|
|
|
@@ -92,6 +101,8 @@ Wire it into `package.json`:
|
|
|
92
101
|
| `clientlibs` | `AemClientlib[]` | — | One entry per clientlib folder. |
|
|
93
102
|
| `defaults` | `Partial<AemClientlib>` | `{}` | Per-clientlib defaults merged into every entry (per-clientlib values win). |
|
|
94
103
|
| `build` | `BuildOptions` | `{}` | Global build overrides; layered under per-clientlib `build` (see below). |
|
|
104
|
+
| `plugins` | `PluginOption \| PluginOption[]` | _(none)_ | Extra Vite plugins injected into **every** clientlib build (after the built-in glob + resources plugins). |
|
|
105
|
+
| `vite` | `UserConfig` | _(none)_ | Deep Vite config merged (via `mergeConfig`) into every clientlib build — runs after per-entry wiring and after `plugins`. |
|
|
95
106
|
|
|
96
107
|
### `AemClientlib`
|
|
97
108
|
|
|
@@ -108,6 +119,8 @@ Wire it into `package.json`:
|
|
|
108
119
|
| `cssProcessor` | `readonly string[]` | `["default:none","min:none"]` | AEM CSS processor directives. |
|
|
109
120
|
| `jsProcessor` | `readonly string[]` | `["default:none","min:none"]` | AEM JS processor directives. |
|
|
110
121
|
| `build` | `BuildOptions` | `{}` | Per-clientlib build overrides; layered over `AemConfig.build`. |
|
|
122
|
+
| `plugins` | `PluginOption \| PluginOption[]` | _(inherits global)_ | Extra Vite plugins for this clientlib only (appended after the global `plugins`). |
|
|
123
|
+
| `vite` | `UserConfig` | _(inherits global)_ | Per-clientlib deep Vite config override (merged after the global `vite`). |
|
|
111
124
|
|
|
112
125
|
Array fields (`cssProcessor`, `jsProcessor`, `dependencies`, `embed`,
|
|
113
126
|
`categories`, `resources`) are replaced wholesale rather than concatenated when
|
|
@@ -214,11 +227,10 @@ All exports from `@aemvite/aem-config`:
|
|
|
214
227
|
| Export | Signature | Effect |
|
|
215
228
|
|---|---|---|
|
|
216
229
|
| `defineAemConfig` | `(config: AemConfig) => AemConfig` | Typed identity helper for `aem.config.ts`. |
|
|
217
|
-
| `loadAemConfig` | `(path: string) => Promise<ResolvedAemConfig>` | Load a `.ts`/`.mts`/`.cts` config via Vite's bundled esbuild (`loadConfigFromFile`), or a `.js
|
|
230
|
+
| `loadAemConfig` | `(path: string) => Promise<ResolvedAemConfig>` | Load a `.ts`/`.mts`/`.cts` config via Vite's bundled esbuild (`loadConfigFromFile`), or a `.mjs`/`.js` config via dynamic `import()`. Merges defaults before returning. |
|
|
218
231
|
| `mergeDefaults` | `(config: AemConfig) => ResolvedAemConfig` | Apply package + user `defaults` to every clientlib. |
|
|
219
232
|
| `resolveBuildOptions` | `(mode: BuildMode, global?: BuildOptions, perClientlib?: BuildOptions) => ResolvedBuildOptions` | Resolve the three-layer build options for a single clientlib. Exported for tooling and tests. |
|
|
220
|
-
| `buildClientlibs` | `(options: BuildClientlibsOptions
|
|
221
|
-
| `resolveClientlibEmitter` | `() => Promise<ClientlibEmitter \| null>` | Optionally resolve the emitter from `@aemvite/vite-plugin-aem-clientlib`. Returns `null` if not installed. |
|
|
233
|
+
| `buildClientlibs` | `(options: BuildClientlibsOptions) => Promise<{ config: ResolvedAemConfig; outDir: string }>` | Fully-orchestrated build: wires glob + resources plugins, runs one Vite library build per entry, names outputs after the clientlib, calls the clientlib emitter. Descriptor-only clientlibs skip the Vite build. |
|
|
222
234
|
|
|
223
235
|
### Constants
|
|
224
236
|
|
|
@@ -231,8 +243,7 @@ All exports from `@aemvite/aem-config`:
|
|
|
231
243
|
### Types
|
|
232
244
|
|
|
233
245
|
`AemConfig`, `AemClientlib`, `BuildOptions`, `BuildMode`, `BuildClientlibsOptions`,
|
|
234
|
-
`ProcessorList`, `ResolvedAemClientlib`, `ResolvedAemConfig`,
|
|
235
|
-
`ResolvedBuildOptions`, `ClientlibEmitter`, `ClientlibEmitterInput`.
|
|
246
|
+
`ProcessorList`, `ResolvedAemClientlib`, `ResolvedAemConfig`, `ResolvedBuildOptions`.
|
|
236
247
|
|
|
237
248
|
## CLI: `aem-build`
|
|
238
249
|
|
|
@@ -243,8 +254,8 @@ Options:
|
|
|
243
254
|
--mode, -m <dev|prod|development|production> Build mode (default: production)
|
|
244
255
|
--config, -c <path> Path to aem.config.ts
|
|
245
256
|
(default: ./aem.config.ts,
|
|
246
|
-
then .mts,
|
|
247
|
-
--out-dir, -o <path>
|
|
257
|
+
then .mts, .mjs, .js)
|
|
258
|
+
--out-dir, -o <path> Staging directory
|
|
248
259
|
(default: ./dist)
|
|
249
260
|
-h, --help Show help
|
|
250
261
|
```
|
|
@@ -253,6 +264,115 @@ Both shorthand (`dev`/`prod`) and full (`development`/`production`) mode names
|
|
|
253
264
|
are accepted. The CLI exits with code `1` and prints the error stack on any
|
|
254
265
|
failure.
|
|
255
266
|
|
|
267
|
+
### Where does `aem-build` come from?
|
|
268
|
+
|
|
269
|
+
`@aemvite/aem-config/package.json` declares:
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"bin": {
|
|
274
|
+
"aem-build": "dist/cli.js"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
When you run `npm install`, npm creates a symlink
|
|
280
|
+
`node_modules/.bin/aem-build → ../aemvite/aem-config/dist/cli.js`. Scripts in
|
|
281
|
+
`package.json` are run with `node_modules/.bin` on the `PATH`, so `aem-build`
|
|
282
|
+
in an npm script just works:
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"scripts": {
|
|
287
|
+
"prod": "aem-build --mode prod --config aem.config.mjs"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
You can also call it directly with `npx aem-build ...` without installing
|
|
293
|
+
anything first.
|
|
294
|
+
|
|
295
|
+
## Plugin and Vite config passthrough
|
|
296
|
+
|
|
297
|
+
`@aemvite/aem-config` 0.2.0 added optional `plugins` and `vite` fields to
|
|
298
|
+
both `AemConfig` (global) and `AemClientlib` (per-clientlib). These let you
|
|
299
|
+
inject Vite plugins or deep config overrides without writing a custom build
|
|
300
|
+
script.
|
|
301
|
+
|
|
302
|
+
**When to use it:**
|
|
303
|
+
- Inject a framework plugin (e.g. React, Vue, Lit) for all clientlibs.
|
|
304
|
+
- Add `resolve.alias` entries so `@/` resolves to your `src/` root.
|
|
305
|
+
- Turn on `build.cssCodeSplit` for one specific clientlib.
|
|
306
|
+
- Use a custom transform plugin for a single entry.
|
|
307
|
+
|
|
308
|
+
**Resolution order** inside each Vite build:
|
|
309
|
+
|
|
310
|
+
1. Built-in `aemViteGlob()` (SCSS glob expansion — always first)
|
|
311
|
+
2. Built-in `aemResources(...)` (resources copy — when `resources` is set)
|
|
312
|
+
3. Global `config.plugins` (applied to every clientlib)
|
|
313
|
+
4. Per-clientlib `clientlib.plugins` (appended for that clientlib only)
|
|
314
|
+
5. Global `config.vite` merged via `mergeConfig`
|
|
315
|
+
6. Per-clientlib `clientlib.vite` merged via `mergeConfig`
|
|
316
|
+
|
|
317
|
+
### Global plugin example
|
|
318
|
+
|
|
319
|
+
```js
|
|
320
|
+
// aem.config.mjs
|
|
321
|
+
import { defineAemConfig } from '@aemvite/aem-config';
|
|
322
|
+
import myFrameworkPlugin from 'some-vite-plugin';
|
|
323
|
+
|
|
324
|
+
export default defineAemConfig({
|
|
325
|
+
clientLibRoot: '../ui.apps/.../clientlibs',
|
|
326
|
+
plugins: [myFrameworkPlugin()], // runs for every clientlib
|
|
327
|
+
clientlibs: [
|
|
328
|
+
{ name: 'site', entry: 'src/main.ts', categories: ['myproject.site'] },
|
|
329
|
+
{ name: 'admin', entry: 'src/admin.ts', categories: ['myproject.admin'] },
|
|
330
|
+
],
|
|
331
|
+
});
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Global Vite config override (e.g. aliases)
|
|
335
|
+
|
|
336
|
+
```js
|
|
337
|
+
export default defineAemConfig({
|
|
338
|
+
clientLibRoot: '../ui.apps/.../clientlibs',
|
|
339
|
+
vite: {
|
|
340
|
+
resolve: {
|
|
341
|
+
alias: { '@': '/src/main/webpack' },
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
clientlibs: [ /* … */ ],
|
|
345
|
+
});
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Per-clientlib override
|
|
349
|
+
|
|
350
|
+
```js
|
|
351
|
+
export default defineAemConfig({
|
|
352
|
+
clientLibRoot: '../ui.apps/.../clientlibs',
|
|
353
|
+
plugins: [sharedPlugin()], // injected into every clientlib
|
|
354
|
+
clientlibs: [
|
|
355
|
+
{
|
|
356
|
+
name: 'site',
|
|
357
|
+
entry: 'src/main.ts',
|
|
358
|
+
categories: ['myproject.site'],
|
|
359
|
+
// Override only for this clientlib — appended after sharedPlugin()
|
|
360
|
+
plugins: [siteOnlyPlugin()],
|
|
361
|
+
vite: { build: { cssCodeSplit: false } },
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: 'admin',
|
|
365
|
+
entry: 'src/admin.ts',
|
|
366
|
+
categories: ['myproject.admin'],
|
|
367
|
+
// no per-clientlib plugins — only sharedPlugin() runs here
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
});
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
> `plugins` and `vite` are optional. If you don't need them, omit them — the
|
|
374
|
+
> build works identically to 0.1.x with no config changes required.
|
|
375
|
+
|
|
256
376
|
## Notes & caveats
|
|
257
377
|
|
|
258
378
|
- **Per-entry isolation:** every clientlib runs as its own `vite build()` with
|
|
@@ -1,45 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { BuildClientlibsOptions, BuildMode, BuildOptions, ResolvedAemClientlib, ResolvedAemConfig } from "./types.js";
|
|
3
|
-
export interface BuildClientlibsExtraOptions {
|
|
4
|
-
/** Optional emitter override (mainly for tests). */
|
|
5
|
-
emitter?: ClientlibEmitter | null;
|
|
6
|
-
}
|
|
1
|
+
import type { BuildClientlibsOptions, ResolvedAemConfig } from "./types.js";
|
|
7
2
|
/**
|
|
8
|
-
* Build every clientlib defined by `configPath`
|
|
9
|
-
*
|
|
3
|
+
* Build every clientlib defined by `configPath` and emit byte-identical AEM
|
|
4
|
+
* clientlib folders.
|
|
10
5
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
6
|
+
* For each clientlib:
|
|
7
|
+
* - When `entry` is empty (a descriptor-only clientlib such as a shared
|
|
8
|
+
* `dependencies` umbrella) the Vite build is skipped but the descriptor is
|
|
9
|
+
* still emitted.
|
|
10
|
+
* - Otherwise one Vite library build runs into a per-clientlib staging dir
|
|
11
|
+
* (`<outDir>/clientlib-<name>/`) wiring `aemViteGlob` (SCSS/CSS glob
|
|
12
|
+
* expansion), `aemResources` (when `resources` are configured), and any
|
|
13
|
+
* author-supplied `plugins` (global then per-clientlib). Output files are
|
|
14
|
+
* named after the clientlib (`<name>.js` / `<name>.css`) so `js.txt` /
|
|
15
|
+
* `css.txt` stay byte-identical to the AEM archetype.
|
|
13
16
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
17
|
+
* The emitter then writes `.content.xml`, `js.txt`, `css.txt` and the
|
|
18
|
+
* `js/`/`css/`/`resources/` layout into `config.clientLibRoot`.
|
|
19
|
+
*
|
|
20
|
+
* Dev mode: no minify + inline sourcemap. Prod mode: esbuild minify (JS + CSS)
|
|
21
|
+
* + no sourcemap. Exact behaviour comes from `resolveBuildOptions`.
|
|
16
22
|
*/
|
|
17
|
-
export declare function buildClientlibs(options: BuildClientlibsOptions
|
|
23
|
+
export declare function buildClientlibs(options: BuildClientlibsOptions): Promise<{
|
|
18
24
|
config: ResolvedAemConfig;
|
|
19
25
|
outDir: string;
|
|
20
26
|
}>;
|
|
21
|
-
export declare function buildOptionsFor(clientlib: ResolvedAemClientlib, configDir: string, outDir: string, mode: BuildMode, isFirst: boolean, globalBuild?: BuildOptions): {
|
|
22
|
-
configFile: false;
|
|
23
|
-
mode: BuildMode;
|
|
24
|
-
logLevel: "warn";
|
|
25
|
-
build: {
|
|
26
|
-
outDir: string;
|
|
27
|
-
emptyOutDir: boolean;
|
|
28
|
-
minify: "esbuild" | false;
|
|
29
|
-
cssMinify: "esbuild" | false;
|
|
30
|
-
sourcemap: boolean | "inline" | "hidden";
|
|
31
|
-
target: string | string[];
|
|
32
|
-
lib: {
|
|
33
|
-
entry: string;
|
|
34
|
-
formats: ("es")[];
|
|
35
|
-
fileName: () => string;
|
|
36
|
-
};
|
|
37
|
-
rollupOptions: {
|
|
38
|
-
output: {
|
|
39
|
-
inlineDynamicImports: boolean;
|
|
40
|
-
assetFileNames: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
27
|
//# sourceMappingURL=buildClientlibs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildClientlibs.d.ts","sourceRoot":"","sources":["../src/buildClientlibs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildClientlibs.d.ts","sourceRoot":"","sources":["../src/buildClientlibs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,sBAAsB,EAEtB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAOpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA0CxD"}
|
package/dist/buildClientlibs.js
CHANGED
|
@@ -1,67 +1,147 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { readdir, rm } from "node:fs/promises";
|
|
2
3
|
import { loadAemConfig } from "./loadAemConfig.js";
|
|
3
|
-
import { resolveClientlibEmitter, } from "./clientlibEmitter.js";
|
|
4
4
|
import { resolveBuildOptions } from "./resolveBuildOptions.js";
|
|
5
5
|
/**
|
|
6
|
-
* Build every clientlib defined by `configPath`
|
|
7
|
-
*
|
|
6
|
+
* Build every clientlib defined by `configPath` and emit byte-identical AEM
|
|
7
|
+
* clientlib folders.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* For each clientlib:
|
|
10
|
+
* - When `entry` is empty (a descriptor-only clientlib such as a shared
|
|
11
|
+
* `dependencies` umbrella) the Vite build is skipped but the descriptor is
|
|
12
|
+
* still emitted.
|
|
13
|
+
* - Otherwise one Vite library build runs into a per-clientlib staging dir
|
|
14
|
+
* (`<outDir>/clientlib-<name>/`) wiring `aemViteGlob` (SCSS/CSS glob
|
|
15
|
+
* expansion), `aemResources` (when `resources` are configured), and any
|
|
16
|
+
* author-supplied `plugins` (global then per-clientlib). Output files are
|
|
17
|
+
* named after the clientlib (`<name>.js` / `<name>.css`) so `js.txt` /
|
|
18
|
+
* `css.txt` stay byte-identical to the AEM archetype.
|
|
11
19
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
20
|
+
* The emitter then writes `.content.xml`, `js.txt`, `css.txt` and the
|
|
21
|
+
* `js/`/`css/`/`resources/` layout into `config.clientLibRoot`.
|
|
22
|
+
*
|
|
23
|
+
* Dev mode: no minify + inline sourcemap. Prod mode: esbuild minify (JS + CSS)
|
|
24
|
+
* + no sourcemap. Exact behaviour comes from `resolveBuildOptions`.
|
|
14
25
|
*/
|
|
15
26
|
export async function buildClientlibs(options) {
|
|
16
27
|
const { mode, configPath } = options;
|
|
17
28
|
const configDir = path.dirname(path.resolve(configPath));
|
|
18
29
|
const outDir = path.resolve(configDir, options.outDir ?? "dist");
|
|
19
30
|
const config = await loadAemConfig(configPath);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
const clientLibRoot = path.resolve(configDir, config.clientLibRoot);
|
|
32
|
+
const [vite, glob, resources, clientlibPkg] = await Promise.all([
|
|
33
|
+
import("vite"),
|
|
34
|
+
import("@aemvite/vite-plugin-glob"),
|
|
35
|
+
import("@aemvite/vite-plugin-aem-resources"),
|
|
36
|
+
import("@aemvite/vite-plugin-aem-clientlib"),
|
|
37
|
+
]);
|
|
38
|
+
const { build: viteBuild, mergeConfig } = vite;
|
|
39
|
+
const { aemViteGlob } = glob;
|
|
40
|
+
const { aemResources } = resources;
|
|
41
|
+
const { emitClientlib } = clientlibPkg;
|
|
42
|
+
// Wipe the shared staging root once so subsequent per-clientlib builds
|
|
43
|
+
// accumulate into it without stale files.
|
|
44
|
+
await rm(outDir, { recursive: true, force: true });
|
|
45
|
+
for (const clientlib of config.clientlibs) {
|
|
46
|
+
const stagingDir = path.join(outDir, `clientlib-${clientlib.name}`);
|
|
47
|
+
const files = [];
|
|
48
|
+
if (clientlib.entry) {
|
|
49
|
+
await viteBuild(buildInlineConfig(clientlib, config, configDir, stagingDir, mode, {
|
|
50
|
+
aemViteGlob,
|
|
51
|
+
aemResources,
|
|
52
|
+
mergeConfig,
|
|
53
|
+
}));
|
|
54
|
+
await collectStagedFiles(stagingDir, files);
|
|
55
|
+
}
|
|
56
|
+
await emitClientlib({ clientlib, outDir: clientLibRoot, files });
|
|
30
57
|
}
|
|
31
58
|
return { config, outDir };
|
|
32
59
|
}
|
|
33
|
-
|
|
60
|
+
function buildInlineConfig(clientlib, config, configDir, stagingDir, mode, { aemViteGlob, aemResources, mergeConfig }) {
|
|
34
61
|
const entry = path.resolve(configDir, clientlib.entry);
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
const resolved = resolveBuildOptions(mode, config.build, clientlib.build);
|
|
63
|
+
const resourceEntries = (clientlib.resources ?? []).map((from) => ({
|
|
64
|
+
from: path.resolve(configDir, from),
|
|
65
|
+
}));
|
|
66
|
+
let inlineConfig = {
|
|
39
67
|
configFile: false,
|
|
68
|
+
root: configDir,
|
|
40
69
|
mode,
|
|
41
70
|
logLevel: "warn",
|
|
71
|
+
plugins: [
|
|
72
|
+
aemViteGlob(),
|
|
73
|
+
...(resourceEntries.length ? [aemResources(resourceEntries)] : []),
|
|
74
|
+
...(config.plugins ?? []),
|
|
75
|
+
...(clientlib.plugins ?? []),
|
|
76
|
+
],
|
|
42
77
|
build: {
|
|
43
|
-
outDir,
|
|
44
|
-
emptyOutDir:
|
|
45
|
-
minify:
|
|
46
|
-
cssMinify:
|
|
78
|
+
outDir: stagingDir,
|
|
79
|
+
emptyOutDir: true,
|
|
80
|
+
minify: resolved.minify.js ? "esbuild" : false,
|
|
81
|
+
cssMinify: resolved.minify.css ? "esbuild" : false,
|
|
47
82
|
sourcemap: resolved.sourcemap,
|
|
48
83
|
target: resolved.target,
|
|
49
84
|
lib: {
|
|
50
85
|
entry,
|
|
51
86
|
formats: ["es"],
|
|
52
|
-
fileName: () => `${
|
|
87
|
+
fileName: () => `${clientlib.name}.js`,
|
|
88
|
+
// Name the extracted CSS bundle after the clientlib so output stays
|
|
89
|
+
// byte-identical regardless of the consumer's package.json `name`
|
|
90
|
+
// (Vite 8 lib mode otherwise requires one). Yields `<name>.css`.
|
|
91
|
+
cssFileName: clientlib.name,
|
|
53
92
|
},
|
|
54
93
|
rollupOptions: {
|
|
55
94
|
output: {
|
|
56
95
|
inlineDynamicImports: true,
|
|
57
|
-
assetFileNames:
|
|
96
|
+
assetFileNames: (info) => (info.name ?? "").toLowerCase().endsWith(".css")
|
|
97
|
+
? `${clientlib.name}.css`
|
|
98
|
+
: "[name][extname]",
|
|
58
99
|
},
|
|
59
100
|
},
|
|
60
101
|
},
|
|
61
102
|
};
|
|
103
|
+
if (config.vite)
|
|
104
|
+
inlineConfig = mergeConfig(inlineConfig, config.vite);
|
|
105
|
+
if (clientlib.vite)
|
|
106
|
+
inlineConfig = mergeConfig(inlineConfig, clientlib.vite);
|
|
107
|
+
return inlineConfig;
|
|
108
|
+
}
|
|
109
|
+
/** Stage the per-entry JS/CSS plus any copied `resources/` tree. */
|
|
110
|
+
async function collectStagedFiles(stagingDir, files) {
|
|
111
|
+
for (const entry of await readdir(stagingDir, { withFileTypes: true })) {
|
|
112
|
+
if (!entry.isFile())
|
|
113
|
+
continue;
|
|
114
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
115
|
+
if (ext === ".js" || ext === ".css") {
|
|
116
|
+
files.push({
|
|
117
|
+
source: path.join(stagingDir, entry.name),
|
|
118
|
+
basename: entry.name,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const resourcesDir = path.join(stagingDir, "resources");
|
|
123
|
+
for (const rel of await walk(resourcesDir)) {
|
|
124
|
+
files.push({ source: path.join(resourcesDir, rel), basename: rel });
|
|
125
|
+
}
|
|
62
126
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
127
|
+
async function walk(dir, prefix = "") {
|
|
128
|
+
let entries;
|
|
129
|
+
try {
|
|
130
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
const out = [];
|
|
136
|
+
for (const entry of entries) {
|
|
137
|
+
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
138
|
+
if (entry.isDirectory()) {
|
|
139
|
+
out.push(...(await walk(path.join(dir, entry.name), rel)));
|
|
140
|
+
}
|
|
141
|
+
else if (entry.isFile()) {
|
|
142
|
+
out.push(rel);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
66
146
|
}
|
|
67
147
|
//# sourceMappingURL=buildClientlibs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildClientlibs.js","sourceRoot":"","sources":["../src/buildClientlibs.ts"],"names":[],"mappings":"AAAA,OAAO,IA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,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,IAAI,CAAC,GAAW,EAAE,MAAM,GAAG,EAAE;IAC1C,IAAI,OAAO,CAAC;IACZ,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5D,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1B,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -45,7 +45,12 @@ function normaliseMode(value) {
|
|
|
45
45
|
throw new Error(`Unknown --mode '${value}' (expected dev|prod)`);
|
|
46
46
|
}
|
|
47
47
|
function defaultConfigPath() {
|
|
48
|
-
const candidates = [
|
|
48
|
+
const candidates = [
|
|
49
|
+
"aem.config.ts",
|
|
50
|
+
"aem.config.mts",
|
|
51
|
+
"aem.config.mjs",
|
|
52
|
+
"aem.config.js",
|
|
53
|
+
];
|
|
49
54
|
for (const candidate of candidates) {
|
|
50
55
|
const resolved = path.resolve(process.cwd(), candidate);
|
|
51
56
|
if (existsSync(resolved))
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AASvD,MAAM,IAAI,GAAG;;;;;;2DAM8C,CAAC;AAE5D,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,KAAK,CAAC,IAAc;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QAC3B,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE;YAC3D,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE;YACtC,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE;YACzC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE;SACtD;QACD,MAAM,EAAE,IAAI;QACZ,gBAAgB,EAAE,KAAK;KACxB,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,CA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AO,aAAa,CAAC;IACrE,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,YAAY;QAAE,OAAO,YAAY,CAAC;IACpE,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,uBAAuB,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,UAAU,GAAG;QACjB,eAAe;QACf,gBAAgB;QAChB,gBAAgB;QAChB,eAAe;KAChB,CAAC;IACF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;QACxD,IAAI,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,QAAQ,CAAC;IAC5C,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { defineAemConfig } from "./defineAemConfig.js";
|
|
|
2
2
|
export { loadAemConfig } from "./loadAemConfig.js";
|
|
3
3
|
export { mergeDefaults } from "./mergeDefaults.js";
|
|
4
4
|
export { buildClientlibs } from "./buildClientlibs.js";
|
|
5
|
-
export { resolveClientlibEmitter, type ClientlibEmitter, type ClientlibEmitterInput, } from "./clientlibEmitter.js";
|
|
6
5
|
export { defaults, defaultTarget, modeBaselines } from "./defaults.js";
|
|
7
6
|
export { resolveBuildOptions } from "./resolveBuildOptions.js";
|
|
8
7
|
export type { AemClientlib, AemConfig, BuildClientlibsOptions, BuildMode, BuildOptions, ProcessorList, ResolvedAemClientlib, ResolvedAemConfig, ResolvedBuildOptions, } from "./types.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EACV,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export { defineAemConfig } from "./defineAemConfig.js";
|
|
|
2
2
|
export { loadAemConfig } from "./loadAemConfig.js";
|
|
3
3
|
export { mergeDefaults } from "./mergeDefaults.js";
|
|
4
4
|
export { buildClientlibs } from "./buildClientlibs.js";
|
|
5
|
-
export { resolveClientlibEmitter, } from "./clientlibEmitter.js";
|
|
6
5
|
export { defaults, defaultTarget, modeBaselines } from "./defaults.js";
|
|
7
6
|
export { resolveBuildOptions } from "./resolveBuildOptions.js";
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeDefaults.d.ts","sourceRoot":"","sources":["../src/mergeDefaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,SAAS,EAET,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"mergeDefaults.d.ts","sourceRoot":"","sources":["../src/mergeDefaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,SAAS,EAET,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,CAYlE"}
|
package/dist/mergeDefaults.js
CHANGED
|
@@ -16,6 +16,8 @@ export function mergeDefaults(config) {
|
|
|
16
16
|
clientLibRoot: config.clientLibRoot,
|
|
17
17
|
clientlibs,
|
|
18
18
|
...(config.build !== undefined ? { build: config.build } : {}),
|
|
19
|
+
...(config.plugins !== undefined ? { plugins: config.plugins } : {}),
|
|
20
|
+
...(config.vite !== undefined ? { vite: config.vite } : {}),
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
function resolveClientlib(clientlib, userDefaults) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeDefaults.js","sourceRoot":"","sources":["../src/mergeDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,MAAiB;IAC7C,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC3C,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CACrD,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,CAC1C,CAAC;IACF,OAAO;QACL,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,UAAU;QACV,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"mergeDefaults.js","sourceRoot":"","sources":["../src/mergeDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,MAAiB;IAC7C,MAAM,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
export type ProcessorList = readonly string[];
|
|
2
3
|
/**
|
|
3
4
|
* Author-facing build options. Each field is optional and overlays on top of
|
|
@@ -50,6 +51,17 @@ export interface AemClientlib {
|
|
|
50
51
|
jsProcessor?: ProcessorList;
|
|
51
52
|
/** Per-clientlib build overrides; layered over `AemConfig.build`. */
|
|
52
53
|
build?: BuildOptions;
|
|
54
|
+
/**
|
|
55
|
+
* Extra Vite plugins applied to this clientlib's build, after the built-in
|
|
56
|
+
* `aemViteGlob` / `aemResources` and after `AemConfig.plugins`. Lets advanced
|
|
57
|
+
* adopters inject e.g. a framework plugin without writing a build script.
|
|
58
|
+
*/
|
|
59
|
+
plugins?: PluginOption[];
|
|
60
|
+
/**
|
|
61
|
+
* Deep Vite config override merged (via Vite's `mergeConfig`) into this
|
|
62
|
+
* clientlib's generated inline config — the final escape hatch.
|
|
63
|
+
*/
|
|
64
|
+
vite?: UserConfig;
|
|
53
65
|
}
|
|
54
66
|
export interface AemConfig {
|
|
55
67
|
/** Absolute or relative path where clientlib folders are written. */
|
|
@@ -60,6 +72,13 @@ export interface AemConfig {
|
|
|
60
72
|
defaults?: Partial<AemClientlib>;
|
|
61
73
|
/** Global build options applied to every clientlib (overridden per-clientlib). */
|
|
62
74
|
build?: BuildOptions;
|
|
75
|
+
/**
|
|
76
|
+
* Extra Vite plugins applied to every clientlib build, after the built-in
|
|
77
|
+
* `aemViteGlob` / `aemResources` and before any per-clientlib `plugins`.
|
|
78
|
+
*/
|
|
79
|
+
plugins?: PluginOption[];
|
|
80
|
+
/** Deep Vite config override merged into every clientlib's inline config. */
|
|
81
|
+
vite?: UserConfig;
|
|
63
82
|
}
|
|
64
83
|
export type ResolvedAemClientlib = AemClientlib & Required<Pick<AemClientlib, "allowProxy" | "serializationFormat" | "cssProcessor" | "jsProcessor">>;
|
|
65
84
|
export interface ResolvedAemConfig {
|
|
@@ -67,6 +86,10 @@ export interface ResolvedAemConfig {
|
|
|
67
86
|
clientlibs: ResolvedAemClientlib[];
|
|
68
87
|
/** Raw global build options (resolved per-mode at build time). */
|
|
69
88
|
build?: BuildOptions;
|
|
89
|
+
/** Global extra Vite plugins (applied to every clientlib build). */
|
|
90
|
+
plugins?: PluginOption[];
|
|
91
|
+
/** Global deep Vite config override. */
|
|
92
|
+
vite?: UserConfig;
|
|
70
93
|
}
|
|
71
94
|
export type BuildMode = "development" | "production";
|
|
72
95
|
export interface BuildClientlibsOptions {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,MAAM,EAAE,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,OAAO,GAAG;QAAE,EAAE,CAAC,EAAE,OAAO,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE,CAAC;IACtC,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACzC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,kDAAkD;IAClD,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,qCAAqC;IACrC,KAAK,CAAC,EAAE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ACpE,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,wCAAwC;IACxC,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,YAAY,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemvite/aem-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Typed config helper, loader, and Vite build orchestrator for AEM clientlib packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aem",
|
|
@@ -45,10 +45,19 @@
|
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": "^20.19.0 || >=22.12.0"
|
|
47
47
|
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc -p tsconfig.json",
|
|
50
|
+
"test": "vitest run",
|
|
51
|
+
"test:watch": "vitest",
|
|
52
|
+
"prepublishOnly": "npm run build"
|
|
53
|
+
},
|
|
48
54
|
"dependencies": {
|
|
49
|
-
"@aemvite/vite-plugin-aem-clientlib": "^0.1.0"
|
|
55
|
+
"@aemvite/vite-plugin-aem-clientlib": "^0.1.0",
|
|
56
|
+
"@aemvite/vite-plugin-aem-resources": "^0.1.0",
|
|
57
|
+
"@aemvite/vite-plugin-glob": "^0.1.0"
|
|
50
58
|
},
|
|
51
59
|
"peerDependencies": {
|
|
60
|
+
"esbuild": "^0.27.0 || ^0.28.0",
|
|
52
61
|
"vite": "^7 || ^8"
|
|
53
62
|
},
|
|
54
63
|
"devDependencies": {
|
|
@@ -59,10 +68,5 @@
|
|
|
59
68
|
},
|
|
60
69
|
"publishConfig": {
|
|
61
70
|
"access": "public"
|
|
62
|
-
},
|
|
63
|
-
"scripts": {
|
|
64
|
-
"build": "tsc -p tsconfig.json",
|
|
65
|
-
"test": "vitest run",
|
|
66
|
-
"test:watch": "vitest"
|
|
67
71
|
}
|
|
68
|
-
}
|
|
72
|
+
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ResolvedAemConfig } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Structural contract the build orchestrator expects from any clientlib
|
|
4
|
-
* emitter (implemented by `@aemvite/vite-plugin-aem-clientlib`). Kept here so
|
|
5
|
-
* `@aemvite/aem-config` doesn't hard-depend on its sibling package during
|
|
6
|
-
* parallel wave-2 development.
|
|
7
|
-
*/
|
|
8
|
-
export interface ClientlibEmitterInput {
|
|
9
|
-
config: ResolvedAemConfig;
|
|
10
|
-
outDir: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ClientlibEmitter {
|
|
13
|
-
emit(input: ClientlibEmitterInput): Promise<void> | void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Try to resolve the emitter from `@aemvite/vite-plugin-aem-clientlib`.
|
|
17
|
-
* Returns `null` when the sibling package isn't installed yet so the
|
|
18
|
-
* orchestrator can run (e.g. inside this package's own unit tests).
|
|
19
|
-
*/
|
|
20
|
-
export declare function resolveClientlibEmitter(): Promise<ClientlibEmitter | null>;
|
|
21
|
-
//# sourceMappingURL=clientlibEmitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientlibEmitter.d.ts","sourceRoot":"","sources":["../src/clientlibEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1D;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAuBhF"}
|
package/dist/clientlibEmitter.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Try to resolve the emitter from `@aemvite/vite-plugin-aem-clientlib`.
|
|
3
|
-
* Returns `null` when the sibling package isn't installed yet so the
|
|
4
|
-
* orchestrator can run (e.g. inside this package's own unit tests).
|
|
5
|
-
*/
|
|
6
|
-
export async function resolveClientlibEmitter() {
|
|
7
|
-
try {
|
|
8
|
-
const mod = (await import("@aemvite/vite-plugin-aem-clientlib"));
|
|
9
|
-
const fn = mod.emitClientlibs;
|
|
10
|
-
if (typeof fn === "function") {
|
|
11
|
-
return {
|
|
12
|
-
emit: (input) => fn(input),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const factory = mod.createClientlibEmitter;
|
|
16
|
-
if (typeof factory === "function") {
|
|
17
|
-
const instance = factory();
|
|
18
|
-
return await instance;
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=clientlibEmitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientlibEmitter.js","sourceRoot":"","sources":["../src/clientlibEmitter.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CACvB,oCAAoC,CACrC,CAA4B,CAAC;QAC9B,MAAM,EAAE,GAAG,GAAG,CAAC,cAAc,CAAC;QAC9B,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO;gBACL,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CACb,EAAyD,CAAC,KAAK,CAAC;aACpE,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,CAAC,sBAAsB,CAAC;QAC3C,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,MAAM,QAAQ,GACZ,OACD,EAAE,CAAC;YACJ,OAAO,MAAM,QAAQ,CAAC;QACxB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|