ember.nvp 1.3.0 → 1.5.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/.release-plan.json +8 -14
- package/CHANGELOG.md +57 -0
- package/package.json +1 -1
- package/packages/rolldown/README.md +62 -3
- package/packages/rolldown/index.ts +2 -3
- package/packages/rolldown/package.json +12 -5
- package/packages/rolldown/src/app-reexports.ts +2 -2
- package/packages/rolldown/src/babel.test.ts +125 -2
- package/packages/rolldown/src/babel.ts +52 -7
- package/packages/rolldown/src/isolated-declarations.ts +28 -3
- package/packages/rolldown/src/plugin-like.ts +23 -0
- package/packages/rolldown/src/published-types.test.ts +102 -0
- package/packages/rolldown/src/transform.test.ts +50 -2
- package/packages/rolldown/src/transform.ts +8 -1
- package/packages/rolldown/tsdown.config.ts +11 -0
- package/src/bases/minimal-app/app.test.ts +102 -1
- package/src/bases/minimal-app/files/app/app.ts +1 -1
- package/src/bases/minimal-app/files/babel.config.js +17 -1
- package/src/bases/minimal-app/files/package.json +2 -2
- package/src/bases/minimal-extension/files/app/app.ts +1 -1
- package/src/bases/minimal-extension/files/babel.config.js +17 -1
- package/src/bases/minimal-extension/files/package.json +2 -2
- package/src/bases/minimal-library/files/package.json +1 -1
- package/src/layers/qunit/index.js +0 -1
- package/src/layers/qunit/library-files/tests/test-helper.ts +1 -1
- package/src/layers/readme/index.js +16 -16
- package/src/utils/babel.js +20 -2
- package/test/ember.nvp/inspector-support.test.ts +13 -13
- package/test/ember.nvp/layer-inspector-support.test.ts +1 -1
- package/test/ember.nvp/layer-readme.test.ts +16 -16
- package/test/ember.nvp/layer-vitest.test.ts +1 -1
- package/test/ember.nvp/publish-configs.test.ts +352 -0
- package/packages/rolldown/rolldown.config.js +0 -23
- package/packages/rolldown/src/isolated-declarations.test.ts +0 -122
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { mkdir, mkdtemp, writeFile } from "node:fs/promises";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { build } from "tsdown";
|
|
5
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
6
|
-
|
|
7
|
-
import { ember } from "../index.ts";
|
|
8
|
-
|
|
9
|
-
let restoreCwd: (() => void) | undefined;
|
|
10
|
-
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
restoreCwd?.();
|
|
13
|
-
restoreCwd = undefined;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Runs a real tsdown build of a single trivial entry in a temp dir, so the
|
|
18
|
-
* isolated-declarations guard reads the tsconfig files written by the test the
|
|
19
|
-
* same way it does under the tsdown CLI. Returns the build's rejection, or
|
|
20
|
-
* `undefined` when it succeeded.
|
|
21
|
-
*/
|
|
22
|
-
async function buildFixture(
|
|
23
|
-
files: Record<string, string>,
|
|
24
|
-
tsconfig?: string | boolean,
|
|
25
|
-
): Promise<Error | undefined> {
|
|
26
|
-
const dir = await mkdtemp(path.join(tmpdir(), "ember-rolldown-isolated-declarations-"));
|
|
27
|
-
|
|
28
|
-
const withDefaults: Record<string, string> = {
|
|
29
|
-
"package.json": JSON.stringify({ name: "fixture", version: "0.0.0", type: "module" }),
|
|
30
|
-
"src/index.ts": `export const greeting: string = 'hello';`,
|
|
31
|
-
...files,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
for (const [relative, source] of Object.entries(withDefaults)) {
|
|
35
|
-
const full = path.join(dir, relative);
|
|
36
|
-
await mkdir(path.dirname(full), { recursive: true });
|
|
37
|
-
await writeFile(full, source, "utf8");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const previousCwd = process.cwd();
|
|
41
|
-
process.chdir(dir);
|
|
42
|
-
restoreCwd = () => process.chdir(previousCwd);
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
await build({
|
|
46
|
-
entry: ["./src/index.ts"],
|
|
47
|
-
config: false,
|
|
48
|
-
logLevel: "silent",
|
|
49
|
-
tsconfig,
|
|
50
|
-
plugins: [ember()],
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return undefined;
|
|
54
|
-
} catch (error) {
|
|
55
|
-
return error as Error;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const withFlag = JSON.stringify({
|
|
60
|
-
compilerOptions: { isolatedDeclarations: true, declaration: true },
|
|
61
|
-
});
|
|
62
|
-
const withoutFlag = JSON.stringify({ compilerOptions: { declaration: true } });
|
|
63
|
-
|
|
64
|
-
describe("isolated declarations guard", () => {
|
|
65
|
-
it("errors when the cwd tsconfig.json does not set the flag", async () => {
|
|
66
|
-
const error = await buildFixture({ "tsconfig.json": withoutFlag });
|
|
67
|
-
|
|
68
|
-
expect(error?.message).toContain(`must set "compilerOptions.isolatedDeclarations": true`);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("passes when the cwd tsconfig.json sets the flag", async () => {
|
|
72
|
-
expect(await buildFixture({ "tsconfig.json": withFlag })).toBeUndefined();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("checks the tsconfig the `tsconfig` option points at, not tsconfig.json", async () => {
|
|
76
|
-
// The shape a library with in-package dev code wants: a permissive
|
|
77
|
-
// tsconfig.json for editors and `tsc --noEmit` over everything, and a
|
|
78
|
-
// publish-only tsconfig -- the one the build uses -- carrying the flag.
|
|
79
|
-
const error = await buildFixture(
|
|
80
|
-
{ "tsconfig.json": withoutFlag, "tsconfig.publish.json": withFlag },
|
|
81
|
-
"./tsconfig.publish.json",
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
expect(error).toBeUndefined();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("errors when the tsconfig the `tsconfig` option points at lacks the flag", async () => {
|
|
88
|
-
const error = await buildFixture(
|
|
89
|
-
{ "tsconfig.json": withFlag, "tsconfig.publish.json": withoutFlag },
|
|
90
|
-
"./tsconfig.publish.json",
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
expect(error?.message).toContain("tsconfig.publish.json");
|
|
94
|
-
expect(error?.message).toContain(`must set "compilerOptions.isolatedDeclarations": true`);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("resolves a directory `tsconfig` option to the tsconfig.json inside it", async () => {
|
|
98
|
-
const error = await buildFixture(
|
|
99
|
-
{ "tsconfig.json": withFlag, "config/tsconfig.json": withoutFlag },
|
|
100
|
-
"./config",
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
expect(error?.message).toContain(`must set "compilerOptions.isolatedDeclarations": true`);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("skips the check when there is no tsconfig at all", async () => {
|
|
107
|
-
expect(await buildFixture({})).toBeUndefined();
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("skips the check when tsconfig is disabled", async () => {
|
|
111
|
-
expect(await buildFixture({ "tsconfig.json": withoutFlag }, false)).toBeUndefined();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it("inherits the flag through an extends chain", async () => {
|
|
115
|
-
const error = await buildFixture({
|
|
116
|
-
"tsconfig.base.json": withFlag,
|
|
117
|
-
"tsconfig.json": JSON.stringify({ extends: "./tsconfig.base.json" }),
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
expect(error).toBeUndefined();
|
|
121
|
-
});
|
|
122
|
-
});
|