rspack-plugin-cloudflare 0.1.0 → 0.2.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.
Files changed (75) hide show
  1. package/README.md +8 -5
  2. package/THIRD_PARTY_NOTICES.txt +139 -0
  3. package/dist/index.d.ts +51 -7
  4. package/dist/index.js +3591 -131
  5. package/dist/index.js.map +1 -1
  6. package/dist/workers/asset-worker/index.js +5783 -0
  7. package/dist/workers/asset-worker/index.js.map +1 -0
  8. package/dist/workers/router-worker/index.js +6245 -0
  9. package/dist/workers/router-worker/index.js.map +1 -0
  10. package/package.json +13 -11
  11. package/dist/assets.d.ts +0 -31
  12. package/dist/assets.js +0 -112
  13. package/dist/assets.js.map +0 -1
  14. package/dist/build.d.ts +0 -216
  15. package/dist/build.js +0 -140
  16. package/dist/build.js.map +0 -1
  17. package/dist/config.d.ts +0 -19
  18. package/dist/config.js +0 -103
  19. package/dist/config.js.map +0 -1
  20. package/dist/containers.d.ts +0 -30
  21. package/dist/containers.js +0 -167
  22. package/dist/containers.js.map +0 -1
  23. package/dist/dev-entry.d.ts +0 -11
  24. package/dist/dev-entry.js +0 -44
  25. package/dist/dev-entry.js.map +0 -1
  26. package/dist/dev-worker.d.ts +0 -73
  27. package/dist/dev-worker.js +0 -247
  28. package/dist/dev-worker.js.map +0 -1
  29. package/dist/dev.d.ts +0 -28
  30. package/dist/dev.js +0 -422
  31. package/dist/dev.js.map +0 -1
  32. package/dist/http.d.ts +0 -23
  33. package/dist/http.js +0 -89
  34. package/dist/http.js.map +0 -1
  35. package/dist/inspector.d.ts +0 -5
  36. package/dist/inspector.js +0 -41
  37. package/dist/inspector.js.map +0 -1
  38. package/dist/miniflare.d.ts +0 -1
  39. package/dist/miniflare.js +0 -6
  40. package/dist/miniflare.js.map +0 -1
  41. package/dist/module-rules.d.ts +0 -4
  42. package/dist/module-rules.js +0 -29
  43. package/dist/module-rules.js.map +0 -1
  44. package/dist/nodejs-compat.d.ts +0 -14
  45. package/dist/nodejs-compat.js +0 -46
  46. package/dist/nodejs-compat.js.map +0 -1
  47. package/dist/options.d.ts +0 -45
  48. package/dist/options.js +0 -2
  49. package/dist/options.js.map +0 -1
  50. package/dist/routing.d.ts +0 -12
  51. package/dist/routing.js +0 -40
  52. package/dist/routing.js.map +0 -1
  53. package/dist/tunnel.d.ts +0 -15
  54. package/dist/tunnel.js +0 -94
  55. package/dist/tunnel.js.map +0 -1
  56. package/dist/worker-config.d.ts +0 -42
  57. package/dist/worker-config.js +0 -194
  58. package/dist/worker-config.js.map +0 -1
  59. package/src/assets.ts +0 -148
  60. package/src/build.ts +0 -153
  61. package/src/config.ts +0 -138
  62. package/src/containers.ts +0 -183
  63. package/src/dev-entry.ts +0 -50
  64. package/src/dev-worker.ts +0 -297
  65. package/src/dev.ts +0 -478
  66. package/src/http.ts +0 -102
  67. package/src/index.ts +0 -164
  68. package/src/inspector.ts +0 -44
  69. package/src/miniflare.ts +0 -7
  70. package/src/module-rules.ts +0 -36
  71. package/src/nodejs-compat.ts +0 -63
  72. package/src/options.ts +0 -46
  73. package/src/routing.ts +0 -48
  74. package/src/tunnel.ts +0 -106
  75. package/src/worker-config.ts +0 -237
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rspack-plugin-cloudflare",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Develop and build Cloudflare Workers with rspack: runs your Worker in workerd with HMR, using your Wrangler config",
5
5
  "keywords": [
6
6
  "rspack",
@@ -32,11 +32,11 @@
32
32
  "files": [
33
33
  "dist",
34
34
  "runtime",
35
- "src"
35
+ "THIRD_PARTY_NOTICES.txt"
36
36
  ],
37
37
  "scripts": {
38
- "build": "rimraf dist && tsc -p tsconfig.build.json",
39
- "check-types": "tsc -p tsconfig.json && tsc -p test/fixtures/basic/worker/tsconfig.json && tsc -p test/fixtures/legacy-compat/worker/tsconfig.json && tsc -p test/fixtures/multi-worker/tsconfig.json",
38
+ "build": "tsdown",
39
+ "check-types": "tsc -p tsconfig.json && tsc -p src/workers/tsconfig.json && tsc -p test/fixtures/basic/worker/tsconfig.json && tsc -p test/fixtures/legacy-compat/worker/tsconfig.json && tsc -p test/fixtures/multi-worker/tsconfig.json",
40
40
  "lint": "eslint .",
41
41
  "lint:fix": "eslint . --fix",
42
42
  "prepack": "node --run build",
@@ -65,24 +65,26 @@
65
65
  "eslint-plugin-regexp": "3.3.3",
66
66
  "eslint-plugin-unicorn": "79.0.0",
67
67
  "globals": "17.14.0",
68
- "miniflare": "5.20261101.0-beta",
69
- "rimraf": "6.1.3",
68
+ "ignore": "5.3.1",
69
+ "mime": "4.0.7",
70
70
  "semantic-release": "25.0.9",
71
+ "toucan-js": "4.0.0",
72
+ "tsdown": "0.23.4",
71
73
  "typescript": "6.0.3",
72
74
  "typescript-eslint": "8.72.1",
73
- "vitest": "5.0.5",
74
- "wrangler": "4.156.1"
75
+ "vitest": "5.1.0"
75
76
  },
76
77
  "dependencies": {
78
+ "@cloudflare/containers-shared": "0.23.7",
77
79
  "@cloudflare/unenv-preset": "2.16.2",
78
- "mrmime": "2.0.1",
80
+ "miniflare": "5.20261102.0-beta",
79
81
  "unenv": "2.0.0-rc.24",
82
+ "wrangler": "4.156.2",
80
83
  "ws": "8.22.1"
81
84
  },
82
85
  "peerDependencies": {
83
86
  "@rspack/core": "^2.0.0",
84
- "@rspack/dev-server": "^2.0.0",
85
- "wrangler": "^4.156.0"
87
+ "@rspack/dev-server": "^2.0.0"
86
88
  },
87
89
  "peerDependenciesMeta": {
88
90
  "@rspack/dev-server": {
package/dist/assets.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import type { IncomingMessage, ServerResponse } from 'node:http';
2
- /** The slice of rspack's output filesystem we read from; the dev server swaps in an in-memory one. */
3
- export interface ReadableFileSystem {
4
- readFile: (filePath: string, callback: (error: NodeJS.ErrnoException | null, data?: Buffer | string) => void) => void;
5
- stat: (filePath: string, callback: (error: NodeJS.ErrnoException | null, stats?: {
6
- isFile: () => boolean;
7
- }) => void) => void;
8
- }
9
- interface AssetsConfig {
10
- html_handling?: string;
11
- not_found_handling?: string;
12
- }
13
- export interface AssetServer {
14
- /** Whether a request path matches a file, applying the configured html_handling. */
15
- exists: (pathname: string) => Promise<boolean>;
16
- /** Serves a request from the assets directory, applying not_found_handling when nothing matches. */
17
- handle: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
18
- }
19
- /**
20
- * Serves the Worker's assets directory the way the asset Worker does, reading the compiler's output filesystem first so
21
- * files only emitted in memory by the dev server are visible.
22
- */
23
- export declare function createAssetServer(options: {
24
- directory: string;
25
- config: AssetsConfig | undefined;
26
- getOutputFileSystem: () => ReadableFileSystem | undefined;
27
- waitUntilValid: () => Promise<void>;
28
- /** More directories served at the root, checked after `directory`. */
29
- extraDirectories?: string[];
30
- }): AssetServer;
31
- export {};
package/dist/assets.js DELETED
@@ -1,112 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { lookup } from 'mrmime';
4
- function statFile(fileSystem, filePath) {
5
- return new Promise((resolve) => {
6
- fileSystem.stat(filePath, (error, stats) => {
7
- resolve(!error && Boolean(stats?.isFile()));
8
- });
9
- });
10
- }
11
- function readFile(fileSystem, filePath) {
12
- return new Promise((resolve, reject) => {
13
- fileSystem.readFile(filePath, (error, data) => {
14
- if (error || data === undefined) {
15
- reject(error ?? new Error(`Could not read ${filePath}`));
16
- return;
17
- }
18
- resolve(Buffer.from(data));
19
- });
20
- });
21
- }
22
- function htmlCandidates(pathname, htmlHandling) {
23
- if (htmlHandling === 'none') {
24
- return [pathname];
25
- }
26
- if (pathname.endsWith('/')) {
27
- return [`${pathname}index.html`];
28
- }
29
- return [pathname, `${pathname}.html`, `${pathname}/index.html`];
30
- }
31
- /**
32
- * Serves the Worker's assets directory the way the asset Worker does, reading the compiler's output filesystem first so
33
- * files only emitted in memory by the dev server are visible.
34
- */
35
- export function createAssetServer(options) {
36
- const { directory, config } = options;
37
- const roots = [directory, ...options.extraDirectories ?? []];
38
- async function findFile(filePath) {
39
- const outputFileSystem = options.getOutputFileSystem();
40
- if (outputFileSystem && await statFile(outputFileSystem, filePath)) {
41
- return { fileSystem: outputFileSystem, filePath };
42
- }
43
- if (await statFile(fs, filePath)) {
44
- return { fileSystem: fs, filePath };
45
- }
46
- }
47
- function toFilePath(root, pathname) {
48
- const filePath = path.join(root, decodeURIComponent(pathname));
49
- // path.join normalizes `..`, so anything still escaping the directory is a traversal attempt
50
- if (filePath !== root && !filePath.startsWith(root + path.sep)) {
51
- return;
52
- }
53
- return filePath;
54
- }
55
- async function resolveFile(pathname) {
56
- await options.waitUntilValid();
57
- for (const candidate of htmlCandidates(pathname, config?.html_handling)) {
58
- for (const root of roots) {
59
- const filePath = toFilePath(root, candidate);
60
- const found = filePath && await findFile(filePath);
61
- if (found) {
62
- return found;
63
- }
64
- }
65
- }
66
- }
67
- async function resolveNotFound(pathname) {
68
- if (config?.not_found_handling === 'single-page-application') {
69
- return { status: 200, file: await resolveFile('/index.html') };
70
- }
71
- if (config?.not_found_handling === '404-page') {
72
- // the nearest 404.html walking up from the requested path
73
- const segments = pathname.split('/').slice(0, -1);
74
- while (segments.length > 0) {
75
- const file = await resolveFile(`${segments.join('/')}/404.html`);
76
- if (file) {
77
- return { status: 404, file };
78
- }
79
- segments.pop();
80
- }
81
- }
82
- return { status: 404, file: undefined };
83
- }
84
- return {
85
- async exists(pathname) {
86
- const file = await resolveFile(pathname);
87
- return file !== undefined;
88
- },
89
- async handle(req, res) {
90
- const { pathname } = new URL(req.url ?? '/', 'http://localhost');
91
- let status = 200;
92
- let file = await resolveFile(pathname);
93
- if (!file) {
94
- ({ status, file } = await resolveNotFound(pathname));
95
- }
96
- if (!file) {
97
- res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
98
- res.end('Not Found');
99
- return;
100
- }
101
- const body = await readFile(file.fileSystem, file.filePath);
102
- res.writeHead(status, {
103
- 'Content-Type': lookup(file.filePath) ?? 'application/octet-stream',
104
- 'Content-Length': body.length,
105
- // dev output changes on every rebuild, so never let the browser reuse it without asking
106
- 'Cache-Control': 'no-cache',
107
- });
108
- res.end(req.method === 'HEAD' ? undefined : body);
109
- },
110
- };
111
- }
112
- //# sourceMappingURL=assets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAsBhC,SAAS,QAAQ,CAAC,UAA8B,EAAE,QAAgB;IACjE,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,EAAE;QACvC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAC1C,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,UAA8B,EAAE,QAAgB;IACjE,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC7C,IAAI,KAAK,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACjC,MAAM,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC,CAAC;gBACzD,OAAO;YACR,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB,EAAE,YAAgC;I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AC,IAAI,CAAC,CAAC;QACnD,CAAC;KACD,CAAC;AACH,CAAC"}
package/dist/build.d.ts DELETED
@@ -1,216 +0,0 @@
1
- import type { ResolvedWorker } from './config.js';
2
- import type { CloudflarePluginOptions } from './options.js';
3
- import type { Compiler } from '@rspack/core';
4
- /** The Wrangler config `wrangler deploy` reads for the built Worker, with every path rebased onto the output directory. */
5
- export declare function createOutputConfig(worker: ResolvedWorker): {
6
- assets: {
7
- directory: string;
8
- binding?: string;
9
- html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
10
- not_found_handling?: "single-page-application" | "404-page" | "none";
11
- base_path?: string;
12
- run_worker_first?: string[] | boolean;
13
- } | undefined;
14
- containers: {
15
- name?: string;
16
- instances?: number;
17
- max_instances?: number;
18
- image?: string;
19
- images?: Record<string, {
20
- dockerfile: string;
21
- build_context?: string;
22
- build_vars?: Record<string, string>;
23
- image?: never;
24
- } | {
25
- image: string;
26
- dockerfile?: never;
27
- build_context?: never;
28
- build_vars?: never;
29
- }>;
30
- image_build_context?: string;
31
- image_vars?: Record<string, string>;
32
- class_name?: string;
33
- observability?: {
34
- enabled?: boolean;
35
- logs?: {
36
- enabled?: boolean;
37
- };
38
- target_instance_percentage?: number;
39
- target_instance_count?: number;
40
- };
41
- scheduling_policy?: "default" | "durable_object" | "moon" | "regional";
42
- instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | {
43
- vcpu?: number;
44
- memory_mib?: number;
45
- disk_mb?: number;
46
- };
47
- ssh?: {
48
- enabled: boolean;
49
- port?: number;
50
- };
51
- wrangler_ssh?: {
52
- enabled: boolean;
53
- port?: number;
54
- };
55
- authorized_keys?: {
56
- name: string;
57
- public_key: string;
58
- }[];
59
- trusted_user_ca_keys?: {
60
- name?: string;
61
- public_key: string;
62
- }[];
63
- configuration?: {
64
- image?: string;
65
- labels?: {
66
- name: string;
67
- value: string;
68
- }[];
69
- secrets?: {
70
- name: string;
71
- type: "env";
72
- secret: string;
73
- }[];
74
- disk?: {
75
- size_mb: number;
76
- };
77
- vcpu?: number;
78
- memory_mib?: number;
79
- };
80
- constraints?: {
81
- regions?: ("ENAM" | "WNAM" | "EEUR" | "WEUR" | "APAC" | "SAM" | "ME" | "OC" | "AFR")[];
82
- jurisdiction?: "eu" | "fedramp" | "us";
83
- cities?: string[];
84
- tier?: number;
85
- tiers?: number[];
86
- };
87
- affinities?: {
88
- colocation?: "datacenter";
89
- hardware_generation?: "highest-overall-performance";
90
- };
91
- durable_objects?: {
92
- namespace_id: string;
93
- };
94
- rollout_step_percentage?: number | number[];
95
- rollout_kind?: "full_auto" | "none" | "full_manual";
96
- rollout_active_grace_period?: number;
97
- unsafe?: Record<string, unknown>;
98
- }[] | undefined;
99
- upload_source_maps: boolean;
100
- main: string;
101
- no_bundle: boolean;
102
- rules: ({
103
- type: "CompiledWasm" | "Data" | "Text" | "ESModule" | "CommonJS" | "PythonModule" | "PythonRequirement";
104
- globs: string[];
105
- fallthrough?: boolean;
106
- } | {
107
- type: string;
108
- globs: string[];
109
- })[];
110
- } | {
111
- assets: {
112
- directory: string;
113
- binding?: string;
114
- html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
115
- not_found_handling?: "single-page-application" | "404-page" | "none";
116
- base_path?: string;
117
- run_worker_first?: string[] | boolean;
118
- } | undefined;
119
- containers: {
120
- name?: string;
121
- instances?: number;
122
- max_instances?: number;
123
- image?: string;
124
- images?: Record<string, {
125
- dockerfile: string;
126
- build_context?: string;
127
- build_vars?: Record<string, string>;
128
- image?: never;
129
- } | {
130
- image: string;
131
- dockerfile?: never;
132
- build_context?: never;
133
- build_vars?: never;
134
- }>;
135
- image_build_context?: string;
136
- image_vars?: Record<string, string>;
137
- class_name?: string;
138
- observability?: {
139
- enabled?: boolean;
140
- logs?: {
141
- enabled?: boolean;
142
- };
143
- target_instance_percentage?: number;
144
- target_instance_count?: number;
145
- };
146
- scheduling_policy?: "default" | "durable_object" | "moon" | "regional";
147
- instance_type?: "dev" | "basic" | "standard" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | {
148
- vcpu?: number;
149
- memory_mib?: number;
150
- disk_mb?: number;
151
- };
152
- ssh?: {
153
- enabled: boolean;
154
- port?: number;
155
- };
156
- wrangler_ssh?: {
157
- enabled: boolean;
158
- port?: number;
159
- };
160
- authorized_keys?: {
161
- name: string;
162
- public_key: string;
163
- }[];
164
- trusted_user_ca_keys?: {
165
- name?: string;
166
- public_key: string;
167
- }[];
168
- configuration?: {
169
- image?: string;
170
- labels?: {
171
- name: string;
172
- value: string;
173
- }[];
174
- secrets?: {
175
- name: string;
176
- type: "env";
177
- secret: string;
178
- }[];
179
- disk?: {
180
- size_mb: number;
181
- };
182
- vcpu?: number;
183
- memory_mib?: number;
184
- };
185
- constraints?: {
186
- regions?: ("ENAM" | "WNAM" | "EEUR" | "WEUR" | "APAC" | "SAM" | "ME" | "OC" | "AFR")[];
187
- jurisdiction?: "eu" | "fedramp" | "us";
188
- cities?: string[];
189
- tier?: number;
190
- tiers?: number[];
191
- };
192
- affinities?: {
193
- colocation?: "datacenter";
194
- hardware_generation?: "highest-overall-performance";
195
- };
196
- durable_objects?: {
197
- namespace_id: string;
198
- };
199
- rollout_step_percentage?: number | number[];
200
- rollout_kind?: "full_auto" | "none" | "full_manual";
201
- rollout_active_grace_period?: number;
202
- unsafe?: Record<string, unknown>;
203
- }[] | undefined;
204
- upload_source_maps: boolean;
205
- main: undefined;
206
- no_bundle?: undefined;
207
- rules?: undefined;
208
- };
209
- /** Moves assets the Worker imported into its assets directory, once the client build has emitted (and maybe cleaned) it. */
210
- export declare function copyImportedAssets(workers: ResolvedWorker[]): Promise<void>;
211
- /** Builds every Worker, entry first, and writes the redirect `wrangler deploy` follows to the built configs. */
212
- export declare function buildWorkers(options: {
213
- compiler: Compiler;
214
- workers: ResolvedWorker[];
215
- pluginOptions: CloudflarePluginOptions;
216
- }): Promise<void>;
package/dist/build.js DELETED
@@ -1,140 +0,0 @@
1
- import { existsSync } from 'node:fs';
2
- import fs from 'node:fs/promises';
3
- import path from 'node:path';
4
- import { unstable_getVarsForDev } from 'wrangler';
5
- import { IMPORTED_ASSETS_DIR, createWorkerConfig } from './worker-config.js';
6
- // readConfig bookkeeping and bundling settings that rspack has already applied, so deploy must not apply them again
7
- const OMITTED_CONFIG_KEYS = new Set([
8
- 'configPath',
9
- 'userConfigPath',
10
- 'topLevelName',
11
- 'definedEnvironments',
12
- 'targetEnvironment',
13
- 'build',
14
- 'define',
15
- 'alias',
16
- 'tsconfig',
17
- 'find_additional_modules',
18
- 'base_dir',
19
- 'preserve_file_names',
20
- ]);
21
- /** The Wrangler config `wrangler deploy` reads for the built Worker, with every path rebased onto the output directory. */
22
- export function createOutputConfig(worker) {
23
- const rebase = (filePath) => path.relative(worker.outputDir, path.resolve(worker.rootDir, filePath)).replaceAll('\\', '/') || '.';
24
- const config = Object.fromEntries(Object.entries(worker.config).filter(([key]) => !OMITTED_CONFIG_KEYS.has(key)));
25
- // readConfig always fills in `unsafe`, and wrangler warns about it being experimental even when empty
26
- if (worker.config.unsafe && Object.keys(worker.config.unsafe).length === 0) {
27
- delete config.unsafe;
28
- }
29
- // wrangler's defaults already cover .wasm and .bin beside the bundle; custom binary rules have to come along
30
- const binaryRules = worker.config.rules.filter(rule => rule.type === 'CompiledWasm' || rule.type === 'Data');
31
- const bundled = worker.main
32
- ? { main: 'index.js', no_bundle: true, rules: [{ type: 'ESModule', globs: ['**/*.js', '**/*.mjs'] }, ...binaryRules] }
33
- : { main: undefined };
34
- return {
35
- ...config,
36
- ...bundled,
37
- assets: worker.assets ? { ...worker.config.assets, directory: rebase(worker.assets.directory) } : undefined,
38
- containers: worker.config.containers?.map((container) => {
39
- const rebased = { ...container };
40
- // image is either a Dockerfile path or a registry reference; readConfig makes paths absolute, so only those need rebasing
41
- if (container.image && path.isAbsolute(container.image)) {
42
- rebased.image = rebase(container.image);
43
- }
44
- if (container.image_build_context) {
45
- rebased.image_build_context = rebase(container.image_build_context);
46
- }
47
- return rebased;
48
- }),
49
- upload_source_maps: worker.config.upload_source_maps ?? true,
50
- };
51
- }
52
- async function runCompiler(compiler) {
53
- try {
54
- return await new Promise((resolve, reject) => {
55
- compiler.run((error, stats) => {
56
- if (error || !stats) {
57
- reject(error ?? new Error('Worker build produced no stats'));
58
- }
59
- else {
60
- resolve(stats);
61
- }
62
- });
63
- });
64
- }
65
- finally {
66
- await new Promise((resolve) => {
67
- compiler.close(() => resolve());
68
- });
69
- }
70
- }
71
- /** The local secrets for this environment, written beside the build so `wrangler dev` can preview it like the Vite plugin's `vite preview`. */
72
- function createDevVars(worker) {
73
- const vars = unstable_getVarsForDev(worker.configPath, undefined, {}, worker.environment, true, worker.config.secrets);
74
- const lines = Object.entries(vars).map(([key, binding]) => `${key}=${JSON.stringify(String(binding.value))}`);
75
- return lines.length > 0 ? `${lines.join('\n')}\n` : undefined;
76
- }
77
- /** Bundles one Worker into its output directory beside the `wrangler.json` that deploys it, returning that config's path. */
78
- async function buildWorker(compiler, worker, pluginOptions) {
79
- if (worker.main) {
80
- const { config } = createWorkerConfig({
81
- compiler,
82
- worker,
83
- pluginOptions,
84
- outputDir: worker.outputDir,
85
- entry: worker.main,
86
- mode: compiler.options.mode === 'production' ? 'production' : 'development',
87
- });
88
- const workerCompiler = compiler.rspack.rspack(config);
89
- const stats = await runCompiler(workerCompiler);
90
- if (stats.hasErrors()) {
91
- throw new Error(`Worker "${worker.name}" build failed:\n${stats.toString({ preset: 'errors-only', colors: false })}`);
92
- }
93
- }
94
- else {
95
- await fs.rm(worker.outputDir, { recursive: true, force: true });
96
- await fs.mkdir(worker.outputDir, { recursive: true });
97
- }
98
- const outputConfigPath = path.join(worker.outputDir, 'wrangler.json');
99
- await fs.writeFile(outputConfigPath, JSON.stringify(createOutputConfig(worker), null, '\t'));
100
- const devVars = createDevVars(worker);
101
- if (devVars) {
102
- await fs.writeFile(path.join(worker.outputDir, '.dev.vars'), devVars);
103
- }
104
- return outputConfigPath;
105
- }
106
- /** Moves assets the Worker imported into its assets directory, once the client build has emitted (and maybe cleaned) it. */
107
- export async function copyImportedAssets(workers) {
108
- for (const worker of workers) {
109
- const source = path.join(worker.outputDir, IMPORTED_ASSETS_DIR);
110
- if (!worker.assets || !existsSync(source)) {
111
- continue;
112
- }
113
- await fs.cp(source, worker.assets.directory, { recursive: true });
114
- await fs.rm(source, { recursive: true, force: true });
115
- }
116
- }
117
- /** Builds every Worker, entry first, and writes the redirect `wrangler deploy` follows to the built configs. */
118
- export async function buildWorkers(options) {
119
- const { compiler, workers, pluginOptions } = options;
120
- const [entry] = workers;
121
- if (!entry) {
122
- return;
123
- }
124
- const configPaths = [];
125
- for (const worker of workers) {
126
- configPaths.push(await buildWorker(compiler, worker, pluginOptions));
127
- }
128
- // the same redirect @cloudflare/vite-plugin writes, so a plain `wrangler deploy` next to the user config deploys the build
129
- const deployConfigPath = path.join(entry.rootDir, '.wrangler', 'deploy', 'config.json');
130
- const relativeToDeploy = (filePath) => path.relative(path.dirname(deployConfigPath), filePath).replaceAll('\\', '/');
131
- const [entryConfigPath, ...auxiliaryConfigPaths] = configPaths;
132
- await fs.mkdir(path.dirname(deployConfigPath), { recursive: true });
133
- await fs.writeFile(deployConfigPath, JSON.stringify({
134
- configPath: entryConfigPath && relativeToDeploy(entryConfigPath),
135
- auxiliaryWorkers: auxiliaryConfigPaths.map((configPath) => {
136
- return { configPath: relativeToDeploy(configPath) };
137
- }),
138
- }));
139
- }
140
- //# sourceMappingURL=build.js.map
package/dist/build.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;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AG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IACxF,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7H,MAAM,CAAC,eAAe,EAAE,GAAG,oBAAoB,CAAC,GAAG,WAAW,CAAC;IAC/D,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,MAAM,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC;QACnD,UAAU,EAAE,eAAe,IAAI,gBAAgB,CAAC,eAAe,CAAC;QAChE,gBAAgB,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;YACzD,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;QACrD,CAAC,CAAC;KACF,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/config.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import type { CloudflarePluginOptions, WorkerConfig } from './options.js';
2
- export interface ResolvedWorker {
3
- config: WorkerConfig;
4
- configPath: string;
5
- environment: string | undefined;
6
- name: string;
7
- /** Undefined for assets-only projects, which deploy static files without a Worker. */
8
- main: string | undefined;
9
- /** Directory holding the Wrangler config; relative paths in the config resolve against it. */
10
- rootDir: string;
11
- assets: {
12
- directory: string;
13
- binding: string | undefined;
14
- } | undefined;
15
- outputDir: string;
16
- }
17
- export declare function resolveWorker(context: string, options: CloudflarePluginOptions): ResolvedWorker;
18
- /** A resolver per Worker, entry first, so a config change can re-read just the Worker it belongs to. */
19
- export declare function getWorkerResolvers(context: string, options: CloudflarePluginOptions): (() => ResolvedWorker)[];