@prosopo/config 3.3.16 → 3.3.17

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.
@@ -15,6 +15,7 @@
15
15
  import fs from "node:fs";
16
16
  import os from "node:os";
17
17
  import path from "node:path";
18
+ import type { Rollup } from "vite";
18
19
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
19
20
  import { nodejsPolarsDirnamePlugin } from "./NodejsPolarsDirnamePlugin.js";
20
21
  import ViteTestConfig from "./vite.test.config.js";
@@ -22,6 +23,11 @@ import ViteThreadsTestConfig from "./vite.threads.test.config.js";
22
23
 
23
24
  const NATIVE_POLARS = "/repo/node_modules/nodejs-polars/bin/native-polars.js";
24
25
 
26
+ const resolveOptions: Rollup.ResolveIdExtraOptions = {
27
+ isEntry: false,
28
+ kind: "import-statement",
29
+ };
30
+
25
31
  let root: string;
26
32
  let cwd: string;
27
33
  let originalTestType: string | undefined;
@@ -179,10 +185,12 @@ describe("nodejsPolarsDirnamePlugin", () => {
179
185
  const plugin = nodejsPolarsDirnamePlugin();
180
186
 
181
187
  it("claims only the native polars entry point", () => {
182
- expect(plugin.resolveId(NATIVE_POLARS, undefined, {})).toBe(NATIVE_POLARS);
183
- expect(plugin.resolveId("zod", undefined, {})).toBeNull();
188
+ expect(plugin.resolveId(NATIVE_POLARS, undefined, resolveOptions)).toBe(
189
+ NATIVE_POLARS,
190
+ );
191
+ expect(plugin.resolveId("zod", undefined, resolveOptions)).toBeNull();
184
192
  expect(
185
- plugin.resolveId("nodejs-polars/bin/other.js", undefined, {}),
193
+ plugin.resolveId("nodejs-polars/bin/other.js", undefined, resolveOptions),
186
194
  ).toBeNull();
187
195
  });
188
196
 
@@ -15,6 +15,7 @@
15
15
  import fs from "node:fs";
16
16
  import os from "node:os";
17
17
  import path from "node:path";
18
+ import type { Rollup } from "vite";
18
19
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
19
20
  import { tsNoCheckPlugin } from "./TsNoCheckPlugin.js";
20
21
  import VitePluginCopy from "./vite-plugin-copy.js";
@@ -132,14 +133,25 @@ describe("VitePluginFixAbsoluteImports", () => {
132
133
  });
133
134
 
134
135
  describe("tsNoCheckPlugin", () => {
136
+ const outputOptions = {} as Rollup.NormalizedOutputOptions;
137
+
135
138
  it("prefixes every emitted chunk with a ts-nocheck pragma", () => {
136
139
  // Consumers typecheck the bundled output; without this the generated
137
140
  // code fails their build.
138
141
  const bundle = {
139
- "index.js": { type: "chunk", code: "export const a = 1;" },
140
- "other.js": { type: "chunk", code: "export const b = 2;" },
142
+ "index.js": {
143
+ type: "chunk",
144
+ code: "export const a = 1;",
145
+ } as Rollup.OutputChunk,
146
+ "other.js": {
147
+ type: "chunk",
148
+ code: "export const b = 2;",
149
+ } as Rollup.OutputChunk,
141
150
  };
142
- tsNoCheckPlugin().generateBundle({}, bundle);
151
+ tsNoCheckPlugin().generateBundle(
152
+ outputOptions,
153
+ bundle as Rollup.OutputBundle,
154
+ );
143
155
 
144
156
  expect(bundle["index.js"].code).toBe("// @ts-nocheck\nexport const a = 1;");
145
157
  expect(bundle["other.js"].code).toBe("// @ts-nocheck\nexport const b = 2;");
@@ -147,17 +159,22 @@ describe("tsNoCheckPlugin", () => {
147
159
 
148
160
  it("leaves assets and empty chunks alone", () => {
149
161
  const bundle = {
150
- "style.css": { type: "asset", source: "body{}" },
151
- "empty.js": { type: "chunk", code: "" },
162
+ "style.css": { type: "asset", source: "body{}" } as Rollup.OutputAsset,
163
+ "empty.js": { type: "chunk", code: "" } as Rollup.OutputChunk,
152
164
  };
153
- tsNoCheckPlugin().generateBundle({}, bundle);
165
+ tsNoCheckPlugin().generateBundle(
166
+ outputOptions,
167
+ bundle as Rollup.OutputBundle,
168
+ );
154
169
 
155
170
  expect(bundle["style.css"]).toEqual({ type: "asset", source: "body{}" });
156
171
  expect(bundle["empty.js"].code).toBe("");
157
172
  });
158
173
 
159
174
  it("handles an empty bundle", () => {
160
- expect(() => tsNoCheckPlugin().generateBundle({}, {})).not.toThrow();
175
+ expect(() =>
176
+ tsNoCheckPlugin().generateBundle(outputOptions, {}),
177
+ ).not.toThrow();
161
178
  });
162
179
 
163
180
  it("is named", () => {