Skip to content

Commit d2f6ff4

Browse files
t3dotggclaude
andauthored
fix(release): desktop builds pass again after the vite-plus 1.4 upgrade (pingdotgg#24867)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent a6aca34 commit d2f6ff4

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎scripts/lib/cli-external-packages.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,21 @@ var x = 1;
150150
assert.deepStrictEqual(result.inlinedPackages, ["effect", "yaml"]);
151151
assert.deepStrictEqual(result.inlined, []);
152152
});
153+
154+
it("reads the plain `// <path>` markers newer Rolldown emits", () => {
155+
const source = [
156+
"// \0rolldown/runtime.js",
157+
"var x = 1;",
158+
"// ../../node_modules/.pnpm/[email protected]/node_modules/node-addon-api/index.js",
159+
"var y = 2; // trailing comment",
160+
"// ../../src/server/main.ts",
161+
"",
162+
].join("\n");
163+
const result = findInlinedExternalPackages(source);
164+
165+
assert.strictEqual(result.regionCount, 3);
166+
assert.deepStrictEqual(result.inlined, ["node-addon-api"]);
167+
});
153168
});
154169

155170
describe("findEsmImportsOfExternalPackages", () => {

‎scripts/lib/cli-external-packages.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ export function findInlinedExternalPackages(source: string): {
6161
readonly inlined: ReadonlyArray<string>;
6262
readonly inlinedPackages: ReadonlyArray<string>;
6363
} {
64-
// Rolldown marks each inlined module with a `//#region <path>` comment.
65-
const regionPattern = /\/\/#region\s+(\S+)/g;
64+
// Rolldown marks each inlined module with a `//#region <path>` line; newer
65+
// releases (vite-plus 1.4) emit a bare `// <path>` line instead.
66+
const regionPattern = /^\/\/(?:#region)?[ \t]+(\S+)[ \t]*$/gm;
6667
const packagePattern = /node_modules\/((?:@[^/\s]+\/)?[^/\s]+)\//g;
6768

6869
let regionCount = 0;

0 commit comments

Comments
 (0)