ember.nvp 1.7.0 → 1.8.0
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/.github/workflows/ci.yml +22 -0
- package/.release-plan.json +35 -7
- package/CHANGELOG.md +32 -0
- package/README.md +41 -28
- package/RELEASE.md +16 -14
- package/package.json +1 -1
- package/packages/build-tooling-utils/README.md +7 -12
- package/packages/build-tooling-utils/package.json +2 -2
- package/packages/build-tooling-utils/src/extensions.ts +4 -3
- package/packages/build-tooling-utils/src/maybe-babel.ts +18 -15
- package/packages/rolldown/README.md +105 -100
- package/packages/rolldown/index.ts +37 -24
- package/packages/rolldown/package.json +4 -4
- package/packages/rolldown/src/app-reexports.test.ts +4 -3
- package/packages/rolldown/src/app-reexports.ts +37 -27
- package/packages/rolldown/src/babel.test.ts +10 -5
- package/packages/rolldown/src/babel.ts +88 -69
- package/packages/rolldown/src/config.ts +21 -17
- package/packages/rolldown/src/dts.test.ts +42 -26
- package/packages/rolldown/src/externals.test.ts +16 -11
- package/packages/rolldown/src/externals.ts +18 -12
- package/packages/rolldown/src/isolated-declarations.ts +56 -43
- package/packages/rolldown/src/plugin-like.ts +18 -15
- package/packages/rolldown/src/published-types.test.ts +18 -13
- package/packages/rolldown/src/transform.test.ts +26 -17
- package/packages/rolldown/src/transform.ts +68 -48
- package/packages/vite/README.md +10 -11
- package/packages/vite/package.json +2 -2
- package/packages/vite/src/ember.ts +44 -36
- package/packages/vite/src/test-html.ts +13 -11
- package/src/bases/README.md +6 -3
- package/src/bases/minimal-app/app.test.ts +7 -4
- package/src/bases/minimal-app/files/app/app.ts +2 -3
- package/src/bases/minimal-app/files/app/router.ts +3 -3
- package/src/bases/minimal-app/index.js +10 -6
- package/src/bases/minimal-custom-element/files/README.md +16 -12
- package/src/bases/minimal-extension/files/README.md +13 -5
- package/src/bases/minimal-extension/files/app/app.ts +2 -3
- package/src/bases/minimal-extension/files/app/config.ts +5 -3
- package/src/bases/minimal-extension/index.js +16 -11
- package/src/bases/minimal-library/files/README.md +8 -7
- package/src/bases/minimal-library/index.js +21 -15
- package/src/cli/index.js +23 -18
- package/src/cli/questions/write.js +12 -10
- package/src/layers/are-the-types-wrong/index.js +4 -4
- package/src/layers/github-actions/index.js +7 -4
- package/src/layers/inspector-support/index.js +2 -2
- package/src/layers/qunit/index.js +18 -14
- package/src/layers/readme/index.js +2 -4
- package/src/layers/renovate/index.js +2 -1
- package/src/layers/typescript/index.js +12 -12
- package/src/layers/vitest/index.js +7 -3
- package/src/utils/babel.js +3 -2
- package/src/utils/buffer.js +2 -2
- package/src/utils/cli.js +4 -4
- package/src/utils/fs.js +23 -14
- package/src/utils/inspector-support.js +22 -19
- package/src/utils/npm.js +15 -12
- package/src/utils/project-type.js +19 -0
- package/src/utils/project.js +4 -13
- package/src/utils/remove-types.js +2 -4
- package/src/utils/rewrite-imports.js +43 -31
- package/src/utils/stage.js +44 -33
- package/src/utils/tsdown-config.js +6 -5
- package/src/utils/types.ts +9 -8
- package/test/ember.nvp/base-library.test.ts +6 -4
- package/test/ember.nvp/generator-replace-or-update.test.ts +6 -4
- package/test/ember.nvp/inspector-support.test.ts +4 -3
- package/test/ember.nvp/layer-inspector-support.test.ts +2 -3
- package/test/ember.nvp/layer-publish-checks.test.ts +2 -3
- package/test/ember.nvp/layer-qunit.test.ts +2 -2
- package/test/ember.nvp/layer-readme.test.ts +2 -2
- package/test/ember.nvp/layer-vitest.test.ts +16 -9
- package/test/ember.nvp/layers-load.test.ts +26 -0
- package/test/ember.nvp/library-src-fixtures.ts +7 -3
- package/test/ember.nvp/permutations/shared.ts +19 -12
- package/test/ember.nvp/publish-configs.test.ts +44 -31
- package/test/ember.nvp/rewrite-imports.test.ts +4 -3
- package/test/ember.nvp/scoped-css-library.test.ts +6 -4
- package/test/test-helpers/permutate.test.ts +3 -3
- package/test/test-helpers.ts +10 -6
package/.github/workflows/ci.yml
CHANGED
|
@@ -28,6 +28,28 @@ jobs:
|
|
|
28
28
|
- uses: wyvox/action@v1
|
|
29
29
|
- run: pnpm lint
|
|
30
30
|
|
|
31
|
+
babel_8:
|
|
32
|
+
name: "Node Tests (@babel/core 8)"
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
timeout-minutes: 15
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- uses: wyvox/action@v1
|
|
38
|
+
# The plugin packages accept Babel 7 and 8, and the lockfile resolves 7.
|
|
39
|
+
# The blueprint fixtures still need 7 (ember-cli-babel, broccoli), so the
|
|
40
|
+
# bump is scoped to the three packages that declare the wider range.
|
|
41
|
+
- run: |
|
|
42
|
+
cat >> pnpm-workspace.yaml <<'EOF'
|
|
43
|
+
|
|
44
|
+
overrides:
|
|
45
|
+
"@nullvoxpopuli/ember-build-tooling-utils>@babel/core": "^8.0.0"
|
|
46
|
+
"@nullvoxpopuli/ember-rolldown>@babel/core": "^8.0.0"
|
|
47
|
+
"@nullvoxpopuli/ember-rolldown>@babel/plugin-transform-typescript": "^8.0.0"
|
|
48
|
+
"@nullvoxpopuli/ember-vite>@babel/core": "^8.0.0"
|
|
49
|
+
EOF
|
|
50
|
+
- run: pnpm install --no-frozen-lockfile
|
|
51
|
+
- run: pnpm test:node packages/
|
|
52
|
+
|
|
31
53
|
node_tests:
|
|
32
54
|
name: "Node Tests (${{ matrix.slice.name }})"
|
|
33
55
|
runs-on: ubuntu-latest
|
package/.release-plan.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"solution": {
|
|
3
3
|
"ember.nvp": {
|
|
4
4
|
"impact": "minor",
|
|
5
|
-
"oldVersion": "1.
|
|
6
|
-
"newVersion": "1.
|
|
5
|
+
"oldVersion": "1.7.1",
|
|
6
|
+
"newVersion": "1.8.0",
|
|
7
7
|
"tagName": "latest",
|
|
8
8
|
"constraints": [
|
|
9
9
|
{
|
|
@@ -14,14 +14,28 @@
|
|
|
14
14
|
"pkgJSONPath": "./package.json"
|
|
15
15
|
},
|
|
16
16
|
"@nullvoxpopuli/ember-build-tooling-utils": {
|
|
17
|
-
"
|
|
17
|
+
"impact": "minor",
|
|
18
|
+
"oldVersion": "1.1.1",
|
|
19
|
+
"newVersion": "1.2.0",
|
|
20
|
+
"tagName": "latest",
|
|
21
|
+
"constraints": [
|
|
22
|
+
{
|
|
23
|
+
"impact": "minor",
|
|
24
|
+
"reason": "Appears in changelog section :rocket: Enhancement"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"pkgJSONPath": "./packages/build-tooling-utils/package.json"
|
|
18
28
|
},
|
|
19
29
|
"@nullvoxpopuli/ember-rolldown": {
|
|
20
30
|
"impact": "minor",
|
|
21
|
-
"oldVersion": "2.
|
|
22
|
-
"newVersion": "2.
|
|
31
|
+
"oldVersion": "2.8.1",
|
|
32
|
+
"newVersion": "2.9.0",
|
|
23
33
|
"tagName": "latest",
|
|
24
34
|
"constraints": [
|
|
35
|
+
{
|
|
36
|
+
"impact": "patch",
|
|
37
|
+
"reason": "Has dependency `workspace:*` on @nullvoxpopuli/ember-build-tooling-utils"
|
|
38
|
+
},
|
|
25
39
|
{
|
|
26
40
|
"impact": "minor",
|
|
27
41
|
"reason": "Appears in changelog section :rocket: Enhancement"
|
|
@@ -30,8 +44,22 @@
|
|
|
30
44
|
"pkgJSONPath": "./packages/rolldown/package.json"
|
|
31
45
|
},
|
|
32
46
|
"@nullvoxpopuli/ember-vite": {
|
|
33
|
-
"
|
|
47
|
+
"impact": "minor",
|
|
48
|
+
"oldVersion": "1.1.1",
|
|
49
|
+
"newVersion": "1.2.0",
|
|
50
|
+
"tagName": "latest",
|
|
51
|
+
"constraints": [
|
|
52
|
+
{
|
|
53
|
+
"impact": "patch",
|
|
54
|
+
"reason": "Has dependency `workspace:*` on @nullvoxpopuli/ember-build-tooling-utils"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"impact": "minor",
|
|
58
|
+
"reason": "Appears in changelog section :rocket: Enhancement"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"pkgJSONPath": "./packages/vite/package.json"
|
|
34
62
|
}
|
|
35
63
|
},
|
|
36
|
-
"description": "## Release (2026-09-
|
|
64
|
+
"description": "## Release (2026-09-21)\n\n* ember.nvp 1.8.0 (minor)\n* @nullvoxpopuli/ember-build-tooling-utils 1.2.0 (minor)\n* @nullvoxpopuli/ember-rolldown 2.9.0 (minor)\n* @nullvoxpopuli/ember-vite 1.2.0 (minor)\n\n#### :rocket: Enhancement\n* `ember.nvp`, `@nullvoxpopuli/ember-build-tooling-utils`, `@nullvoxpopuli/ember-rolldown`, `@nullvoxpopuli/ember-vite`\n * [#135](https://github.com/NullVoxPopuli/ember.nvp/pull/135) Accept @babel/core 8 in the plugin packages ([@NullVoxPopuli](https://github.com/NullVoxPopuli))\n\n#### Committers: 1\n- [@NullVoxPopuli](https://github.com/NullVoxPopuli)\n"
|
|
37
65
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Release (2026-09-21)
|
|
4
|
+
|
|
5
|
+
* ember.nvp 1.8.0 (minor)
|
|
6
|
+
* @nullvoxpopuli/ember-build-tooling-utils 1.2.0 (minor)
|
|
7
|
+
* @nullvoxpopuli/ember-rolldown 2.9.0 (minor)
|
|
8
|
+
* @nullvoxpopuli/ember-vite 1.2.0 (minor)
|
|
9
|
+
|
|
10
|
+
#### :rocket: Enhancement
|
|
11
|
+
* `ember.nvp`, `@nullvoxpopuli/ember-build-tooling-utils`, `@nullvoxpopuli/ember-rolldown`, `@nullvoxpopuli/ember-vite`
|
|
12
|
+
* [#135](https://github.com/NullVoxPopuli/ember.nvp/pull/135) Accept @babel/core 8 in the plugin packages ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
|
|
13
|
+
|
|
14
|
+
#### Committers: 1
|
|
15
|
+
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)
|
|
16
|
+
|
|
17
|
+
## Release (2026-09-15)
|
|
18
|
+
|
|
19
|
+
* ember.nvp 1.7.1 (patch)
|
|
20
|
+
* @nullvoxpopuli/ember-build-tooling-utils 1.1.1 (patch)
|
|
21
|
+
* @nullvoxpopuli/ember-rolldown 2.8.1 (patch)
|
|
22
|
+
* @nullvoxpopuli/ember-vite 1.1.1 (patch)
|
|
23
|
+
|
|
24
|
+
#### :bug: Bug Fix
|
|
25
|
+
* `ember.nvp`
|
|
26
|
+
* [#134](https://github.com/NullVoxPopuli/ember.nvp/pull/134) Break the import cycle that hangs the CLI on startup ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))
|
|
27
|
+
|
|
28
|
+
#### :memo: Documentation
|
|
29
|
+
* `ember.nvp`, `@nullvoxpopuli/ember-build-tooling-utils`, `@nullvoxpopuli/ember-rolldown`, `@nullvoxpopuli/ember-vite`
|
|
30
|
+
* [#132](https://github.com/NullVoxPopuli/ember.nvp/pull/132) Prose pass: reflow comments and READMEs ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))
|
|
31
|
+
|
|
32
|
+
#### Committers: 1
|
|
33
|
+
- @NullVoxPopuli's reduced-access machine account for AI usage ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))
|
|
34
|
+
|
|
3
35
|
## Release (2026-09-15)
|
|
4
36
|
|
|
5
37
|
* ember.nvp 1.7.0 (minor)
|
package/README.md
CHANGED
|
@@ -5,10 +5,14 @@ _ember project generator: a reenvisioning of blueprints -- hopefully one day to
|
|
|
5
5
|
> [!NOTE]
|
|
6
6
|
> **Why isn't this work happening in the default blueprints?** for a long time now, I've felt the old blueprint system from the very early days of ember-cli has not allowed for expressive enough layering of what people actually want out of a project generator. That said, that means there are some compromises in the CLI/generator in this repo. Throughout all files generated, whenever there is a caveat, there will be a comment in the file with the caveat, explaining status, open issues, and how we can collectively move forward. It's possible that one day ember-cli adopts or is inspired by this project, but it's too early to tell at the moment.
|
|
7
7
|
|
|
8
|
-
_I can't recommend using this tool unless
|
|
9
|
-
(And
|
|
8
|
+
_I can't recommend using this tool unless you're comfortable with the emitted caveats in the project_.
|
|
9
|
+
(And with debugging build issues.)
|
|
10
10
|
|
|
11
|
-
But I'm very excited about this tool, because it's everything I've ever wanted from a project generator.
|
|
11
|
+
But I'm very excited about this tool, because it's everything I've ever wanted from a project generator.
|
|
12
|
+
Each layer is idempotent, and knows about the other layers.
|
|
13
|
+
For example: set up a project with github-actions but without eslint.
|
|
14
|
+
When you add eslint later, your github-actions are updated as well.
|
|
15
|
+
This works in any order.
|
|
12
16
|
|
|
13
17
|
## Usage
|
|
14
18
|
|
|
@@ -32,21 +36,25 @@ npx NullVoxPopuli/ember.nvp
|
|
|
32
36
|
|
|
33
37
|
### Updating an existing project
|
|
34
38
|
|
|
35
|
-
You can run `ember.nvp` on top of an existing project to add layers to it.
|
|
39
|
+
You can run `ember.nvp` on top of an existing project to add layers to it.
|
|
40
|
+
Nothing is written to your project until you confirm. Before finishing, you choose to:
|
|
36
41
|
|
|
37
|
-
- **write the files
|
|
38
|
-
- **review the diff
|
|
39
|
-
- **cancel
|
|
42
|
+
- **write the files**: apply all of the staged changes
|
|
43
|
+
- **review the diff**: step through each changed file, and accept or reject it (or accept / reject everything remaining)
|
|
44
|
+
- **cancel**: discard everything. Your project is untouched.
|
|
40
45
|
|
|
41
|
-
Only files that actually changed are written.
|
|
46
|
+
Only files that actually changed are written.
|
|
47
|
+
`node_modules`, `.git`, and everything else in your project are left alone.
|
|
48
|
+
The accepted changes land as uncommitted edits, for you to review with your own git tooling.
|
|
42
49
|
|
|
43
|
-
New projects skip the confirmation and are written as soon as generation succeeds.
|
|
50
|
+
New projects skip the confirmation, and are written as soon as generation succeeds.
|
|
51
|
+
For scripting, `--write yes` / `--write no` answers the confirmation up front.
|
|
44
52
|
|
|
45
53
|
### Wrapping
|
|
46
54
|
|
|
47
|
-
The provided CLI is only a wrapper around
|
|
55
|
+
The provided CLI is only a wrapper around the exported `generateProject` function.
|
|
48
56
|
|
|
49
|
-
Other tools can call `generateProject` themselves
|
|
57
|
+
Other tools can call `generateProject` themselves, to provide a different terminal or graphical UI.
|
|
50
58
|
|
|
51
59
|
```js
|
|
52
60
|
import { generateProject, Project } from 'ember.nvp';
|
|
@@ -67,7 +75,9 @@ await generateProject(new Project(
|
|
|
67
75
|
|
|
68
76
|
All parts of the generator are idempotent, so running generators on existing projects _can_ no-op.
|
|
69
77
|
|
|
70
|
-
To get the same don't-write-until-confirmed behavior as the CLI, wrap generation in a `Stage`.
|
|
78
|
+
To get the same don't-write-until-confirmed behavior as the CLI, wrap generation in a `Stage`.
|
|
79
|
+
A stage is a scratch copy of the target directory (without `node_modules` and `.git`).
|
|
80
|
+
Layers run against that copy, and the target directory is untouched until you commit.
|
|
71
81
|
|
|
72
82
|
```js
|
|
73
83
|
import { generateProject, Project, Stage } from "ember.nvp";
|
|
@@ -94,8 +104,9 @@ await stage.commit(); // write the changes to the target directory
|
|
|
94
104
|
- Modern, incremental
|
|
95
105
|
- Interactive CLI
|
|
96
106
|
- choose your features
|
|
97
|
-
- The generators
|
|
98
|
-
- each feature/layer is a mini codemod that has to
|
|
107
|
+
- The generators for the different types of projects are never out of date from each other
|
|
108
|
+
- each feature/layer is a mini codemod that has to work within all the other layers.
|
|
109
|
+
eslint, for example, is always derived the same way: "app" and "library" configs can't get out of sync
|
|
99
110
|
|
|
100
111
|
Good for:
|
|
101
112
|
|
|
@@ -106,8 +117,9 @@ Good for:
|
|
|
106
117
|
|
|
107
118
|
## Layers
|
|
108
119
|
|
|
109
|
-
Each layer is a standalone module that
|
|
110
|
-
|
|
120
|
+
Each layer is a standalone module that adds a feature to your ember project.
|
|
121
|
+
Every layer is aware of the other layers.
|
|
122
|
+
For example: add github actions first, and linting later. The github actions output is updated.
|
|
111
123
|
|
|
112
124
|
### 🎯 Minimal (always included)
|
|
113
125
|
|
|
@@ -126,7 +138,8 @@ Perfect for demos, reproductions, and learning!
|
|
|
126
138
|
|
|
127
139
|
Runs `git init` for you.
|
|
128
140
|
|
|
129
|
-
|
|
141
|
+
This layer is enabled by default, _unless_ you run the generator inside a git repo already.
|
|
142
|
+
In that case, you have to opt in to git.
|
|
130
143
|
|
|
131
144
|
### GitHub Actions (optional)
|
|
132
145
|
|
|
@@ -163,17 +176,17 @@ Super experimental vitest setup using [ember-vitest](https://github.com/NullVoxP
|
|
|
163
176
|
|
|
164
177
|
### How Layers Work
|
|
165
178
|
|
|
166
|
-
1. **Discovery**: CLI scans `src/layers/` and imports each `index.js`
|
|
167
|
-
2. **Selection**:
|
|
168
|
-
3. **Execution**:
|
|
179
|
+
1. **Discovery**: the CLI scans `src/layers/` and imports each `index.js`
|
|
180
|
+
2. **Selection**: the user selects which optional layers to include
|
|
181
|
+
3. **Execution**: each layer's `run()` function is called in sequence:
|
|
169
182
|
```js
|
|
170
183
|
await layer.run(project);
|
|
171
184
|
```
|
|
172
|
-
4. **Layer Functions**:
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
185
|
+
4. **Layer Functions**: inside `run()`, layers use [`ember-apply`](https://ember-apply.pages.dev/) to apply codemods:
|
|
186
|
+
- copy files from the `files/` directory
|
|
187
|
+
- add dependencies / devDependencies to package.json
|
|
188
|
+
- add npm scripts
|
|
189
|
+
- modify package.json metadata
|
|
177
190
|
- etc
|
|
178
191
|
|
|
179
192
|
### Adding New Layers
|
|
@@ -206,7 +219,7 @@ export default {
|
|
|
206
219
|
};
|
|
207
220
|
```
|
|
208
221
|
|
|
209
|
-
2. **`files/`** directory
|
|
210
|
-
-
|
|
222
|
+
2. **`files/`** directory: template files to copy
|
|
223
|
+
- files are copied to the target directory, keeping their structure
|
|
211
224
|
|
|
212
|
-
The CLI
|
|
225
|
+
The CLI discovers the layer and offers it as an option.
|
package/RELEASE.md
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
# Release Process
|
|
2
2
|
|
|
3
|
-
Releases in this repo are mostly automated
|
|
3
|
+
Releases in this repo are mostly automated with [release-plan](https://github.com/embroider-build/release-plan/).
|
|
4
|
+
Once you label all your PRs correctly (see below), a PR is generated for you.
|
|
5
|
+
That PR updates CHANGELOG.md and `.release-plan.json`. Merging it prepares the release.
|
|
4
6
|
|
|
5
7
|
## Preparation
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Most of the release process is automated. The remaining tasks before a release are:
|
|
8
10
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
+
- label **all** pull requests merged since the last release
|
|
12
|
+
- update pull request titles so they make sense to our users
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
guiding principle
|
|
14
|
+
[keepachangelog.com](https://keepachangelog.com/en/1.1.0/) explains why this matters.
|
|
15
|
+
The guiding principle: changelogs are for humans, not machines.
|
|
14
16
|
|
|
15
|
-
When reviewing merged
|
|
17
|
+
When reviewing merged PRs, use these labels:
|
|
16
18
|
|
|
17
|
-
- breaking
|
|
18
|
-
- enhancement
|
|
19
|
-
- bug
|
|
20
|
-
- documentation
|
|
21
|
-
- internal
|
|
19
|
+
- breaking: the PR is a breaking change
|
|
20
|
+
- enhancement: the PR adds a new feature or enhancement
|
|
21
|
+
- bug: the PR fixes a bug included in a previous release
|
|
22
|
+
- documentation: the PR adds or updates documentation
|
|
23
|
+
- internal: internal changes, or anything that fits no other category
|
|
22
24
|
|
|
23
|
-
**Note:** `release-plan` requires that **all** PRs are labeled. If a PR
|
|
25
|
+
**Note:** `release-plan` requires that **all** PRs are labeled. If a PR fits no category, label it `internal`.
|
|
24
26
|
|
|
25
27
|
## Release
|
|
26
28
|
|
|
27
|
-
Once the prep work is
|
|
29
|
+
Once the prep work is done, the release itself is one step: merge the open [Plan Release](https://github.com/NullVoxPopuli/ember.nvp/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember.nvp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "ember project generator, alternative to the official blueprints, but more modern -- hopefully one day to upstream back in to ember-cli / official blueprints",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -4,29 +4,24 @@ Shared build tooling for the `@nullvoxpopuli` ember meta-plugins
|
|
|
4
4
|
([`@nullvoxpopuli/ember-vite`](../vite) and
|
|
5
5
|
[`@nullvoxpopuli/ember-rolldown`](../rolldown)).
|
|
6
6
|
|
|
7
|
-
It
|
|
8
|
-
meta-plugins can consume the same logic.
|
|
7
|
+
It has no `vite` or `rolldown` dependency, so both meta-plugins can use it.
|
|
9
8
|
|
|
10
|
-
Requires node 24
|
|
11
|
-
|
|
12
|
-
`esnext`).
|
|
9
|
+
Requires node 24+. This package ships TypeScript source, so type-checking
|
|
10
|
+
needs TypeScript 6+ with `lib` covering `es2025` (for example `esnext`).
|
|
13
11
|
|
|
14
12
|
## Exports
|
|
15
13
|
|
|
16
14
|
### `maybeBabel(options?)`
|
|
17
15
|
|
|
18
|
-
A babel plugin
|
|
19
|
-
[`@rolldown/pluginutils`](https://github.com/rolldown/rolldown) filter so babel
|
|
20
|
-
runs **only** on files that actually need it:
|
|
16
|
+
A babel plugin that runs **only** on the files that need babel:
|
|
21
17
|
|
|
22
18
|
- template-tag files (`.gts`/`.gjs`)
|
|
23
19
|
- files importing template/macro modules (`@ember/template-compiler`,
|
|
24
20
|
`@embroider/macros`, …)
|
|
25
21
|
- local (non-`node_modules`) code using decorators
|
|
26
22
|
|
|
27
|
-
Everything else
|
|
28
|
-
|
|
29
|
-
routing every module through babel.
|
|
23
|
+
Everything else uses the bundler's native (oxc) transform, which keeps the
|
|
24
|
+
build fast.
|
|
30
25
|
|
|
31
26
|
`options` extends `@rollup/plugin-babel`'s options, plus a `filter.include`
|
|
32
27
|
(`imports` / `code`) to opt additional files in.
|
|
@@ -34,4 +29,4 @@ routing every module through babel.
|
|
|
34
29
|
### `extensions`
|
|
35
30
|
|
|
36
31
|
The list of file extensions ember source can be authored in. Mirrors
|
|
37
|
-
embroider's
|
|
32
|
+
embroider's list.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nullvoxpopuli/ember-build-tooling-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Shared build tooling for @nullvoxpopuli ember meta-plugins: maybeBabel (run babel only where needed) and the ember file extensions list.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"packageManager": "pnpm@10.28.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@babel/core": "^7.28.10",
|
|
31
|
+
"@babel/core": "^7.28.10 || ^8.0.0",
|
|
32
32
|
"@rolldown/pluginutils": "^1.0.1",
|
|
33
33
|
"@rollup/plugin-babel": "^7.1.0"
|
|
34
34
|
},
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The file extensions ember source can be authored in.
|
|
3
3
|
*
|
|
4
|
-
* Mirrors embroider's canonical list, which is only exported from
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Mirrors embroider's canonical list, which is only exported from `@embroider/vite` (its `src/ember.ts`).
|
|
5
|
+
* Copied rather than depended on, so this shared tooling stays bundler-agnostic.
|
|
6
|
+
*
|
|
7
|
+
* Keep in sync.
|
|
7
8
|
*/
|
|
8
9
|
export const extensions = [
|
|
9
10
|
".mjs",
|
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* - scoped-css
|
|
6
6
|
* - template compilation optimization
|
|
7
7
|
*
|
|
8
|
-
* `maybeBabel` runs babel ONLY on the files that actually need it
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* not re-slow the build by sending every file through babel.
|
|
8
|
+
* `maybeBabel` runs babel ONLY on the files that actually need it:
|
|
9
|
+
* - template-tag files
|
|
10
|
+
* - files importing template/macro modules
|
|
11
|
+
* - local code using decorators
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Everything else skips babel, so the bundler's native (oxc) transform handles it.
|
|
14
|
+
* The whole point is to keep the fast path fast,
|
|
15
|
+
* and not re-slow the build by sending every file through babel.
|
|
16
|
+
*
|
|
17
|
+
* This is shared between the vite (app) and rolldown/tsdown (library) meta-plugins.
|
|
16
18
|
*/
|
|
17
19
|
import { and, code, id, include, not, or } from "@rolldown/pluginutils";
|
|
18
20
|
import { babel } from "@rollup/plugin-babel";
|
|
@@ -21,8 +23,10 @@ import type { RollupBabelInputPluginOptions } from "@rollup/plugin-babel";
|
|
|
21
23
|
import { extensions } from "./extensions.ts";
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
|
-
* If a file imports any of these, it needs babel
|
|
25
|
-
*
|
|
26
|
+
* If a file imports any of these, it needs babel:
|
|
27
|
+
* - templates
|
|
28
|
+
* - macros
|
|
29
|
+
* - a couple of addons that ship decorator-adjacent runtime code
|
|
26
30
|
*/
|
|
27
31
|
const babelRequiredImports = [
|
|
28
32
|
// Templates
|
|
@@ -65,20 +69,20 @@ type Options = Omit<RollupBabelInputPluginOptions, "filter"> & {
|
|
|
65
69
|
filter?: {
|
|
66
70
|
include: {
|
|
67
71
|
/**
|
|
68
|
-
* If any additional (custom) plugins are provided,
|
|
69
|
-
*
|
|
72
|
+
* If any additional (custom) plugins are provided,
|
|
73
|
+
* a pattern must be provided that detects their usage.
|
|
70
74
|
*
|
|
71
75
|
* for example, to also run babel on files that import from ember-concurrency
|
|
72
76
|
* ```js
|
|
73
77
|
* {
|
|
74
|
-
*
|
|
78
|
+
* imports: ['ember-concurrency'],
|
|
75
79
|
* }
|
|
76
80
|
* ```
|
|
77
81
|
*/
|
|
78
82
|
imports: string[];
|
|
79
83
|
/**
|
|
80
|
-
* If any additional (custom) plugins are provided,
|
|
81
|
-
*
|
|
84
|
+
* If any additional (custom) plugins are provided,
|
|
85
|
+
* a pattern must be provided that detects their usage.
|
|
82
86
|
*
|
|
83
87
|
* for example, to also run babel on files that use polyfilled APIs,
|
|
84
88
|
* or use the "formatMessage" technique for translations
|
|
@@ -121,7 +125,6 @@ export function maybeBabel(userOptions: Options = {}) {
|
|
|
121
125
|
id(/\.gjs$/),
|
|
122
126
|
// imports one of the modules above
|
|
123
127
|
code(importsRegex),
|
|
124
|
-
// (a common way to do translations)
|
|
125
128
|
// local app code using a decorator
|
|
126
129
|
// NOTE: maybeBabel requires that all libraries compile away their decorators
|
|
127
130
|
//
|