create-cloudflare 2.0.4 → 2.0.5

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 (43) hide show
  1. package/dist/cli.js +1 -1
  2. package/package.json +2 -1
  3. package/dist/angular/templates/src/_routes.json +0 -5
  4. package/dist/angular/templates/src/main.server.ts +0 -35
  5. package/dist/angular/templates/tools/bundle.mjs +0 -74
  6. package/dist/angular/templates/tools/copy-client-files.mjs +0 -4
  7. package/dist/angular/templates/tools/copy-worker-files.mjs +0 -10
  8. package/dist/angular/templates/tools/paths.mjs +0 -9
  9. package/dist/angular/templates/tsconfig.server.json +0 -5
  10. package/dist/tsconfig.tsbuildinfo +0 -1
  11. package/templates/chatgptPlugin/ts/.assets/example.png +0 -0
  12. package/templates/chatgptPlugin/ts/README.md +0 -25
  13. package/templates/chatgptPlugin/ts/package.json +0 -16
  14. package/templates/chatgptPlugin/ts/src/index.ts +0 -33
  15. package/templates/chatgptPlugin/ts/src/search.ts +0 -63
  16. package/templates/chatgptPlugin/ts/wrangler.toml +0 -3
  17. package/templates/common/js/.prettierrc +0 -5
  18. package/templates/common/js/package.json +0 -14
  19. package/templates/common/js/src/ab-test.js +0 -41
  20. package/templates/common/js/src/proxy.js +0 -23
  21. package/templates/common/js/src/redirect.js +0 -13
  22. package/templates/common/js/src/router.js +0 -22
  23. package/templates/common/js/src/worker.js +0 -46
  24. package/templates/common/js/wrangler.toml +0 -40
  25. package/templates/common/ts/.prettierrc +0 -5
  26. package/templates/common/ts/package.json +0 -15
  27. package/templates/common/ts/src/ab-test.ts +0 -41
  28. package/templates/common/ts/src/proxy.ts +0 -23
  29. package/templates/common/ts/src/redirect.ts +0 -13
  30. package/templates/common/ts/src/router.ts +0 -22
  31. package/templates/common/ts/src/worker.ts +0 -46
  32. package/templates/common/ts/tsconfig.json +0 -101
  33. package/templates/common/ts/worker-configuration.d.ts +0 -16
  34. package/templates/common/ts/wrangler.toml +0 -40
  35. package/templates/simple/js/.prettierrc +0 -5
  36. package/templates/simple/js/package.json +0 -14
  37. package/templates/simple/js/src/worker.js +0 -15
  38. package/templates/simple/js/wrangler.toml +0 -40
  39. package/templates/simple/ts/.prettierrc +0 -5
  40. package/templates/simple/ts/package.json +0 -14
  41. package/templates/simple/ts/src/worker.ts +0 -32
  42. package/templates/simple/ts/tsconfig.json +0 -101
  43. package/templates/simple/ts/wrangler.toml +0 -40
package/dist/cli.js CHANGED
@@ -44367,7 +44367,7 @@ var Yargs = YargsFactory(esm_default);
44367
44367
  var yargs_default = Yargs;
44368
44368
 
44369
44369
  // package.json
44370
- var version = "2.0.4";
44370
+ var version = "2.0.5";
44371
44371
 
44372
44372
  // src/pages.ts
44373
44373
  var import_path8 = require("path");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -29,6 +29,7 @@
29
29
  "build": "node scripts/build.js",
30
30
  "check:lint": "eslint .",
31
31
  "check:type": "tsc --noEmit",
32
+ "prepublishOnly": "npm run build",
32
33
  "test:e2e": "npm run build && vitest run --config ./vitest-e2e.config.ts",
33
34
  "test:unit": "vitest run --config ./vitest.config.ts",
34
35
  "watch": "node scripts/build.js --watch"
@@ -1,5 +0,0 @@
1
- {
2
- "version": 1,
3
- "include": ["/*"],
4
- "exclude": ["/*.*"]
5
- }
@@ -1,35 +0,0 @@
1
- import "zone.js/dist/zone-node";
2
- import "@angular/platform-server/init";
3
-
4
- import { bootstrapApplication } from "@angular/platform-browser";
5
- import { renderApplication } from "@angular/platform-server";
6
-
7
- import { AppComponent } from "./app/app.component";
8
- import { config } from "./app/app.config.server";
9
-
10
- interface Env {
11
- ASSETS: { fetch: typeof fetch };
12
- }
13
-
14
- // We attach the Cloudflare `fetch()` handler to the global scope
15
- // so that we can export it when we process the Angular output.
16
- // See tools/bundle.mjs
17
- (globalThis as any).__workerFetchHandler = async function fetch(
18
- request: Request,
19
- env: Env
20
- ) {
21
- const url = new URL(request.url);
22
- console.log("render SSR", url.href);
23
-
24
- // Get the root `index.html` content.
25
- const indexUrl = new URL("/", url);
26
- const indexResponse = await env.ASSETS.fetch(new Request(indexUrl));
27
- const document = await indexResponse.text();
28
-
29
- const content = await renderApplication(
30
- () => bootstrapApplication(AppComponent, config),
31
- { document, url: url.pathname }
32
- );
33
- // console.log("rendered SSR", content);
34
- return new Response(content, indexResponse);
35
- };
@@ -1,74 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
3
- import { worker as workerPath } from "./paths.mjs";
4
- import * as esbuild from "esbuild";
5
- import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
6
- import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill";
7
- import fg from "fast-glob";
8
-
9
- // Process each of the JS files in the `_worker.js` directory
10
- for (const entry of await fg("**/*.js", { cwd: workerPath, onlyFiles: true })) {
11
- if (entry === "index.js") {
12
- // This is the main bundle and gets special treatment
13
- await bundleMain();
14
- } else {
15
- await bundleLazyModule(entry);
16
- }
17
- }
18
-
19
- // Use esbuild to process the main entry-point.
20
- // - shim Node.js APIs
21
- // - convert `global` to `globalThis`
22
- // - convert dynamic `require()` calls to `await import()` calls
23
- // - ensure that the Cloudflare `fetch()` handler is exported
24
- async function bundleMain() {
25
- const result = await esbuild.build({
26
- entryPoints: ["index.js"],
27
- bundle: true,
28
- format: "iife",
29
- write: false,
30
- absWorkingDir: workerPath,
31
- define: {
32
- global: "globalThis",
33
- },
34
- plugins: [
35
- NodeGlobalsPolyfillPlugin({ buffer: true }),
36
- NodeModulesPolyfillPlugin(),
37
- ],
38
- });
39
-
40
- let main = result.outputFiles[0].text;
41
-
42
- // Patch any dynamic imports (converting `require()` calls to `import()` calls).
43
- main = main.replace(
44
- 'installChunk(__require("./" + __webpack_require__.u(chunkId))',
45
- 'promises.push(import("./" + __webpack_require__.u(chunkId)).then((mod) => installChunk(mod.default))'
46
- );
47
- // Export the fetch handler (grabbing it from the global).
48
- main += "\nexport default { fetch : globalThis.__workerFetchHandler };";
49
-
50
- await fs.writeFile(path.resolve(workerPath, "index.js"), main);
51
- }
52
-
53
- // Use esbuild to process the lazy load modules
54
- // In particular we need to convert the CommonJS export syntax to ESM.
55
- async function bundleLazyModule(filePath) {
56
- const result = await esbuild.build({
57
- entryPoints: [filePath],
58
- bundle: true,
59
- format: "cjs",
60
- write: false,
61
- absWorkingDir: workerPath,
62
- define: {
63
- global: "globalThis",
64
- },
65
- plugins: [NodeModulesPolyfillPlugin()],
66
- });
67
-
68
- let content = result.outputFiles[0].text;
69
-
70
- // Export the fetch handler (grabbing it from the global).
71
- content = "const exports = {};\n" + content + "\nexport default exports";
72
-
73
- await fs.writeFile(path.resolve(workerPath, filePath), content);
74
- }
@@ -1,4 +0,0 @@
1
- // Copy the client-side files over so that they can be uploaded by the pages publish command.
2
- import fs from "node:fs";
3
- import { client, cloudflare } from "./paths.mjs";
4
- fs.cpSync(client, cloudflare, { recursive: true });
@@ -1,10 +0,0 @@
1
- // Copy the lazy loaded modules into the dist folder so that they can be
2
- // uploaded along with the main Worker module.
3
- import fs from "node:fs";
4
- import path from "node:path";
5
- import { ssr, worker } from "./paths.mjs";
6
- fs.cpSync(ssr, worker, { recursive: true });
7
- fs.renameSync(
8
- path.resolve(worker, "main.js"),
9
- path.resolve(worker, "index.js")
10
- );
@@ -1,9 +0,0 @@
1
- import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
-
4
- const dirname = path.dirname(fileURLToPath(import.meta.url));
5
- export const root = path.resolve(dirname, "..");
6
- export const client = path.resolve(root, "dist/browser");
7
- export const ssr = path.resolve(root, "dist/server");
8
- export const cloudflare = path.resolve(root, "dist/cloudflare");
9
- export const worker = path.resolve(cloudflare, "_worker.js");
@@ -1,5 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.app.json",
4
- "files": ["./src/main.server.ts"]
5
- }
@@ -1 +0,0 @@
1
- {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/typescript/lib/lib.es2023.d.ts","../node_modules/typescript/lib/lib.esnext.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/typescript/lib/lib.es2023.array.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/dom-events.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts","../../../node_modules/vite/node_modules/esbuild/lib/main.d.ts","../../../node_modules/vite/types/hmrpayload.d.ts","../../../node_modules/vite/types/customevent.d.ts","../../../node_modules/rollup/dist/rollup.d.ts","../../../node_modules/vite/types/importglob.d.ts","../../../node_modules/source-map-js/source-map.d.ts","../../../node_modules/postcss/lib/comment.d.ts","../../../node_modules/postcss/lib/at-rule.d.ts","../../../node_modules/postcss/lib/rule.d.ts","../../../node_modules/postcss/lib/container.d.ts","../../../node_modules/postcss/lib/declaration.d.ts","../../../node_modules/postcss/lib/previous-map.d.ts","../../../node_modules/postcss/lib/input.d.ts","../../../node_modules/postcss/lib/css-syntax-error.d.ts","../../../node_modules/postcss/lib/warning.d.ts","../../../node_modules/postcss/lib/document.d.ts","../../../node_modules/postcss/lib/root.d.ts","../../../node_modules/postcss/lib/lazy-result.d.ts","../../../node_modules/postcss/lib/no-work-result.d.ts","../../../node_modules/postcss/lib/processor.d.ts","../../../node_modules/postcss/lib/result.d.ts","../../../node_modules/postcss/lib/node.d.ts","../../../node_modules/postcss/lib/list.d.ts","../../../node_modules/postcss/lib/postcss.d.ts","../../../node_modules/vite/dist/node/index.d.ts","../../../node_modules/vite-tsconfig-paths/dist/index.d.ts","../../../node_modules/@types/chai/index.d.ts","../node_modules/@vitest/utils/dist/types.d.ts","../node_modules/@vitest/utils/dist/helpers.d.ts","../../../node_modules/pretty-format/build/types.d.ts","../../../node_modules/pretty-format/build/index.d.ts","../node_modules/@vitest/utils/dist/index.d.ts","../node_modules/@vitest/expect/dist/index.d.ts","../../../node_modules/@vitest/snapshot/dist/environment-38cdead3.d.ts","../../../node_modules/@vitest/snapshot/dist/index-6461367c.d.ts","../../../node_modules/@vitest/snapshot/dist/index.d.ts","../node_modules/@vitest/runner/dist/tasks-c965d7f6.d.ts","../node_modules/@vitest/runner/dist/runner-3b8473ea.d.ts","../node_modules/@vitest/runner/dist/index.d.ts","../node_modules/@vitest/runner/dist/types.d.ts","../node_modules/@vitest/runner/types.d.ts","../node_modules/@vitest/utils/dist/diff.d.ts","../node_modules/@vitest/utils/diff.d.ts","../node_modules/@vitest/runner/dist/utils.d.ts","../node_modules/@vitest/runner/utils.d.ts","../../../node_modules/tinybench/dist/index.d.ts","../node_modules/vite-node/dist/types.d-1e7e3fdf.d.ts","../node_modules/vite-node/dist/types-c39b64bb.d.ts","../node_modules/vite-node/dist/client.d.ts","../../../node_modules/@vitest/snapshot/dist/manager.d.ts","../../../node_modules/@vitest/snapshot/manager.d.ts","../node_modules/vite-node/dist/index.d.ts","../node_modules/source-map/source-map.d.ts","../node_modules/vite-node/dist/server.d.ts","../node_modules/vitest/dist/types-e3c9754d.d.ts","../node_modules/vitest/dist/config.d.ts","../node_modules/vitest/config.d.ts","../vitest-e2e.config.ts","../vitest.config.ts","../vitest.d.ts","../node_modules/execa/index.d.ts","../node_modules/chalk/source/vendor/ansi-styles/index.d.ts","../node_modules/chalk/source/vendor/supports-color/index.d.ts","../node_modules/chalk/source/index.d.ts","../src/helpers/colors.ts","../src/helpers/cli.ts","../../../node_modules/@types/which-pm-runs/index.d.ts","../../../node_modules/@clack/core/dist/index.d.ts","../../../node_modules/@clack/prompts/dist/index.d.ts","../../../node_modules/log-update/index.d.ts","../src/helpers/interactive.ts","../src/types.ts","../src/helpers/command.ts","../src/helpers/files.ts","../src/frameworks/angular/index.ts","../src/frameworks/astro/index.ts","../src/frameworks/docusaurus/index.ts","../src/frameworks/gatsby/index.ts","../src/frameworks/hono/index.ts","../src/frameworks/next/templates.ts","../src/frameworks/next/index.ts","../src/frameworks/nuxt/index.ts","../src/frameworks/qwik/index.ts","../src/frameworks/react/index.ts","../src/frameworks/remix/index.ts","../src/frameworks/solid/templates.ts","../src/frameworks/solid/index.ts","../node_modules/ast-types/types.d.ts","../node_modules/ast-types/gen/namedtypes.d.ts","../node_modules/ast-types/gen/kinds.d.ts","../node_modules/ast-types/gen/builders.d.ts","../node_modules/ast-types/lib/types.d.ts","../node_modules/ast-types/lib/path.d.ts","../node_modules/ast-types/lib/scope.d.ts","../node_modules/ast-types/lib/node-path.d.ts","../node_modules/ast-types/lib/path-visitor.d.ts","../node_modules/ast-types/gen/visitor.d.ts","../node_modules/ast-types/main.d.ts","../node_modules/recast/lib/options.d.ts","../node_modules/recast/lib/parser.d.ts","../node_modules/recast/lib/printer.d.ts","../node_modules/recast/main.d.ts","../node_modules/recast/parsers/esprima.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../node_modules/recast/parsers/_babel_options.d.ts","../node_modules/recast/parsers/typescript.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/esprima/index.d.ts","../src/helpers/codemod.ts","../src/frameworks/svelte/templates.ts","../src/frameworks/svelte/index.ts","../src/frameworks/versionmap.json","../src/frameworks/vue/index.ts","../src/frameworks/index.ts","../node_modules/tinyspy/dist/index.d.ts","../node_modules/@vitest/spy/dist/index.d.ts","../../../node_modules/@vitest/snapshot/dist/environment.d.ts","../../../node_modules/@vitest/snapshot/environment.d.ts","../node_modules/vitest/dist/index.d.ts","../e2e-tests/pages.test.ts","../e2e-tests/setup.ts","../../../node_modules/@types/random-seed/index.d.ts","../../../node_modules/haikunator/dist-types/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yargs/helpers.d.ts","../package.json","../src/common.ts","../src/pages.ts","../src/workers.ts","../src/cli.ts","../src/helpers/__tests__/command.test.ts"],"fileInfos":[{"version":"6a6b471e7e43e15ef6f8fe617a22ce4ecb0e34efa6c3dfcfe7cebd392bcca9d2","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","f4e736d6c8d69ae5b3ab0ddfcaa3dc365c3e76909d6660af5b4e979b3934ac20","eeeb3aca31fbadef8b82502484499dfd1757204799a6f5b33116201c810676ec",{"version":"f296963760430fb65b4e5d91f0ed770a91c6e77455bacf8fa23a1501654ede0e","affectsGlobalScope":true},{"version":"5114a95689b63f96b957e00216bc04baf9e1a1782aa4d8ee7e5e9acbf768e301","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"b7e9f95a7387e3f66be0ed6db43600c49cec33a3900437ce2fd350d9b7cb16f2","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"61ed9b6d07af959e745fb11f9593ecd743b279418cc8a99448ea3cd5f3b3eb22","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"f5c92f2c27b06c1a41b88f6db8299205aee52c2a2943f7ed29bd585977f254e8","affectsGlobalScope":true},{"version":"b7feb7967c6c6003e11f49efa8f5de989484e0a6ba2e5a6c41b55f8b8bd85dba","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"b9ea5778ff8b50d7c04c9890170db34c26a5358cccba36844fe319f50a43a61a","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"25de46552b782d43cb7284df22fe2a265de387cf0248b747a7a1b647d81861f6","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"bce910d9164785c9f0d4dcea4be359f5f92130c7c7833dea6138ab1db310a1f9","affectsGlobalScope":true},"7d2e3fea24c712c99c03ad8f556abedbfe105f87f1be10b95dbd409d24bc05a3",{"version":"211e3f15fbced4ab4be19f49ffa990b9ff20d749d33b65ff753be691e7616239","affectsGlobalScope":true},"3719525a8f6ab731e3dfd585d9f87df55ec7d50d461df84f74eb4d68bb165244","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","e596c9bb2f29a2699fdd4ae89139612652245192f67f45617c5a4b20832aaae9","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","1cdcfc1f624d6c08aa12c73935f6e13f095919cd99edf95752951796eb225729","4eaff3d8e10676fd7913d8c108890e71c688e1e7d52f6d1d55c39514f493dc47","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"00dee7cdca8b8420c47ea4a31a34b8e8294013ebc4f463fd941e867e7bf05029","affectsGlobalScope":true},"3256f3cccd578f9e7fe3a28096c505634bebcee8afb738ffa99368e536ca3a0b","1c84b46267610a34028edfd0d035509341751262bac1062857f3c8df7aff7153","7f138842074d0a40681775af008c8452093b68c383c94de31759e853c6d06b5c","a3d541d303ee505053f5dcbf9fafb65cac3d5631037501cd616195863a6c5740","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"bcebb922784739bdb34c18ee51095d25a92b560c78ccd2eaacd6bd00f7443d83","7ee6ed878c4528215c82b664fe0cfe80e8b4da6c0d4cc80869367868774db8b1","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"0715e4cd28ad471b2a93f3e552ff51a3ae423417a01a10aa1d3bc7c6b95059d6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","4f3fdeba4e28e21aa719c081b8dc8f91d47e12e773389b9d35679c08151c9d37","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","f69ff39996a61a0dd10f4bce73272b52e8024a4d58b13ab32bf4712909d0a2b7",{"version":"3c4ba1dd9b12ffa284b565063108f2f031d150ea15b8fafbdc17f5d2a07251f3","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","1422cd9e705adcc09088fda85a900c2b70e3ad36ea85846f68bd1a884cdf4e2b","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"a73ae8c0e62103bb9e21bb6538700881bf135b9a8b125b857ec68edfa0da4ed3","affectsGlobalScope":true},{"version":"e1c1b2fbe236bf7ee3e342eeae7e20efb8988a0ac7da1cbbfa2c1f66b76c3423","affectsGlobalScope":true},"868831cab82b65dfe1d68180e898af1f2101e89ba9b754d1db6fb8cc2fac1921","0fe8985a28f82c450a04a6edf1279d7181c0893f37da7d2a27f8efd4fd5edb03","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"52120bb7e4583612225bdf08e7c12559548170f11e660d33a33623bae9bbdbba","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a6dd3dba8e665ac43d279e0fdf5219edda0eed69b5e9a5061f46cd6a65c4f7a1","a0394460985d8f6068060dfc93a38a16b5257019f193eb0196a7084aa1e2569d","bcb6ea18f23dae2c48459d7b86d3adccd6898f824fcbf9da08b935f559896580","0aa7220845f5f3902fe043f646f9d9218bd7dd6c4046e8471580866ea6b03aa2","24f9d2575fe8a379bc51b6be4bfe7f1d574dec0a8d2f2598fa83112262066a9a","739c2c46edc112421fc023c24b4898b1f413f792bb6a02b40ba182c648e56c2f","858d0d831826c6eb563df02f7db71c90e26deadd0938652096bea3cc14899700","d1c89db652113258e4ba4bbdf5cc7a2a3a600403d4d864a2087b95186253cd5b","11a90d2cb2eaf7fdf931a63b58279e8161f1477a1bd1e914ae026c1bbf9afed3","af18e30f3ba06e9870b61dfa4a109215caabdaa337590c51b4a044a9f338ce96","ace603f7b60599f2dcdbd71c07137b60a747dd33be540f4a294b890f9e0b89dc","7658fbdd425c656fb1849b44932ae7431e8c3198d22c65ce1490deb582743b52","7786c75c1b46e93b33c63dccf689143a5f47ff451a6b3bd9b10e4801cdeadcc2","615b7264db151461b896cd79719414d63f7b2b2100b275828e53cab95a356e2f","31491a01ed7466e0b3b0ef8407f2524683055eceb955b1d5ccf7096129468b39","f4b12f7dde4fc0e386648318481bdcfe861b566be246bebf0e8a11ebd909adf9","e8966f7c424780bb0b9d411ebe13eda8555ca15aa675603316c2952bc027b0e3","df0e5f3c4a518111d160cf3bebc9a3ac7d39c6e3bfb7a21d43c304896c3015e2","df4e2f161f74870708c2cc5e1036a6405b878496408fda1ee50d5b10e50d6601","bf791da347fb1c0ffc1e2fcd35867e64bb8355270ae26278198c521bdcf94569","e0e0e3c068e145fbb322120979299ff130ffdd39f0dcd0d5aeaa9f3f8a0d01d9","fde91356172e35b9ea68bbdf33721f7c80307a4ce65b82105eac800e9e744995","9bd5e5a4a1e66b35efe3c48ddac1116537ef86e041717f3a9b9f1e060c74efa6","d7e4a5f4ccfb749c3033fafc233073b4d1dcca0249785186c589602a81f9d86f","68161b6f3004fc10f8bb47a4986cef13c3b0728fb1ca3e1dc7316227d09b2c8d","7ed7c893a59716284bf3e58e814d8e96075575abb24ea27034ef18fb9842c9c0","f961eca7ae704d5b6d1e590ee6dafbd552700a2e4076480e613dadb55368835b",{"version":"b9734142a4b241cfb505be4a2eb0261d211647df7c73043f817f4fdd8d96c846","affectsGlobalScope":true},"19ce9ec982b542ef6d04d29ce678aad2fa52a67d8087e9c6cd95a4d6d98784c8","4af47b2f19621ce8f638167a32f141a3a2c0e71ce8ebf51384393ca1c2654e60","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","0beeeb5964025d8564c03cb0bf1a4b60dc40c01f065ad1a4e9030415f5bc7bc2","2ea3c07887a34c982f1d902139569a86bfa4fbf5ab79c3397aec80b2ceb20b05","73b67d2e87ac7d7baaca64ca33fd1523c0b3c850cb7db5b9c014f1be7996bed1","5d5ae61fce1581fd6424269790a9071e3f8e69b029f5d0fcb46ce618c5dbc565","38a0ccc7106312a9f60e034e7cd8ac218774d8aa65f832cee3363a7e65f99325","370d29706526cf66ee767a4a3ee4218c9544a252ce22f231648414348704cb4c","6bf53608a27a76ef8580f9577618174f0dd5325142cafb8b3a19aa4850319afb","821fe27bd167988c3cc518af8d9591ac1bd8d9e9d231ee9eac7b82786dd9f3a6","f234315aeb08f02d74769341155afa47ef6ec6873607f55c6a9104d50fc27383","1c53e1884dc6550ce179c68e9e3086f54af258fff39eb70274ea9294eb7ce6df","2d57bdaafc7cd0ebc006f0e77c869d6fe6148809c08e8b5677aef4150cf4a7c7","05c7aef6a4e496b93c2e682cced8903c0dfe6340d04f3fe616176e2782193435","67856637713bace00feca7f0d4a9907e6a85bcceeb507e07df852cb5f6467834","e666e31d323fef5642f87db0da48a83e58f0aaf9e3823e87eabd8ec7e0441a36","caeae351358d6c5b8da971c4ba7973987cbbbe4766081d07394e51c5544c8727","d12ab69ace581804d4f264eabc71094ca8dadfa70ae2bf5ccd54a8d6105ab84b","973af20e33ebed2f6c3af36062c214b03daf2a0a3193554f6538ea928228b671","ca179564af22b92d588ce07d527042767d37bacce79fb78cd6fc7d8ff8c1f329","e72396ce544667ab49df38ffb91cb3f80ff17d2ad3df903ec30b1d2ca8ea68de","b7e28e06011460436d5c2ec2996846ac0c451e135357fc5a7269e5665a32fbd7","d422e50d00562af6bb419fca3a81c8437391acc13f52672dcffdfc3da2a93125","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","632d6fe34a09b481d3007779ad03e4202e4ed4f73bee02fdfb6b23e51ca4aebd",{"version":"7c4d59b36618af873cc489404906c46e2a2f0629a8416ee08b711f5f02096f3f","affectsGlobalScope":true},"5309c17206a98ed2bdd130eb25a213e864697f5b017f774141c12030e82db573","aa348c4fb2f8ac77df855f07fb66281c9f6e71746fdff3b13c7932aa7642b788","a9789185eaa9beb2c258f8469eb235d8b613904a48645414f4b7655afcfcffc7","837bf5de0f11b94b5f6be7d5c45be59e83cf4d7a32b29c594e9a454ecd179378",{"version":"5deb403bd1fb08de8979f6c37bd29d44fc0f6089965ad6b9430866ef08e05c7a","affectsGlobalScope":true},"4a0a4c4dc86f3a2e27675d167257f27bf451304d6da9cca309a6c6209dafc594","acfed6cc001e7f7f26d2ba42222a180ba669bb966d4dd9cb4ad5596516061b13","f61a4dc92450609c353738f0a2daebf8cae71b24716dbd952456d80b1e1a48b6","b1adbadd9e2b45fa099362a19f95fec9d145b4b7f74f81c18d8fa1a163da47e0","1b5de3caf290424daa02881824476884764e7b79b62a415d072edd33e84d7455","3c5e7408c16b3c3908f147c932e19056fb532729316c7c2e223cf9463d8b95af","aad51d47ebfe62dbb432ca4e068e486d90bf7f91e49376035cdc71d4d6d32add","db01b68de3dbac4adf9a8c1551da9d349ff13a6655237c4a0bfa9d77bdb0a9cf","89b03007125f54552a881b856d825a13e95cc043a001c2d96e2a07a1f6796618","42933d34bb60c9cdda56b23b6ebaab820f0c7e424f8bcaae55b89fbf7752cf91",{"version":"7cafb8944424229149c203bac8e3d4475699e74f3ab0a18209e2d6a5e542e32b","signature":"29ebbb70e6b0e509e410990d5132e2bf9318b1688b45f86bbe41bd59bd92c957"},{"version":"2858cf3f7d3c8791a9300333d8c163ef6ad1ab2caa11caab5096f2172c93dab1","signature":"b8da8a2749a59b6c438f51478c55039c4e7ce9b5955a2906b4a2e2ed95e7115c"},{"version":"63cdc7826805fc068304a424a914a2a626aa45a09364e662252c9f910b412ff9","signature":"11663e73f80a17e58ed979d06bea091fc8b7e43d18d2940db8b2c79a32869ac9"},"9351707cdc55cf32b32562f11dd0380797a478354498db23d7bf8509f1ee4c8b",{"version":"ddff7b56a32527eaad2b99301c8114d25a760232e0a80d7417cdae909fe453c1","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"030c93909cebcb22ea8434353b50b83cfbb8df43ba09c7e110acca33ffbd1ca9","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"4e7b03f4c629407e103ac8774a77af556108620a71469084f4d40da3408e35c4","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"95630051af62b8cbc6e4e3cba51c27e3a90c629ffcd5a826b6c6ff0c9ff1d4e8","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"548d73f2c210b052681042a8e40c6efe2ae42d18ebe25d4c7d922140d20793aa","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},"2bf63982a9c1922955552a95335316c34a778b96d8c94823c31e8f9fe883de43",{"version":"7d862f19583bdb7192bd10c70e856e36123c3cadd0a5b9a56672a0e5358fe43c","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"90909dcd7775086fbda7cb0eb143774843bfdf32fd3784e5ff977b89799a7922","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"4148ea71830289185742f656024c6b463024cde2170830ebc248a94d2984356a","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"af927b0c8b02fb39352fd4902fc5b55ff563d57c3bd7baefaffa4c88536591f6","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"e75f030688fd3990ce2f5259c8fd5d374b5f47640de6e1b9df25ee056215762d","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},"3b579d6946e54e1aced70c4f2039efcef7ef6676786afe9f2e1ae96bd10fe420",{"version":"8372e8f1b665c7a5488a2c88711744a79d0e7245ddea9509819fb8589f54067e","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},"e78705f977ecfcc36de9ab57841ad7a617ef649b07a995577fd857f1d175f730","5083850590c7890ffb680f0c9838f48b07eb8b2f7dbe02874858fcac0691705d","02a4a2284d423d8ccc3a77aa9257c34fdac28cddfb46f73178e60f6a1b1b31e9","3ee8e014aab37dbd755401967fbb9602221550038f6b8da6cedd5291a918ae0a","826f3c6a6d737e0d330522094a21cde94a202c5373448240ba483709cb829aec","7e4a23f6f3763da4a06900935d22acfd463c375cada5ab325e3980bd6c95d5b3","f3e045e81b47113fa02aaf9637b9ef84347610aaceda60a0d8316aabc3f03638","1bfe6db4f3dffacd1da82748cb8f0acec04e8a4d7bd36c09573d5d80a7dec28b","6a8d6deca8ec4250630fea4e5f23bd9bf0face98739ccd22e08a17173117155b","226dbfe4506447111bd898161d47850f8c57f04cbb6a3a6d487b7939dbf89b1b","13f846a45f738733c8a63a06eaa9f580e9c07eb7aed5d8a2c674114846a42175","9d14fcf0b69094271127c7b6acb36987be5d1bffa4eb948359549f040fb50349","e3a5287471fb08f053c06fd998632792aa5f022e45278f1e6dd55fb2fa9e7362","28a6c8eeb48e165920067b9193555649fc43c2a28c450f23f622e5eb043d9463","1147c3efa5a256bcd6a3d2cfaf764185b7120bf985f8412d9bae596a0348f77b","da9afe737540b72d7b9fa486da00d0ba5f4e47c8768551d49427c79a6995770f","a20fc1fcd9cd7c2b79d5f00d14802c1d58c3848e09ee4f84b350591af88b7636","b4f76b34637d79cefad486127115fed843762c69512d7101b7096e1293699679","5c673ef6148d60938c7a8f245b5a45ca20e7680ef17fd6065abad6b5a0545d0d","45d9b99e9ce92bfb11323b4fa52fb00ff74dbd477e3646369d665652e0726539","946bd1737d9412395a8f24414c70f18660b84a75a12b0b448e6eb1a2161d06dd","8dd4741b9f8d12ccc40af6ca5831879d20cbfc845af31599960b25725eeaa290","4cedf32ddfc7d4d8815cce7bd28fc4b8271d3d8e01ba56f6803558e5060ee8b5","88c7c4230aee1558b37b4c0afefad2775a997c3de6ca65ea1fb99866885668cb",{"version":"85715c6ed6e204d1fc382b5acad6fba33f3d096457a1c12d9dc2ab24212e843b","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"f58e92d34a79819733acc4af4d087e8e45a47f8f04d2fdbb8743dccb3b4f0994","signature":"f5155ae9ad009d199e5b9972796efa02c072b9b045d284f9646e8a248e81b4cc"},{"version":"c0bee3cec184bb85509617fea52582066e318a954acee4531b1ea8953b0025c1","signature":"525820942d2085d53bb8f9fbe2b55bb4e6fed8ec6ef3e577e29b478efa7b50c0"},{"version":"cfc3980ae7d628f07e26a4773231249a16132ba2bf8b6f12d86083ab45cb7fce","signature":"582354d648d24e34a227490dece26c26e71754863eb27f34d703819831e8a623"},"9a82b3cd322d6b46c2407c162bbfd0b13edc9d23dced719a751a481b985690a0","2d37a18dbc84466a72a4b00d0293ecfe3170fc664ca32126db0b7eace05824d5","f63e23230f3960b712450cf08f0f31e56acdae3ce65e0bf31bfdd6442b29d115","f2d1a59a658165341b0e2b7879aa2e19ea6a709146b2d3f70ee8a07159d3d08e","8a3ff3da0cc09f4c5523f6e336635cd0e2cd5cc7e5297186b44b6a6b06e3ef96","df9aa214c4b80e43524159ff0f58ea2f862b6de96aafeda91f3f624276c66a4a","a26267ff0225080b8c9e8d890b3b0f185d444a2c1265b5aa7df52b5e716b5600","23d7c6e65ee88b760bd30d95a893ed32409bb734cbcc0991cd736f4ddc180a12","03f6b219ae8700f4d9f4821c27c23f2abe6e904428b2432bd97d46584b79b565","f7e133b20ee2669b6c0e5d7f0cd510868c57cd64b283e68c7f598e30ce9d76d2","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","9cc884a6f8547dec935f930b8aad8212aaae876ebeaab5cd42d20b45251860e7",{"version":"12a8efcdbf646545f9396698c7be3c42b7f132cfb201013cf62820b6e988deaf","signature":"9dd1e29f9476dc35469ed92bdadff0b967d6f5144d92540eea5fce0ab4fd57f8"},{"version":"2188c75e7c56a6b65b8a894e2ee7de12f74eb9f459f1ad0dc5fafa50b49c441f","signature":"6b4030466730d245c87437fba047bc4420d9ca63b8743e3d99ad185bcde197c8"},{"version":"98e750b1b39a8767316bdff8d7db7c4bc6c9054723a3bfd860e143728a83456e","signature":"804ad1232e84fb2358e5fd8261e8eb86f1572d814322fe7cca686db55540a575"},{"version":"abe6c542977ba85d586bae54aedfe5ddd1adbf1dcb565404ab3f064088914bc7","signature":"fc12dbd8665abee301a65198b976779c41d9bda71bb6973a08a034003530dbab"},"78838df60090359102ad82d4c0c8bbc664a8ab5ab2529ceaebf1553d44a021a6","ecf08625fd4c6614a75da2894c1de97dcf50d54cff1e57dfbebb881c5857e8b0"],"root":[[171,173],178,179,[184,200],[223,225],227,228,234,235,[242,246]],"options":{"allowSyntheticDefaultImports":true,"alwaysStrict":false,"esModuleInterop":true,"module":1,"outDir":"./","skipLibCheck":true,"strict":true,"target":99},"fileIdsList":[[106,217],[106],[94,106],[106,181],[106,221],[106,238],[106,147],[106,144,147],[106,144,147,148],[106,231],[106,163],[106,236],[106,123],[106,123,135],[106,120,121,122,124,135],[106,126],[106,123,130,134,137],[106,125,137],[106,128,130,133,134,137],[106,128,130,131,133,134,137],[106,120,121,122,123,124,126,127,128,129,130,134,137],[106,119,120,121,122,123,124,126,127,128,129,130,131,133,134,135,136],[106,119,137],[106,130,131,132,134,137],[106,133,137],[106,123,129,134,137],[106,127,135],[106,143],[106,119],[106,138,168],[76,77,79,81,84,94,102,105,106,111,113,114,115,116,117,118,137],[106,115],[77,85,86,106,174,187,228,233],[77,106,233],[60,106],[63,106],[64,69,97,106],[65,76,77,84,94,105,106],[65,66,76,84,106],[67,106],[68,69,77,85,106],[69,94,102,106],[70,72,76,84,106],[71,106],[72,73,106],[76,106],[74,76,106],[76,77,78,94,105,106],[76,77,78,91,94,97,106],[106,110],[72,76,79,84,94,105,106],[76,77,79,80,84,94,102,105,106],[79,81,94,102,105,106],[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],[76,82,106],[83,105,106],[72,76,84,94,106],[85,106],[86,106],[63,87,106],[88,104,106,110],[89,106],[90,106],[76,91,92,106],[91,93,106,108],[64,76,94,95,96,97,106],[64,94,96,106],[94,95,106],[97,106],[98,106],[76,100,101,106],[100,101,106],[69,84,94,102,106],[103,106],[84,104,106],[64,79,90,105,106],[69,106],[94,106,107],[106,108],[106,109],[64,69,76,78,87,94,105,106,108,110],[94,106,111],[106,140,145],[106,145,150,151],[106,150],[106,145],[106,145,150,156],[106,153],[106,157],[106,229],[106,155],[106,141],[106,141,142,144],[106,202,203],[106,202],[106,201,203,205],[106,202,208,209],[106,201,205,206,207],[106,201,205,208,210],[106,201,205],[106,201,208],[106,201,202,204],[106,201,202,204,205,206,208,209,210],[106,175,176],[104,106],[64,65,94,106],[106,201],[106,212],[106,211,212,213,214],[106,218],[106,217,219],[106,160,161],[106,138,160,161,168],[106,160],[106,169],[77,106,110,138,140,145,146,149,152,154,158,159,162,164,165,166,167,168],[77,106,110,138,140,145,146,149,152,154,158,159,162,164,165,166,167,168,169,230,232],[77,86,106,178,179,184,185,237,239,240,241,243,244],[77,86,88,106,178,179,184,185,186],[78,86,106,178,179,184,185,186,187,228],[106,178,179,185,186,187,228],[106,185,186,187,228],[106,178,184,185,186,187,228],[106,179,185,186,228],[106,179,185,188,189,190,191,192,194,195,196,197,198,200,225,226,227],[106,178,179,185,186,187,193,228],[106,179,185,186,187,228],[77,106,178,179,185,186,187,199,228],[106,178,179,185,186,187,215,223,224,228],[65,106,180,186,233],[88,106,178],[86,106,179,187,215,216,220,222],[106,177],[65,77,86,106,178,179,180,184,185],[77,106,179],[106,178,179,181,182,183],[86,88,106,178,179,184,185,186,187,228,242],[106,228],[78,85,86,88,106,178,179,184,185,186,242],[106,139,170],[185],[228]],"referencedMap":[[218,1],[217,2],[181,3],[182,4],[140,2],[222,5],[221,2],[236,2],[180,2],[238,2],[240,6],[239,6],[147,2],[231,7],[148,8],[149,9],[163,9],[232,10],[164,11],[237,12],[183,2],[121,13],[120,14],[123,15],[127,16],[124,14],[129,17],[126,18],[131,19],[136,2],[132,20],[135,21],[137,22],[125,23],[133,24],[134,25],[130,26],[122,13],[128,27],[144,28],[143,2],[117,2],[119,29],[159,2],[139,30],[138,31],[114,2],[116,32],[115,2],[118,2],[234,33],[235,34],[60,35],[61,35],[63,36],[64,37],[65,38],[66,39],[67,40],[68,41],[69,42],[70,43],[71,44],[72,45],[73,45],[75,46],[74,47],[76,46],[77,48],[78,49],[62,50],[112,2],[79,51],[80,52],[81,53],[113,54],[82,55],[83,56],[84,57],[85,58],[86,59],[87,60],[88,61],[89,62],[90,63],[91,64],[92,64],[93,65],[94,66],[96,67],[95,68],[97,69],[98,70],[99,2],[100,71],[101,72],[102,73],[103,74],[104,75],[105,76],[106,77],[107,78],[108,79],[109,80],[110,81],[111,82],[146,83],[152,84],[151,85],[150,86],[153,84],[157,87],[154,88],[158,89],[230,90],[156,91],[155,2],[142,92],[145,93],[141,2],[204,94],[203,95],[202,96],[210,97],[208,98],[209,99],[206,100],[207,101],[205,102],[211,103],[201,2],[177,104],[175,2],[176,105],[174,106],[212,107],[213,108],[214,2],[215,109],[219,110],[216,2],[220,111],[166,2],[229,2],[58,2],[59,2],[13,2],[12,2],[2,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[20,2],[21,2],[3,2],[4,2],[25,2],[22,2],[23,2],[24,2],[26,2],[27,2],[28,2],[5,2],[29,2],[30,2],[31,2],[32,2],[6,2],[36,2],[33,2],[34,2],[35,2],[37,2],[7,2],[38,2],[43,2],[44,2],[39,2],[40,2],[41,2],[42,2],[8,2],[48,2],[45,2],[46,2],[47,2],[49,2],[9,2],[50,2],[51,2],[52,2],[55,2],[53,2],[54,2],[56,2],[10,2],[1,2],[11,2],[57,2],[162,112],[165,112],[167,113],[161,114],[160,2],[170,115],[169,116],[233,117],[168,116],[241,2],[245,118],[242,119],[188,120],[189,121],[190,122],[191,123],[192,124],[228,125],[194,126],[193,2],[195,127],[196,127],[197,127],[198,124],[200,128],[199,2],[225,129],[224,2],[226,2],[227,122],[246,130],[179,131],[223,132],[178,133],[186,134],[187,135],[184,136],[243,137],[185,138],[244,139],[171,140],[172,140],[173,2]],"exportedModulesMap":[[218,1],[217,2],[181,3],[182,4],[140,2],[222,5],[221,2],[236,2],[180,2],[238,2],[240,6],[239,6],[147,2],[231,7],[148,8],[149,9],[163,9],[232,10],[164,11],[237,12],[183,2],[121,13],[120,14],[123,15],[127,16],[124,14],[129,17],[126,18],[131,19],[136,2],[132,20],[135,21],[137,22],[125,23],[133,24],[134,25],[130,26],[122,13],[128,27],[144,28],[143,2],[117,2],[119,29],[159,2],[139,30],[138,31],[114,2],[116,32],[115,2],[118,2],[234,33],[235,34],[60,35],[61,35],[63,36],[64,37],[65,38],[66,39],[67,40],[68,41],[69,42],[70,43],[71,44],[72,45],[73,45],[75,46],[74,47],[76,46],[77,48],[78,49],[62,50],[112,2],[79,51],[80,52],[81,53],[113,54],[82,55],[83,56],[84,57],[85,58],[86,59],[87,60],[88,61],[89,62],[90,63],[91,64],[92,64],[93,65],[94,66],[96,67],[95,68],[97,69],[98,70],[99,2],[100,71],[101,72],[102,73],[103,74],[104,75],[105,76],[106,77],[107,78],[108,79],[109,80],[110,81],[111,82],[146,83],[152,84],[151,85],[150,86],[153,84],[157,87],[154,88],[158,89],[230,90],[156,91],[155,2],[142,92],[145,93],[141,2],[204,94],[203,95],[202,96],[210,97],[208,98],[209,99],[206,100],[207,101],[205,102],[211,103],[201,2],[177,104],[175,2],[176,105],[174,106],[212,107],[213,108],[214,2],[215,109],[219,110],[216,2],[220,111],[166,2],[229,2],[58,2],[59,2],[13,2],[12,2],[2,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[20,2],[21,2],[3,2],[4,2],[25,2],[22,2],[23,2],[24,2],[26,2],[27,2],[28,2],[5,2],[29,2],[30,2],[31,2],[32,2],[6,2],[36,2],[33,2],[34,2],[35,2],[37,2],[7,2],[38,2],[43,2],[44,2],[39,2],[40,2],[41,2],[42,2],[8,2],[48,2],[45,2],[46,2],[47,2],[49,2],[9,2],[50,2],[51,2],[52,2],[55,2],[53,2],[54,2],[56,2],[10,2],[1,2],[11,2],[57,2],[162,112],[165,112],[167,113],[161,114],[160,2],[170,115],[169,116],[233,117],[168,116],[245,118],[242,141],[188,141],[189,141],[190,141],[191,141],[192,141],[228,141],[194,141],[193,2],[195,141],[196,141],[197,141],[198,141],[200,141],[199,2],[225,141],[224,2],[227,141],[246,130],[179,131],[223,132],[178,133],[186,141],[187,135],[243,141],[185,142],[244,141],[171,140],[172,140],[173,2]],"semanticDiagnosticsPerFile":[218,217,181,182,140,222,221,236,180,238,240,239,147,231,148,149,163,232,164,237,183,121,120,123,127,124,129,126,131,136,132,135,137,125,133,134,130,122,128,144,143,117,119,159,139,138,114,116,115,118,234,235,60,61,63,64,65,66,67,68,69,70,71,72,73,75,74,76,77,78,62,112,79,80,81,113,82,83,84,85,86,87,88,89,90,91,92,93,94,96,95,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,146,152,151,150,153,157,154,158,230,156,155,142,145,141,204,203,202,210,208,209,206,207,205,211,201,177,175,176,174,212,213,214,215,219,216,220,166,229,58,59,13,12,2,14,15,16,17,18,19,20,21,3,4,25,22,23,24,26,27,28,5,29,30,31,32,6,36,33,34,35,37,7,38,43,44,39,40,41,42,8,48,45,46,47,49,9,50,51,52,55,53,54,56,10,1,11,57,162,165,167,161,160,170,169,233,168,241,245,242,188,189,190,191,192,228,194,193,195,196,197,198,200,199,225,224,226,227,246,179,223,178,186,187,184,243,185,244,171,172,173],"affectedFilesPendingEmit":[234,235,241,245,242,188,189,190,191,192,228,194,193,195,196,197,198,200,199,225,224,226,227,246,179,223,178,186,187,184,243,185,244,171,172]},"version":"5.0.4"}
@@ -1,25 +0,0 @@
1
- # Example ChatGPT Plugin for Cloudflare Workers
2
-
3
- This is an example plugin showing how to build [ChatGPT plugins](https://platform.openai.com/docs/plugins/introduction) using [Cloudflare Workers](https://workers.dev). Using this example, you can deploy a plugin to Cloudflare Workers in just a few minutes.
4
-
5
- The sample plugin allows ChatGPT users to search for repositories using GitHub's search API. The plugin is implemented in TypeScript and uses the [OpenAPI](https://www.openapis.org/) specification to define the plugin's API.
6
-
7
- ![Example conversation in ChatGPT showing the plugin in use](./.assets/example.png)
8
-
9
- ## Get started
10
-
11
- 0. Sign up for [Cloudflare Workers](https://workers.dev). The free tier is more than enough for most use cases.
12
- 1. Install [wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update), the Cloudflare Workers CLI
13
- 2. Clone this project and install dependencies with `npm install`
14
- 3. Run `wrangler login` to login to your Cloudflare account in wrangler
15
- 4. Run `wrangler publish` to publish the plugin to Cloudflare Workers
16
-
17
- ## Usage
18
-
19
- 1. You can configure the `.well-known/ai-plugin.json` route in `index.ts`.
20
- 2. Update the OpenAPI schema in `openapi.ts`.
21
- 3. You can set up any new routes and the associated OpenAPI schema by defining new routes. See `search.ts` for an example.
22
-
23
- ## Deploying to OpenAI's API
24
-
25
- Follow the instructions [in the ChatGPT documentation](https://platform.openai.com/docs/plugins/introduction/plugin-flow) to deploy your plugin and begin using it in ChatGPT.
@@ -1,16 +0,0 @@
1
- {
2
- "name": "cloudflare-workers-chatgpt-plugin-example",
3
- "version": "0.0.1",
4
- "private": true,
5
- "scripts": {
6
- "deploy": "wrangler publish",
7
- "start": "wrangler dev"
8
- },
9
- "dependencies": {
10
- "@cloudflare/itty-router-openapi": "^0.1.2"
11
- },
12
- "devDependencies": {
13
- "@cloudflare/workers-types": "^4.20230404.0",
14
- "wrangler": "^3.0.0"
15
- }
16
- }
@@ -1,33 +0,0 @@
1
- import { OpenAPIRouter } from "@cloudflare/itty-router-openapi";
2
- import { GetSearch } from "./search";
3
-
4
- export const router = OpenAPIRouter({
5
- schema: {
6
- info: {
7
- title: "GitHub Repositories Search API",
8
- description:
9
- "A plugin that allows the user to search for GitHub repositories using ChatGPT",
10
- version: "v0.0.1",
11
- },
12
- },
13
- docs_url: "/",
14
- aiPlugin: {
15
- name_for_human: "GitHub Repositories Search",
16
- name_for_model: "github_repositories_search",
17
- description_for_human: "GitHub Repositories Search plugin for ChatGPT.",
18
- description_for_model:
19
- "GitHub Repositories Search plugin for ChatGPT. You can search for GitHub repositories using this plugin.",
20
- contact_email: "support@example.com",
21
- legal_info_url: "http://www.example.com/legal",
22
- logo_url: "https://workers.cloudflare.com/resources/logo/logo.svg",
23
- },
24
- });
25
-
26
- router.get("/search", GetSearch);
27
-
28
- // 404 for everything else
29
- router.all("*", () => new Response("Not Found.", { status: 404 }));
30
-
31
- export default {
32
- fetch: router.handle,
33
- };
@@ -1,63 +0,0 @@
1
- import {
2
- ApiException,
3
- OpenAPIRoute,
4
- Query,
5
- ValidationError,
6
- } from "@cloudflare/itty-router-openapi";
7
-
8
- export class GetSearch extends OpenAPIRoute {
9
- static schema = {
10
- tags: ["Search"],
11
- summary: "Search repositories by a query parameter",
12
- parameters: {
13
- q: Query(String, {
14
- description: "The query to search for",
15
- default: "cloudflare workers",
16
- }),
17
- },
18
- responses: {
19
- "200": {
20
- schema: {
21
- repos: [
22
- {
23
- name: "itty-router-openapi",
24
- description:
25
- "OpenAPI 3 schema generator and validator for Cloudflare Workers",
26
- stars: "80",
27
- url: "https://github.com/cloudflare/itty-router-openapi",
28
- },
29
- ],
30
- },
31
- },
32
- },
33
- };
34
-
35
- async handle(request: Request, env, ctx, data: Record<string, any>) {
36
- const url = `https://api.github.com/search/repositories?q=${data.q}`;
37
-
38
- const resp = await fetch(url, {
39
- headers: {
40
- Accept: "application/vnd.github.v3+json",
41
- "User-Agent": "RepoAI - Cloudflare Workers ChatGPT Plugin Example",
42
- },
43
- });
44
-
45
- if (!resp.ok) {
46
- return new Response(await resp.text(), { status: 400 });
47
- }
48
-
49
- const json = await resp.json();
50
-
51
- // @ts-ignore
52
- const repos = json.items.map((item: any) => ({
53
- name: item.name,
54
- description: item.description,
55
- stars: item.stargazers_count,
56
- url: item.html_url,
57
- }));
58
-
59
- return {
60
- repos: repos,
61
- };
62
- }
63
- }
@@ -1,3 +0,0 @@
1
- name = "cloudflare-workers-chatgpt-plugin-example"
2
- main = "src/index.ts"
3
- compatibility_date = "2023-04-07"
@@ -1,5 +0,0 @@
1
- {
2
- "printWidth": 140,
3
- "singleQuote": true,
4
- "semi": true
5
- }
@@ -1,14 +0,0 @@
1
- {
2
- "name": "<TBD>",
3
- "version": "0.0.0",
4
- "private": true,
5
- "scripts": {
6
- "deploy": "wrangler publish",
7
- "start": "wrangler dev"
8
- },
9
- "devDependencies": {
10
- "@cloudflare/workers-types": "^4.20230419.0",
11
- "itty-router": "^3.0.12",
12
- "wrangler": "^3.0.0"
13
- }
14
- }
@@ -1,41 +0,0 @@
1
- const ORIGIN_URL = 'https://example.com';
2
- const EXPERIMENTS = [
3
- { name: 'big-button', threshold: 0.5 }, // enable the Big Button experiment for 50% of users
4
- { name: 'new-brand', threshold: 0.1 }, // enable the New Brand experiment for 10% of users
5
- { name: 'new-layout', threshold: 0.02 }, // enable the New Layout experiment for 2% of users
6
- ];
7
-
8
- export default {
9
- async fetch(request, env, ctx) {
10
- const fingerprint = [request.headers.get('cf-connecting-ip'), request.cf?.postalCode]; // add any values you want considered as a fingerprint
11
- const activeExperiments = await getActiveExperiments(fingerprint, EXPERIMENTS);
12
-
13
- // add a data-experiments attribute to the <body> tag
14
- // which can be styled in CSS with a wildcard selector like [data-experiments*="big-button"]
15
- const rewriter = new HTMLRewriter().on('body', {
16
- element(element) {
17
- element.setAttribute('data-experiments', activeExperiments.join(' '));
18
- },
19
- });
20
-
21
- const res = await fetch(ORIGIN_URL, request);
22
-
23
- return rewriter.transform(res);
24
- },
25
- };
26
-
27
- // Get active experiments by hashing a fingerprint
28
- async function getActiveExperiments(fingerprint, experiments) {
29
- const fingerprintHash = await hash('SHA-1', JSON.stringify(fingerprint));
30
- const MAX_UINT8 = 255;
31
- const activeExperiments = experiments.filter((exp, i) => fingerprintHash[i] <= exp.threshold * MAX_UINT8);
32
- return activeExperiments.map((exp) => exp.name);
33
- }
34
-
35
- // Hash a string using the Web Crypto API
36
- async function hash(algorithm, message) {
37
- const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array
38
- const hashBuffer = await crypto.subtle.digest(algorithm, msgUint8); // hash the message
39
- const hashArray = new Uint8Array(hashBuffer); // convert buffer to byte array
40
- return hashArray;
41
- }
@@ -1,23 +0,0 @@
1
- export default {
2
- async fetch(request, env, ctx) {
3
- const url = new URL(request.url);
4
-
5
- const proxyUrl = url.searchParams.get('proxyUrl'); // get a query param value (?proxyUrl=...)
6
- const modify = url.searchParams.has('modify'); // check if a query param is set (?proxyUrl=...&modify)
7
-
8
- if (!proxyUrl) {
9
- return new Response('Bad request: Missing `proxyUrl` query param', { status: 400 });
10
- }
11
-
12
- // make subrequests with the global `fetch()` function
13
- let res = await fetch(proxyUrl, request);
14
-
15
- // optionally, modify the respone
16
- if (modify) {
17
- res = new Response(res.body, res);
18
- res.headers.set('X-My-Header', 'My Header Value');
19
- }
20
-
21
- return res;
22
- },
23
- };
@@ -1,13 +0,0 @@
1
- export default {
2
- async fetch(request, env, ctx) {
3
- const url = new URL(request.url);
4
- const redirectUrl = url.searchParams.get('redirectUrl'); // get a query param value (?redirectUrl=...)
5
-
6
- if (!redirectUrl) {
7
- return new Response('Bad request: Missing `redirectUrl` query param', { status: 400 });
8
- }
9
-
10
- // The Response class has static methods to create common Response objects as a convenience
11
- return Response.redirect(redirectUrl);
12
- },
13
- };
@@ -1,22 +0,0 @@
1
- import { Router } from 'itty-router';
2
-
3
- // now let's create a router (note the lack of "new")
4
- const router = Router();
5
-
6
- // GET collection index
7
- router.get('/api/todos', () => new Response('Todos Index!'));
8
-
9
- // GET item
10
- router.get('/api/todos/:id', ({ params }) => new Response(`Todo #${params.id}`));
11
-
12
- // POST to the collection (we'll use async here)
13
- router.post('/api/todos', async (request) => {
14
- const content = await request.json();
15
-
16
- return new Response('Creating Todo: ' + JSON.stringify(content));
17
- });
18
-
19
- // 404 for everything else
20
- router.all('*', () => new Response('Not Found.', { status: 404 }));
21
-
22
- export default router;
@@ -1,46 +0,0 @@
1
- /**
2
- * Welcome to Cloudflare Workers! This is your first worker.
3
- *
4
- * - Run `npm run dev` in your terminal to start a development server
5
- * - Open a browser tab at http://localhost:8787/ to see your worker in action
6
- * - Run `npm run deploy` to publish your worker
7
- *
8
- * Learn more at https://developers.cloudflare.com/workers/
9
- */
10
-
11
- import handleProxy from './proxy';
12
- import handleRedirect from './redirect';
13
- import apiRouter from './router';
14
-
15
- // Export a default object containing event handlers
16
- export default {
17
- // The fetch handler is invoked when this worker receives a HTTP(S) request
18
- // and should return a Response (optionally wrapped in a Promise)
19
- async fetch(request, env, ctx) {
20
- // You'll find it helpful to parse the request.url string into a URL object. Learn more at https://developer.mozilla.org/en-US/docs/Web/API/URL
21
- const url = new URL(request.url);
22
-
23
- // You can get pretty far with simple logic like if/switch-statements
24
- switch (url.pathname) {
25
- case '/redirect':
26
- return handleRedirect.fetch(request, env, ctx);
27
-
28
- case '/proxy':
29
- return handleProxy.fetch(request, env, ctx);
30
- }
31
-
32
- if (url.pathname.startsWith('/api/')) {
33
- // You can also use more robust routing
34
- return apiRouter.handle(request);
35
- }
36
-
37
- return new Response(
38
- `Try making requests to:
39
- <ul>
40
- <li><code><a href="/redirect?redirectUrl=https://example.com/">/redirect?redirectUrl=https://example.com/</a></code>,</li>
41
- <li><code><a href="/proxy?modify&proxyUrl=https://example.com/">/proxy?modify&proxyUrl=https://example.com/</a></code>, or</li>
42
- <li><code><a href="/api/todos">/api/todos</a></code></li>`,
43
- { headers: { 'Content-Type': 'text/html' } }
44
- );
45
- },
46
- };