ember.nvp 1.16.0 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -0
- package/.release-plan.json +11 -29
- package/CHANGELOG.md +32 -0
- package/package.json +1 -1
- package/packages/rolldown/package.json +2 -2
- package/packages/vite/package.json +4 -1
- package/packages/vite/src/ember.test.ts +74 -2
- package/packages/vite/src/ember.ts +26 -3
- package/src/bases/minimal-app/files/package.json +1 -1
- package/src/bases/minimal-extension/files/package.json +1 -1
- package/src/layers/qunit/index.js +30 -11
- package/src/layers/qunit/library-ts-files/config/tsconfig.publish.json +2 -1
- package/src/layers/vitest/index.js +1 -1
- package/test/ember.nvp/base-custom-element.test.ts +13 -5
- package/test/ember.nvp/base-library.test.ts +0 -6
- package/test/ember.nvp/layer-qunit.test.ts +29 -2
- package/test/ember.nvp/publish-configs.test.ts +1 -1
- package/test/ember.nvp/scoped-css-library.test.ts +3 -6
package/.github/workflows/ci.yml
CHANGED
|
@@ -46,6 +46,7 @@ jobs:
|
|
|
46
46
|
"@nullvoxpopuli/ember-rolldown>@babel/core": "^8.0.0"
|
|
47
47
|
"@nullvoxpopuli/ember-rolldown>@babel/plugin-transform-typescript": "^8.0.0"
|
|
48
48
|
"@nullvoxpopuli/ember-vite>@babel/core": "^8.0.0"
|
|
49
|
+
"@nullvoxpopuli/ember-vite>@babel/plugin-transform-typescript": "^8.0.0"
|
|
49
50
|
EOF
|
|
50
51
|
- run: pnpm install --no-frozen-lockfile
|
|
51
52
|
- run: pnpm test:node packages/
|
package/.release-plan.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"solution": {
|
|
3
3
|
"ember.nvp": {
|
|
4
|
-
"impact": "
|
|
5
|
-
"oldVersion": "1.
|
|
6
|
-
"newVersion": "1.
|
|
4
|
+
"impact": "patch",
|
|
5
|
+
"oldVersion": "1.17.0",
|
|
6
|
+
"newVersion": "1.17.1",
|
|
7
7
|
"tagName": "latest",
|
|
8
8
|
"constraints": [
|
|
9
9
|
{
|
|
10
|
-
"impact": "
|
|
11
|
-
"reason": "Appears in changelog section :
|
|
10
|
+
"impact": "patch",
|
|
11
|
+
"reason": "Appears in changelog section :bug: Bug Fix"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"impact": "patch",
|
|
15
|
-
"reason": "Appears in changelog section :
|
|
15
|
+
"reason": "Appears in changelog section :house: Internal"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"pkgJSONPath": "./package.json"
|
|
@@ -21,32 +21,14 @@
|
|
|
21
21
|
"oldVersion": "1.2.0"
|
|
22
22
|
},
|
|
23
23
|
"@nullvoxpopuli/ember-rolldown": {
|
|
24
|
-
"
|
|
25
|
-
"oldVersion": "2.10.0",
|
|
26
|
-
"newVersion": "2.11.0",
|
|
27
|
-
"tagName": "latest",
|
|
28
|
-
"constraints": [
|
|
29
|
-
{
|
|
30
|
-
"impact": "minor",
|
|
31
|
-
"reason": "Appears in changelog section :rocket: Enhancement"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"impact": "patch",
|
|
35
|
-
"reason": "Appears in changelog section :bug: Bug Fix"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
"pkgJSONPath": "./packages/rolldown/package.json"
|
|
24
|
+
"oldVersion": "2.12.0"
|
|
39
25
|
},
|
|
40
26
|
"@nullvoxpopuli/ember-vite": {
|
|
41
|
-
"impact": "
|
|
42
|
-
"oldVersion": "1.
|
|
43
|
-
"newVersion": "1.3.
|
|
27
|
+
"impact": "patch",
|
|
28
|
+
"oldVersion": "1.3.0",
|
|
29
|
+
"newVersion": "1.3.1",
|
|
44
30
|
"tagName": "latest",
|
|
45
31
|
"constraints": [
|
|
46
|
-
{
|
|
47
|
-
"impact": "minor",
|
|
48
|
-
"reason": "Appears in changelog section :rocket: Enhancement"
|
|
49
|
-
},
|
|
50
32
|
{
|
|
51
33
|
"impact": "patch",
|
|
52
34
|
"reason": "Appears in changelog section :bug: Bug Fix"
|
|
@@ -55,5 +37,5 @@
|
|
|
55
37
|
"pkgJSONPath": "./packages/vite/package.json"
|
|
56
38
|
}
|
|
57
39
|
},
|
|
58
|
-
"description": "## Release (2026-10-
|
|
40
|
+
"description": "## Release (2026-10-25)\n\n* ember.nvp 1.17.1 (patch)\n* @nullvoxpopuli/ember-vite 1.3.1 (patch)\n\n#### :bug: Bug Fix\n* `ember.nvp`, `@nullvoxpopuli/ember-vite`\n * [#169](https://github.com/NullVoxPopuli/ember.nvp/pull/169) Take the macros development mode from the vite mode ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))\n\n#### :house: Internal\n* `ember.nvp`\n * [#167](https://github.com/NullVoxPopuli/ember.nvp/pull/167) Expect rolldown 1.2.15 module comments in generated output ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))\n\n#### Committers: 1\n- @NullVoxPopuli's reduced-access machine account for AI usage ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))\n"
|
|
59
41
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Release (2026-10-25)
|
|
4
|
+
|
|
5
|
+
* ember.nvp 1.17.1 (patch)
|
|
6
|
+
* @nullvoxpopuli/ember-vite 1.3.1 (patch)
|
|
7
|
+
|
|
8
|
+
#### :bug: Bug Fix
|
|
9
|
+
* `ember.nvp`, `@nullvoxpopuli/ember-vite`
|
|
10
|
+
* [#169](https://github.com/NullVoxPopuli/ember.nvp/pull/169) Take the macros development mode from the vite mode ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))
|
|
11
|
+
|
|
12
|
+
#### :house: Internal
|
|
13
|
+
* `ember.nvp`
|
|
14
|
+
* [#167](https://github.com/NullVoxPopuli/ember.nvp/pull/167) Expect rolldown 1.2.15 module comments in generated output ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))
|
|
15
|
+
|
|
16
|
+
#### Committers: 1
|
|
17
|
+
- @NullVoxPopuli's reduced-access machine account for AI usage ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))
|
|
18
|
+
|
|
19
|
+
## Release (2026-10-16)
|
|
20
|
+
|
|
21
|
+
* ember.nvp 1.17.0 (minor)
|
|
22
|
+
* @nullvoxpopuli/ember-rolldown 2.12.0 (minor)
|
|
23
|
+
|
|
24
|
+
#### :rocket: Enhancement
|
|
25
|
+
* `@nullvoxpopuli/ember-rolldown`, `ember.nvp`
|
|
26
|
+
* [#166](https://github.com/NullVoxPopuli/ember.nvp/pull/166) Require babel-plugin-ember-template-compilation 4.0.1 ([@NullVoxPopuli-ai-agent](https://github.com/NullVoxPopuli-ai-agent))
|
|
27
|
+
|
|
28
|
+
#### :bug: Bug Fix
|
|
29
|
+
* `ember.nvp`
|
|
30
|
+
* [#164](https://github.com/NullVoxPopuli/ember.nvp/pull/164) Add vite/client types to the dev tsconfig of libraries with tests ([@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-10-12)
|
|
4
36
|
|
|
5
37
|
* ember.nvp 1.16.0 (minor)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember.nvp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.1",
|
|
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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nullvoxpopuli/ember-rolldown",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Meta plugin for building ember v2 libraries/addons with rolldown & tsdown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@embroider/core": "^4.6.9",
|
|
49
49
|
"@jridgewell/remapping": "^2.3.5",
|
|
50
50
|
"@nullvoxpopuli/ember-build-tooling-utils": "workspace:*",
|
|
51
|
-
"babel-plugin-ember-template-compilation": "^4.0.
|
|
51
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
52
52
|
"content-tag": "^4.2.0",
|
|
53
53
|
"decorator-transforms": "^2.4.0",
|
|
54
54
|
"get-tsconfig": "^4.14.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nullvoxpopuli/ember-vite",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Meta plugin for ember projects focusing on speed.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"node": ">= 24"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@babel/plugin-transform-typescript": "^7.28.10 || ^8.0.0",
|
|
39
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
40
|
+
"decorator-transforms": "^2.4.0",
|
|
38
41
|
"rolldown": "^1.1.2",
|
|
39
42
|
"typescript": "^6.0.3",
|
|
40
43
|
"vite": "^8.0.14"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { extensions } from "@embroider/vite";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import type { ConfigEnv, ConfigPluginContext, Plugin } from "vite";
|
|
4
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
4
5
|
|
|
5
6
|
import { ember } from "./ember.ts";
|
|
6
7
|
|
|
@@ -36,3 +37,74 @@ describe("ember", () => {
|
|
|
36
37
|
expect(config.optimizeDeps.rolldownOptions.resolve.extensions).toEqual(extensions);
|
|
37
38
|
});
|
|
38
39
|
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* This package has no babel config,
|
|
43
|
+
* so `ember()` uses its default babel plugins,
|
|
44
|
+
* and babel resolves them from here.
|
|
45
|
+
*/
|
|
46
|
+
const PACKAGE_ROOT = fileURLToPath(new URL("..", import.meta.url));
|
|
47
|
+
|
|
48
|
+
const DEV_CHECK = [
|
|
49
|
+
`import { isDevelopingApp, macroCondition } from "@embroider/macros";`,
|
|
50
|
+
`export const build = macroCondition(isDevelopingApp()) ? "development build" : "other build";`,
|
|
51
|
+
].join("\n");
|
|
52
|
+
|
|
53
|
+
const CONTEXT = {
|
|
54
|
+
error(error: unknown) {
|
|
55
|
+
throw error;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Runs the config hook, then the babel plugin, the way vite does.
|
|
61
|
+
*/
|
|
62
|
+
async function compile(mode: string) {
|
|
63
|
+
const plugins = ember() as Plugin[];
|
|
64
|
+
const config: any = {};
|
|
65
|
+
|
|
66
|
+
// @ts-expect-error the first entry is the config plugin
|
|
67
|
+
await plugins[0].config.call(ROLLDOWN, config, { command: "build", mode });
|
|
68
|
+
|
|
69
|
+
const babel = plugins.find((plugin) => plugin.name === "nullvoxpopuli:babel");
|
|
70
|
+
// @ts-expect-error the babel plugin has an object transform hook
|
|
71
|
+
const result = await babel.transform.handler.call(CONTEXT, DEV_CHECK, `${PACKAGE_ROOT}app.js`);
|
|
72
|
+
|
|
73
|
+
return result.code as string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
describe("default babel plugins", () => {
|
|
77
|
+
let restoreCwd: (() => void) | undefined;
|
|
78
|
+
|
|
79
|
+
afterEach(() => {
|
|
80
|
+
restoreCwd?.();
|
|
81
|
+
restoreCwd = undefined;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
function inPackageRoot() {
|
|
85
|
+
const previous = process.cwd();
|
|
86
|
+
process.chdir(PACKAGE_ROOT);
|
|
87
|
+
restoreCwd = () => process.chdir(previous);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* vite sets NODE_ENV from the mode only after the config hooks run.
|
|
92
|
+
* Under vitest, NODE_ENV is "test".
|
|
93
|
+
*/
|
|
94
|
+
it("keeps development-only code in development mode", async () => {
|
|
95
|
+
inPackageRoot();
|
|
96
|
+
|
|
97
|
+
const code = await compile("development");
|
|
98
|
+
|
|
99
|
+
expect(code).toContain("development build");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("removes development-only code in production mode", async () => {
|
|
103
|
+
inPackageRoot();
|
|
104
|
+
|
|
105
|
+
const code = await compile("production");
|
|
106
|
+
|
|
107
|
+
expect(code).not.toContain("development build");
|
|
108
|
+
expect(code).toContain("other build");
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -59,9 +59,20 @@ function absolutePath(relativePath: string) {
|
|
|
59
59
|
*
|
|
60
60
|
* The plugins are named, not imported.
|
|
61
61
|
* babel resolves them from the project, which carries them as its own dependencies.
|
|
62
|
+
*
|
|
63
|
+
* The macros take development mode from the vite mode.
|
|
64
|
+
* `buildMacros` reads NODE_ENV, but vite sets NODE_ENV
|
|
65
|
+
* only after the config hooks run.
|
|
62
66
|
*/
|
|
63
|
-
function defaultBabelPlugins() {
|
|
64
|
-
const macros = buildMacros(
|
|
67
|
+
function defaultBabelPlugins(mode: string) {
|
|
68
|
+
const macros = buildMacros({
|
|
69
|
+
configure(config) {
|
|
70
|
+
if (isDev(mode)) {
|
|
71
|
+
config.enablePackageDevelopment(process.cwd());
|
|
72
|
+
config.enableRuntimeMode();
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
});
|
|
65
76
|
|
|
66
77
|
return [
|
|
67
78
|
[
|
|
@@ -106,11 +117,15 @@ function babelOptions(nvpConfig: Config): BabelOptions {
|
|
|
106
117
|
return { configFile };
|
|
107
118
|
}
|
|
108
119
|
|
|
120
|
+
/**
|
|
121
|
+
* The config hook fills this list, once it knows the vite mode.
|
|
122
|
+
* The babel plugins keep a reference to it, so they see the filled list.
|
|
123
|
+
*/
|
|
109
124
|
return {
|
|
110
125
|
configFile: false,
|
|
111
126
|
babelrc: false,
|
|
112
127
|
babelHelpers: "inline",
|
|
113
|
-
plugins:
|
|
128
|
+
plugins: [],
|
|
114
129
|
};
|
|
115
130
|
}
|
|
116
131
|
|
|
@@ -210,6 +225,14 @@ export function ember(nvpConfig: Config = {}) {
|
|
|
210
225
|
*/
|
|
211
226
|
await emberConfig.call(this, viteConfig, env);
|
|
212
227
|
|
|
228
|
+
if ("plugins" in babel) {
|
|
229
|
+
babel.plugins.length = 0;
|
|
230
|
+
|
|
231
|
+
for (const plugin of defaultBabelPlugins(env.mode)) {
|
|
232
|
+
babel.plugins.push(plugin);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
213
236
|
viteConfig.experimental ||= {};
|
|
214
237
|
viteConfig.build ||= {};
|
|
215
238
|
viteConfig.optimizeDeps ||= {};
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@nullvoxpopuli/ember-vite": "workspace:*",
|
|
45
45
|
"@rollup/plugin-babel": "^7.1.0",
|
|
46
46
|
"babel-plugin-debug-macros": "^2.0.0",
|
|
47
|
-
"babel-plugin-ember-template-compilation": "^4.0.
|
|
47
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
48
48
|
"typescript": "^6.0.3",
|
|
49
49
|
"vite": "^8.0.14"
|
|
50
50
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@nullvoxpopuli/ember-vite": "workspace:*",
|
|
46
46
|
"@rollup/plugin-babel": "^7.1.0",
|
|
47
47
|
"babel-plugin-debug-macros": "^2.0.0",
|
|
48
|
-
"babel-plugin-ember-template-compilation": "^4.0.
|
|
48
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
49
49
|
"typescript": "^6.0.3",
|
|
50
50
|
"vite": "^8.0.14"
|
|
51
51
|
},
|
|
@@ -31,7 +31,7 @@ const libraryDeps = {
|
|
|
31
31
|
...deps,
|
|
32
32
|
"@embroider/macros": "^1.21.3",
|
|
33
33
|
"@nullvoxpopuli/ember-vite": "workspace:*",
|
|
34
|
-
"babel-plugin-ember-template-compilation": "^4.0.
|
|
34
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
35
35
|
vite: "^8.0.14",
|
|
36
36
|
};
|
|
37
37
|
const libraryTsDeps = {
|
|
@@ -223,7 +223,9 @@ async function syncTestBabelConfig(project, ts) {
|
|
|
223
223
|
* Tests live outside `src`, and editors, `lint:types`, and eslint read tsconfig.json.
|
|
224
224
|
* So in a TypeScript library, this layer:
|
|
225
225
|
* - widens tsconfig.json to `src` and `tests`, without the publish-only settings
|
|
226
|
-
* -
|
|
226
|
+
* - adds the `vite/client` types to tsconfig.json, because the tests build with Vite
|
|
227
|
+
* - moves the publish-only settings to `config/tsconfig.publish.json`, which the build uses.
|
|
228
|
+
* That file keeps the library types, without `vite/client`, because `src` does not run through Vite.
|
|
227
229
|
*
|
|
228
230
|
* @param {import('#utils/project.js').Project} project
|
|
229
231
|
*/
|
|
@@ -233,18 +235,35 @@ async function usePublishTsconfig(project) {
|
|
|
233
235
|
|
|
234
236
|
let config = await tsconfig.read(project.directory);
|
|
235
237
|
|
|
236
|
-
if (
|
|
238
|
+
if (needsWidening(config)) {
|
|
239
|
+
await tsconfig.modify((json) => {
|
|
240
|
+
json.include ||= [];
|
|
237
241
|
|
|
238
|
-
|
|
239
|
-
|
|
242
|
+
if (!json.include.includes("tests")) {
|
|
243
|
+
json.include.push("tests");
|
|
244
|
+
}
|
|
240
245
|
|
|
241
|
-
|
|
242
|
-
json.
|
|
243
|
-
}
|
|
246
|
+
delete json.compilerOptions?.rootDir;
|
|
247
|
+
delete json.compilerOptions?.isolatedDeclarations;
|
|
248
|
+
}, project.directory);
|
|
249
|
+
}
|
|
244
250
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
if (!hasViteTypes(config)) {
|
|
252
|
+
await tsconfig.modify((json) => {
|
|
253
|
+
json.compilerOptions ||= {};
|
|
254
|
+
json.compilerOptions.types ||= [];
|
|
255
|
+
json.compilerOptions.types.push(VITE_TYPES);
|
|
256
|
+
}, project.directory);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const VITE_TYPES = "vite/client";
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* @param {Record<string, any>} config
|
|
264
|
+
*/
|
|
265
|
+
function hasViteTypes(config) {
|
|
266
|
+
return Boolean(config.compilerOptions?.types?.includes(VITE_TYPES));
|
|
248
267
|
}
|
|
249
268
|
|
|
250
269
|
/**
|
|
@@ -23,7 +23,7 @@ const deps = {
|
|
|
23
23
|
const libraryDeps = {
|
|
24
24
|
"@babel/plugin-transform-typescript": "^7.28.10",
|
|
25
25
|
"@nullvoxpopuli/ember-vite": "workspace:*",
|
|
26
|
-
"babel-plugin-ember-template-compilation": "^4.0.
|
|
26
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
27
27
|
vite: "^8.0.14",
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -50,10 +50,10 @@ async function listDist(project: Project) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* The bundled chunk's own imports are hoisted
|
|
53
|
+
* The bundled chunk's own imports are hoisted to its first lines.
|
|
54
54
|
*
|
|
55
|
-
* ember-source's doc comments
|
|
56
|
-
* so only
|
|
55
|
+
* ember-source's doc comments further down also start lines with `import`,
|
|
56
|
+
* so only the leading import lines count.
|
|
57
57
|
*/
|
|
58
58
|
async function chunkImports(project: Project) {
|
|
59
59
|
let files = await listFiles(join(project.directory, "dist"));
|
|
@@ -62,9 +62,17 @@ async function chunkImports(project: Project) {
|
|
|
62
62
|
expect(chunk).toBeDefined();
|
|
63
63
|
|
|
64
64
|
let code = (await project.read(`dist/${chunk}`)) ?? "";
|
|
65
|
-
let
|
|
65
|
+
let imports: string[] = [];
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
for (let line of code.split("\n")) {
|
|
68
|
+
if (line.startsWith("import ")) {
|
|
69
|
+
imports.push(line);
|
|
70
|
+
} else if (line.trim() !== "") {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return imports;
|
|
68
76
|
}
|
|
69
77
|
|
|
70
78
|
/**
|
|
@@ -179,7 +179,6 @@ describe("base: minimal-library", () => {
|
|
|
179
179
|
expect(declarations).toMatchInlineSnapshot(`
|
|
180
180
|
"import { TOC } from "@ember/component/template-only";
|
|
181
181
|
import Component from "@glimmer/component";
|
|
182
|
-
//#region src/components/badge.d.ts
|
|
183
182
|
interface BadgeSignature {
|
|
184
183
|
Element: HTMLSpanElement;
|
|
185
184
|
Blocks: {
|
|
@@ -187,8 +186,6 @@ describe("base: minimal-library", () => {
|
|
|
187
186
|
};
|
|
188
187
|
}
|
|
189
188
|
declare const Badge: TOC<BadgeSignature>;
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/components/greeting.d.ts
|
|
192
189
|
interface GreetingSignature {
|
|
193
190
|
Element: HTMLParagraphElement;
|
|
194
191
|
Args: {
|
|
@@ -196,10 +193,7 @@ describe("base: minimal-library", () => {
|
|
|
196
193
|
};
|
|
197
194
|
}
|
|
198
195
|
declare class Greeting extends Component<GreetingSignature> {}
|
|
199
|
-
//#endregion
|
|
200
|
-
//#region src/utils/math.d.ts
|
|
201
196
|
declare function add(a: number, b: number): number;
|
|
202
|
-
//#endregion
|
|
203
197
|
export { Badge, type BadgeSignature, Greeting, type GreetingSignature, add };
|
|
204
198
|
//# sourceMappingURL=index.d.ts.map"
|
|
205
199
|
`);
|
|
@@ -5,6 +5,7 @@ import { execa } from "execa";
|
|
|
5
5
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
|
|
8
|
+
import { generateProject } from "ember.nvp";
|
|
8
9
|
import type { Project } from "ember.nvp";
|
|
9
10
|
|
|
10
11
|
async function installAndTest(project: Project) {
|
|
@@ -271,7 +272,8 @@ describe("layer: qunit", () => {
|
|
|
271
272
|
"include": ["../src"],
|
|
272
273
|
"compilerOptions": {
|
|
273
274
|
"rootDir": "../src",
|
|
274
|
-
"isolatedDeclarations": true
|
|
275
|
+
"isolatedDeclarations": true,
|
|
276
|
+
"types": ["ember-source/types", "@glint/ember-tsc/types"]
|
|
275
277
|
}
|
|
276
278
|
}
|
|
277
279
|
"
|
|
@@ -282,7 +284,7 @@ describe("layer: qunit", () => {
|
|
|
282
284
|
"include": ["src", "tests"],
|
|
283
285
|
"compilerOptions": {
|
|
284
286
|
"lib": ["esnext", "dom", "dom.iterable"],
|
|
285
|
-
"types": ["ember-source/types", "@glint/ember-tsc/types"],
|
|
287
|
+
"types": ["ember-source/types", "@glint/ember-tsc/types", "vite/client"],
|
|
286
288
|
},
|
|
287
289
|
"contentMappers": [
|
|
288
290
|
{
|
|
@@ -316,6 +318,31 @@ describe("layer: qunit", () => {
|
|
|
316
318
|
});
|
|
317
319
|
});
|
|
318
320
|
|
|
321
|
+
describe("library (TypeScript), updating a project from before vite/client", () => {
|
|
322
|
+
it("adds vite/client to tsconfig.json only", async () => {
|
|
323
|
+
const project = await generate({
|
|
324
|
+
type: "library",
|
|
325
|
+
name: "my-lib",
|
|
326
|
+
layers: ["qunit", "typescript"],
|
|
327
|
+
});
|
|
328
|
+
dirs.push(project.directory);
|
|
329
|
+
|
|
330
|
+
let tsconfig = await project.read("tsconfig.json");
|
|
331
|
+
expect(tsconfig).toContain(', "vite/client"');
|
|
332
|
+
await writeFile(
|
|
333
|
+
join(project.directory, "tsconfig.json"),
|
|
334
|
+
tsconfig!.replace(', "vite/client"', ""),
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
await generateProject(project, "update");
|
|
338
|
+
|
|
339
|
+
expect(await project.read("tsconfig.json")).toContain(
|
|
340
|
+
'"types": ["ember-source/types", "@glint/ember-tsc/types", "vite/client"]',
|
|
341
|
+
);
|
|
342
|
+
expect(await project.read("config/tsconfig.publish.json")).not.toContain("vite/client");
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
|
|
319
346
|
describe("library (TypeScript) with eslint", () => {
|
|
320
347
|
it("lints the tests", { timeout: 300_000 }, async () => {
|
|
321
348
|
const project = await generate({
|
|
@@ -126,7 +126,7 @@ describe("publish configs", () => {
|
|
|
126
126
|
|
|
127
127
|
manifest.devDependencies["@babel/core"] = "^7.28.10";
|
|
128
128
|
manifest.devDependencies["@babel/plugin-transform-typescript"] = "^7.28.10";
|
|
129
|
-
manifest.devDependencies["babel-plugin-ember-template-compilation"] = "^4.0.
|
|
129
|
+
manifest.devDependencies["babel-plugin-ember-template-compilation"] = "^4.0.1";
|
|
130
130
|
|
|
131
131
|
await writeFile(
|
|
132
132
|
join(project.directory, "package.json"),
|
|
@@ -168,16 +168,13 @@ describe("library with ember-scoped-css", () => {
|
|
|
168
168
|
import { precompileTemplate } from "@ember/template-compilation";
|
|
169
169
|
import { setComponentTemplate } from "@ember/component";
|
|
170
170
|
import templateOnly from "@ember/component/template-only";
|
|
171
|
-
|
|
171
|
+
// src/components/badge.ts
|
|
172
172
|
const Badge = setComponentTemplate(precompileTemplate("<span class=\\"badge_e1025e732\\" ...attributes>{{yield}}</span>", { strictMode: true }), templateOnly());
|
|
173
|
-
|
|
174
|
-
//#region src/components/banner.ts
|
|
173
|
+
// src/components/banner.ts
|
|
175
174
|
const Banner = setComponentTemplate(precompileTemplate("\\n<div class=\\"banner_e88952290\\" ...attributes>{{yield}}</div>", { strictMode: true }), templateOnly());
|
|
176
|
-
|
|
177
|
-
//#region src/components/chip.ts
|
|
175
|
+
// src/components/chip.ts
|
|
178
176
|
const chipClass = "chip_ec34dd962";
|
|
179
177
|
const Chip = setComponentTemplate(precompileTemplate("<span class=\\"chip_ec34dd962\\" ...attributes></span>", { strictMode: true }), templateOnly());
|
|
180
|
-
//#endregion
|
|
181
178
|
export { Badge, Banner, Chip, chipClass };
|
|
182
179
|
|
|
183
180
|
//# sourceMappingURL=index.js.map"
|