Skip to content

Commit 3fe1134

Browse files
[dev-helpers] validate publishing and private asset bundling
1 parent 6ea3c32 commit 3fe1134

8 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎packages/deploy-helpers/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"@cloudflare/config": "workspace:*",
5050
"@cloudflare/containers-shared": "workspace:*",
5151
"@cloudflare/workers-utils": "workspace:*",
52-
"blake3-wasm": "2.1.5",
5352
"chalk": "catalog:default",
5453
"command-exists": "catalog:default",
5554
"devtools-protocol": "0.0.1182435",

‎packages/deploy-helpers/scripts/deps.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const EXTERNAL_DEPENDENCIES = [
1616

1717
// These are externalized to avoid duplication in wrangler's bundle,
1818
// which already bundles these packages itself.
19-
"blake3-wasm",
2019
"chalk",
2120
"command-exists",
2221
"dotenv",

‎packages/deploy-helpers/tsup.config.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export default defineConfig(() => [
3939
noExternal: [/^@cloudflare\/(workers|pages)-shared(\/.*)?$/],
4040
external: [
4141
/^@cloudflare\//,
42-
"blake3-wasm",
4342
"miniflare",
4443
"p-queue",
4544
"pretty-bytes",

‎packages/workers-utils/tests/config-entrypoint.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
11
/* eslint-disable @typescript-eslint/no-deprecated -- Verify that deprecated compatibility exports remain usable. */
22
import assert from "node:assert";
3+
import { readFileSync, readdirSync } from "node:fs";
4+
import { join } from "node:path";
35
import { fileURLToPath } from "node:url";
46
import * as legacy from "@cloudflare/workers-utils";
57
import * as config from "@cloudflare/workers-utils/config";
68
import ts from "typescript";
79
import { expectTypeOf, test } from "vitest";
810

11+
test("published configuration bundles private asset helpers", ({ expect }) => {
12+
const distPath = fileURLToPath(new URL("../dist/", import.meta.url));
13+
const files = readdirSync(distPath, {
14+
recursive: true,
15+
encoding: "utf8",
16+
}).filter((file) => file.endsWith(".mjs"));
17+
expect(files.length).toBeGreaterThan(0);
18+
for (const file of files) {
19+
const source = readFileSync(join(distPath, file), "utf8");
20+
const imports = ts
21+
.preProcessFile(source, true, true)
22+
.importedFiles.map(({ fileName }) => fileName);
23+
expect(imports, file).not.toEqual(
24+
expect.arrayContaining([
25+
expect.stringMatching(/^@cloudflare\/workers-shared(?:\/|$)/),
26+
])
27+
);
28+
}
29+
});
30+
931
test("published config entry points share runtime values", ({ expect }) => {
1032
for (const [name, value] of Object.entries(config)) {
1133
if (

‎packages/workers-utils/tsup.config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export default defineConfig(() => [
5858
define: {
5959
"process.env.NODE_ENV": `'${"production"}'`,
6060
},
61+
// Asset configuration uses these private workspace utilities at runtime.
62+
noExternal: [/^@cloudflare\/workers-shared(\/.*)?$/],
6163
external: ["@cloudflare/*", "vitest", ...EXTERNAL_DEPENDENCIES],
6264
},
6365
]);

‎pnpm-lock.yaml‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tools/deployments/__tests__/publish-packages.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ describe("the real workspace", () => {
294294
],
295295
[
296296
"@cloudflare/deploy-helpers",
297+
"@cloudflare/dev-helpers",
297298
],
298299
]
299300
`);

‎tools/deployments/__tests__/validate-changesets.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe("findPackageNames()", () => {
3030
"@cloudflare/config",
3131
"@cloudflare/containers-shared",
3232
"@cloudflare/deploy-helpers",
33+
"@cloudflare/dev-helpers",
3334
"@cloudflare/devprod-status-bot",
3435
"@cloudflare/edge-preview-authenticated-proxy",
3536
"@cloudflare/lint-config-shared",

0 commit comments

Comments
 (0)