wrangler 0.0.0-e88a54e → 0.0.0-e8a2a1d9
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/Cloudflare_CA.pem +18 -0
- package/README.md +47 -16
- package/bin/wrangler.js +123 -32
- package/kv-asset-handler.js +1 -0
- package/package.json +155 -86
- package/templates/__tests__/pages-dev-util.test.ts +128 -0
- package/templates/__tests__/tsconfig-sanity.ts +12 -0
- package/templates/__tests__/tsconfig.json +8 -0
- package/templates/checked-fetch.js +30 -0
- package/templates/facade.d.ts +17 -0
- package/templates/gitignore +172 -0
- package/templates/init-tests/test-jest-new-worker.js +23 -0
- package/templates/init-tests/test-vitest-new-worker.js +24 -0
- package/templates/init-tests/test-vitest-new-worker.ts +25 -0
- package/templates/middleware/common.ts +67 -0
- package/templates/middleware/loader-modules.ts +137 -0
- package/templates/middleware/loader-sw.ts +228 -0
- package/templates/middleware/middleware-d1-beta.d.ts +3 -0
- package/templates/middleware/middleware-miniflare3-json-error.ts +33 -0
- package/templates/middleware/middleware-multiworker-dev.d.ts +4 -0
- package/templates/middleware/middleware-multiworker-dev.ts +68 -0
- package/templates/middleware/middleware-pretty-error.ts +40 -0
- package/templates/middleware/middleware-scheduled.ts +15 -0
- package/templates/middleware/middleware-serve-static-assets.d.ts +6 -0
- package/templates/middleware/middleware-serve-static-assets.ts +56 -0
- package/templates/modules-watch-stub.js +4 -0
- package/templates/new-worker-scheduled.js +17 -0
- package/templates/new-worker-scheduled.ts +32 -0
- package/templates/new-worker.js +3 -3
- package/templates/new-worker.ts +22 -4
- package/templates/no-op-worker.js +10 -0
- package/templates/pages-dev-pipeline.ts +31 -0
- package/templates/pages-dev-util.ts +55 -0
- package/templates/pages-shim.ts +9 -0
- package/templates/pages-template-plugin.ts +190 -0
- package/templates/pages-template-worker.ts +198 -0
- package/templates/startDevWorker/InspectorProxyWorker.ts +652 -0
- package/templates/startDevWorker/ProxyWorker.ts +252 -0
- package/templates/tsconfig-sanity.ts +11 -0
- package/templates/tsconfig.init.json +105 -0
- package/templates/tsconfig.json +6 -103
- package/wrangler-dist/InspectorProxyWorker.js +460 -0
- package/wrangler-dist/InspectorProxyWorker.js.map +6 -0
- package/wrangler-dist/ProxyWorker.js +186 -0
- package/wrangler-dist/ProxyWorker.js.map +6 -0
- package/wrangler-dist/cli.d.ts +23507 -0
- package/wrangler-dist/cli.js +152534 -132977
- package/wrangler-dist/wasm-sync.wasm +0 -0
- package/import_meta_url.js +0 -3
- package/miniflare-config-stubs/.env.empty +0 -0
- package/miniflare-config-stubs/package.empty.json +0 -1
- package/miniflare-config-stubs/wrangler.empty.toml +0 -0
- package/miniflare-dist/index.mjs +0 -79
- package/miniflare-dist/index.mjs.map +0 -7
- package/pages/functions/buildWorker.ts +0 -62
- package/pages/functions/filepath-routing.test.ts +0 -223
- package/pages/functions/filepath-routing.ts +0 -181
- package/pages/functions/identifiers.ts +0 -78
- package/pages/functions/routes.ts +0 -151
- package/pages/functions/template-worker.ts +0 -130
- package/src/__tests__/configuration.test.ts +0 -2796
- package/src/__tests__/dev.test.tsx +0 -496
- package/src/__tests__/dev2.test.tsx +0 -154
- package/src/__tests__/guess-worker-format.test.ts +0 -58
- package/src/__tests__/helpers/clipboardy-mock.js +0 -4
- package/src/__tests__/helpers/cmd-shim.d.ts +0 -11
- package/src/__tests__/helpers/faye-websocket.d.ts +0 -6
- package/src/__tests__/helpers/mock-account-id.ts +0 -48
- package/src/__tests__/helpers/mock-bin.ts +0 -36
- package/src/__tests__/helpers/mock-cfetch.ts +0 -207
- package/src/__tests__/helpers/mock-console.ts +0 -70
- package/src/__tests__/helpers/mock-dialogs.ts +0 -65
- package/src/__tests__/helpers/mock-kv.ts +0 -33
- package/src/__tests__/helpers/mock-stdin.ts +0 -103
- package/src/__tests__/helpers/mock-web-socket.ts +0 -29
- package/src/__tests__/helpers/run-in-tmp.ts +0 -32
- package/src/__tests__/helpers/run-wrangler.ts +0 -16
- package/src/__tests__/helpers/write-wrangler-toml.ts +0 -17
- package/src/__tests__/https-options.test.ts +0 -127
- package/src/__tests__/index.test.ts +0 -991
- package/src/__tests__/jest.setup.ts +0 -69
- package/src/__tests__/kv.test.ts +0 -1382
- package/src/__tests__/logout.test.ts +0 -52
- package/src/__tests__/package-manager.test.ts +0 -206
- package/src/__tests__/pages.test.ts +0 -44
- package/src/__tests__/parse.test.ts +0 -322
- package/src/__tests__/publish.test.ts +0 -2704
- package/src/__tests__/r2.test.ts +0 -198
- package/src/__tests__/route.test.ts +0 -45
- package/src/__tests__/secret.test.ts +0 -425
- package/src/__tests__/sentry.test.ts +0 -146
- package/src/__tests__/tail.test.ts +0 -564
- package/src/__tests__/whoami.test.tsx +0 -100
- package/src/bundle.ts +0 -142
- package/src/cfetch/index.ts +0 -104
- package/src/cfetch/internal.ts +0 -139
- package/src/cli.ts +0 -19
- package/src/config/README.md +0 -107
- package/src/config/config.ts +0 -218
- package/src/config/diagnostics.ts +0 -80
- package/src/config/environment.ts +0 -366
- package/src/config/index.ts +0 -62
- package/src/config/validation-helpers.ts +0 -486
- package/src/config/validation.ts +0 -1090
- package/src/create-worker-preview.ts +0 -166
- package/src/create-worker-upload-form.ts +0 -217
- package/src/dev/dev.tsx +0 -364
- package/src/dev/local.tsx +0 -232
- package/src/dev/remote.tsx +0 -203
- package/src/dev/use-esbuild.ts +0 -100
- package/src/dialogs.tsx +0 -77
- package/src/entry.ts +0 -208
- package/src/environment-variables.ts +0 -33
- package/src/https-options.ts +0 -122
- package/src/index.tsx +0 -2373
- package/src/inspect.ts +0 -617
- package/src/kv.ts +0 -319
- package/src/miniflare-cli/README.md +0 -30
- package/src/miniflare-cli/enum-keys.ts +0 -17
- package/src/miniflare-cli/index.ts +0 -37
- package/src/module-collection.ts +0 -258
- package/src/open-in-browser.ts +0 -25
- package/src/package-manager.ts +0 -126
- package/src/pages.tsx +0 -1047
- package/src/parse.ts +0 -183
- package/src/paths.ts +0 -26
- package/src/proxy.ts +0 -440
- package/src/publish.ts +0 -347
- package/src/r2.ts +0 -50
- package/src/reporting.ts +0 -131
- package/src/selfsigned.d.ts +0 -29
- package/src/sites.tsx +0 -280
- package/src/tail/filters.ts +0 -279
- package/src/tail/index.ts +0 -299
- package/src/tail/printing.ts +0 -62
- package/src/user.tsx +0 -1118
- package/src/whoami.tsx +0 -69
- package/src/worker.ts +0 -163
- package/templates/static-asset-facade.js +0 -47
- package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
- package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
- package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
- package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
- package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
- package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
- package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
- package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
- package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
- package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
- package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
- package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
- package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
- package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
- package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
- package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
- package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
- package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
- package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
- package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
- package/vendor/wrangler-mime/CHANGELOG.md +0 -289
- package/vendor/wrangler-mime/LICENSE +0 -21
- package/vendor/wrangler-mime/Mime.js +0 -97
- package/vendor/wrangler-mime/README.md +0 -187
- package/vendor/wrangler-mime/cli.js +0 -46
- package/vendor/wrangler-mime/index.js +0 -4
- package/vendor/wrangler-mime/lite.js +0 -4
- package/vendor/wrangler-mime/package.json +0 -52
- package/vendor/wrangler-mime/types/other.js +0 -1
- package/vendor/wrangler-mime/types/standard.js +0 -1
- package/wrangler-dist/cli.js.map +0 -7
package/src/package-manager.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { execa, execaCommandSync } from "execa";
|
|
4
|
-
|
|
5
|
-
export interface PackageManager {
|
|
6
|
-
cwd: string;
|
|
7
|
-
type: "npm" | "yarn";
|
|
8
|
-
addDevDeps(...packages: string[]): Promise<void>;
|
|
9
|
-
install(): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export async function getPackageManager(cwd: string): Promise<PackageManager> {
|
|
13
|
-
const [hasYarn, hasNpm] = await Promise.all([supportsYarn(), supportsNpm()]);
|
|
14
|
-
const hasYarnLock = existsSync(join(cwd, "yarn.lock"));
|
|
15
|
-
const hasNpmLock = existsSync(join(cwd, "package-lock.json"));
|
|
16
|
-
|
|
17
|
-
if (hasNpmLock) {
|
|
18
|
-
if (hasNpm) {
|
|
19
|
-
console.log(
|
|
20
|
-
"Using npm as package manager, as there is already a package-lock.json file."
|
|
21
|
-
);
|
|
22
|
-
return { ...NpmPackageManager, cwd };
|
|
23
|
-
} else if (hasYarn) {
|
|
24
|
-
console.log("Using yarn as package manager.");
|
|
25
|
-
console.warn(
|
|
26
|
-
"There is already a package-lock.json file but could not find npm on the PATH."
|
|
27
|
-
);
|
|
28
|
-
return { ...YarnPackageManager, cwd };
|
|
29
|
-
}
|
|
30
|
-
} else if (hasYarnLock) {
|
|
31
|
-
if (hasYarn) {
|
|
32
|
-
console.log(
|
|
33
|
-
"Using yarn as package manager, as there is already a yarn.lock file."
|
|
34
|
-
);
|
|
35
|
-
return { ...YarnPackageManager, cwd };
|
|
36
|
-
} else if (hasNpm) {
|
|
37
|
-
console.log("Using npm as package manager.");
|
|
38
|
-
console.warn(
|
|
39
|
-
"There is already a yarn.lock file but could not find yarn on the PATH."
|
|
40
|
-
);
|
|
41
|
-
return { ...NpmPackageManager, cwd };
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (hasNpm) {
|
|
46
|
-
console.log("Using npm as package manager.");
|
|
47
|
-
return { ...NpmPackageManager, cwd };
|
|
48
|
-
} else if (hasYarn) {
|
|
49
|
-
console.log("Using yarn as package manager.");
|
|
50
|
-
return { ...YarnPackageManager, cwd };
|
|
51
|
-
} else {
|
|
52
|
-
throw new Error(
|
|
53
|
-
"Unable to find a package manager. Supported managers are: npm and yarn."
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Get the name of the given `packageManager`.
|
|
60
|
-
*/
|
|
61
|
-
export function getPackageManagerName(packageManager: PackageManager): string {
|
|
62
|
-
return packageManager.type ?? "unknown";
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Manage packages using npm
|
|
67
|
-
*/
|
|
68
|
-
const NpmPackageManager: PackageManager = {
|
|
69
|
-
cwd: process.cwd(),
|
|
70
|
-
type: "npm",
|
|
71
|
-
/** Add and install a new devDependency into the local package.json. */
|
|
72
|
-
async addDevDeps(...packages: string[]): Promise<void> {
|
|
73
|
-
await execa("npm", ["install", ...packages, "--save-dev"], {
|
|
74
|
-
stdio: "inherit",
|
|
75
|
-
cwd: this.cwd,
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
/** Install all the dependencies in the local package.json. */
|
|
80
|
-
async install(): Promise<void> {
|
|
81
|
-
await execa("npm", ["install"], {
|
|
82
|
-
stdio: "inherit",
|
|
83
|
-
cwd: this.cwd,
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Manage packages using yarn
|
|
90
|
-
*/
|
|
91
|
-
const YarnPackageManager: PackageManager = {
|
|
92
|
-
cwd: process.cwd(),
|
|
93
|
-
type: "yarn",
|
|
94
|
-
/** Add and install a new devDependency into the local package.json. */
|
|
95
|
-
async addDevDeps(...packages: string[]): Promise<void> {
|
|
96
|
-
await execa("yarn", ["add", ...packages, "--dev"], {
|
|
97
|
-
stdio: "inherit",
|
|
98
|
-
cwd: this.cwd,
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
/** Install all the dependencies in the local package.json. */
|
|
103
|
-
async install(): Promise<void> {
|
|
104
|
-
await execa("yarn", ["install"], {
|
|
105
|
-
stdio: "inherit",
|
|
106
|
-
cwd: this.cwd,
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
async function supports(name: string): Promise<boolean> {
|
|
112
|
-
try {
|
|
113
|
-
execaCommandSync(`${name} --version`, { stdio: "ignore" });
|
|
114
|
-
return true;
|
|
115
|
-
} catch {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function supportsYarn(): Promise<boolean> {
|
|
121
|
-
return supports("yarn");
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function supportsNpm(): Promise<boolean> {
|
|
125
|
-
return supports("npm");
|
|
126
|
-
}
|