@quilted/deno 0.1.2 → 0.2.1

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 (81) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/build/esm/craft.mjs +11 -91
  3. package/build/esnext/craft.esnext +10 -93
  4. package/build/esnext/request-router.esnext +2 -7
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/build/typescript/craft.d.ts +16 -11
  7. package/build/typescript/craft.d.ts.map +1 -1
  8. package/configuration/rollup.config.js +3 -0
  9. package/package.json +13 -12
  10. package/source/craft.ts +28 -116
  11. package/tsconfig.json +2 -2
  12. package/build/cjs/craft.cjs +0 -106
  13. package/build/cjs/index.cjs +0 -2
  14. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.cjs +0 -168
  15. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.cjs +0 -8
  16. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsAnd/commaListsAnd.cjs +0 -8
  17. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsOr/commaListsOr.cjs +0 -8
  18. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/html/html.cjs +0 -10
  19. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.cjs +0 -48
  20. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.cjs +0 -8
  21. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLine/oneLine.cjs +0 -7
  22. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.cjs +0 -8
  23. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.cjs +0 -8
  24. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.cjs +0 -8
  25. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.cjs +0 -8
  26. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineTrim/oneLineTrim.cjs +0 -7
  27. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.cjs +0 -23
  28. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.cjs +0 -22
  29. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.cjs +0 -22
  30. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/safeHtml/safeHtml.cjs +0 -10
  31. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.cjs +0 -20
  32. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.cjs +0 -11
  33. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.cjs +0 -37
  34. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.cjs +0 -7
  35. package/build/cjs/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.cjs +0 -33
  36. package/build/cjs/request-router.cjs +0 -17
  37. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.mjs +0 -164
  38. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.mjs +0 -6
  39. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsAnd/commaListsAnd.mjs +0 -6
  40. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsOr/commaListsOr.mjs +0 -6
  41. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/html/html.mjs +0 -8
  42. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.mjs +0 -44
  43. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.mjs +0 -6
  44. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLine/oneLine.mjs +0 -5
  45. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.mjs +0 -6
  46. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.mjs +0 -6
  47. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.mjs +0 -6
  48. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.mjs +0 -6
  49. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineTrim/oneLineTrim.mjs +0 -5
  50. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.mjs +0 -19
  51. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.mjs +0 -18
  52. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.mjs +0 -18
  53. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/safeHtml/safeHtml.mjs +0 -8
  54. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.mjs +0 -16
  55. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.mjs +0 -7
  56. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.mjs +0 -33
  57. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.mjs +0 -5
  58. package/build/esm/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.mjs +0 -29
  59. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.esnext +0 -164
  60. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.esnext +0 -6
  61. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsAnd/commaListsAnd.esnext +0 -6
  62. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsOr/commaListsOr.esnext +0 -6
  63. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/html/html.esnext +0 -8
  64. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.esnext +0 -44
  65. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.esnext +0 -6
  66. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLine/oneLine.esnext +0 -5
  67. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.esnext +0 -6
  68. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.esnext +0 -6
  69. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.esnext +0 -6
  70. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.esnext +0 -6
  71. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineTrim/oneLineTrim.esnext +0 -5
  72. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.esnext +0 -19
  73. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.esnext +0 -18
  74. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.esnext +0 -18
  75. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/safeHtml/safeHtml.esnext +0 -8
  76. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.esnext +0 -16
  77. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.esnext +0 -7
  78. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.esnext +0 -33
  79. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.esnext +0 -5
  80. package/build/esnext/node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.esnext +0 -29
  81. package/quilt.project.ts +0 -5
@@ -1,13 +1,18 @@
1
- export interface Options {
1
+ export interface DenoRuntimeOptions {
2
+ /**
3
+ * The port that the server will listen on when it runs.
4
+ *
5
+ * If you do not provide a value, the server will listen for
6
+ * requests on the port specified by `Deno.env.get('PORT')`.
7
+ */
8
+ port?: number | string;
9
+ /**
10
+ * The host that the server will listen on when it runs.
11
+ */
12
+ host?: string;
2
13
  }
3
- export interface DenoDevelopHooks {
4
- }
5
- declare module '@quilted/craft/kit' {
6
- interface DevelopProjectConfigurationHooks extends DenoDevelopHooks {
7
- }
8
- }
9
- /**
10
- * Configures any code generated for this project to run on Deno.
11
- */
12
- export declare function deno(_?: Options): import("@quilted/craft/kit").ProjectPlugin;
14
+ export declare function deno({ port, host }: DenoRuntimeOptions): {
15
+ env: string;
16
+ requestRouter(): string;
17
+ };
13
18
  //# sourceMappingURL=craft.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"craft.d.ts","sourceRoot":"","sources":["../../source/craft.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,OAAO;CAAG;AAE3B,MAAM,WAAW,gBAAgB;CAAG;AAEpC,OAAO,QAAQ,oBAAoB,CAAC;IAClC,UAAU,gCAAiC,SAAQ,gBAAgB;KAAG;CACvE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,GAAE,OAAY,8CAsBnC"}
1
+ {"version":3,"file":"craft.d.ts","sourceRoot":"","sources":["../../source/craft.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,IAAI,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC,EAAE,kBAAkB;;;EAkBpD"}
@@ -0,0 +1,3 @@
1
+ import {quiltPackage} from '@quilted/rollup/package';
2
+
3
+ export default quiltPackage();
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "access": "public",
7
7
  "@quilted/registry": "https://registry.npmjs.org"
8
8
  },
9
- "version": "0.1.2",
9
+ "version": "0.2.1",
10
10
  "engines": {
11
11
  "node": ">=14.0.0"
12
12
  },
@@ -20,22 +20,19 @@
20
20
  "types": "./build/typescript/index.d.ts",
21
21
  "quilt:source": "./source/index.ts",
22
22
  "quilt:esnext": "./build/esnext/index.esnext",
23
- "import": "./build/esm/index.mjs",
24
- "require": "./build/cjs/index.cjs"
23
+ "import": "./build/esm/index.mjs"
25
24
  },
26
25
  "./craft": {
27
26
  "types": "./build/typescript/craft.d.ts",
28
27
  "quilt:source": "./source/craft.ts",
29
28
  "quilt:esnext": "./build/esnext/craft.esnext",
30
- "import": "./build/esm/craft.mjs",
31
- "require": "./build/cjs/craft.cjs"
29
+ "import": "./build/esm/craft.mjs"
32
30
  },
33
31
  "./request-router": {
34
32
  "types": "./build/typescript/request-router.d.ts",
35
33
  "quilt:source": "./source/request-router.tsx",
36
34
  "quilt:esnext": "./build/esnext/request-router.esnext",
37
- "import": "./build/esm/request-router.mjs",
38
- "require": "./build/cjs/request-router.cjs"
35
+ "import": "./build/esm/request-router.mjs"
39
36
  }
40
37
  },
41
38
  "types": "./build/typescript/index.d.ts",
@@ -54,8 +51,8 @@
54
51
  "@types/common-tags": "^1.8.0"
55
52
  },
56
53
  "peerDependencies": {
57
- "@quilted/quilt": "^0.5.153",
58
- "@quilted/craft": "^0.1.233"
54
+ "@quilted/craft": "^0.2.0",
55
+ "@quilted/quilt": "^0.6.0"
59
56
  },
60
57
  "peerDependenciesMeta": {
61
58
  "@quilted/craft": {
@@ -66,7 +63,8 @@
66
63
  }
67
64
  },
68
65
  "devDependencies": {
69
- "@quilted/testing": "^0.1.0"
66
+ "@quilted/craft": "0.2.4",
67
+ "@quilted/quilt": "0.6.6"
70
68
  },
71
69
  "eslintConfig": {
72
70
  "extends": [
@@ -74,6 +72,9 @@
74
72
  ]
75
73
  },
76
74
  "browserslist": [
77
- "extends @quilted/browserslist-config/defaults"
78
- ]
75
+ "defaults and not dead"
76
+ ],
77
+ "scripts": {
78
+ "build": "rollup --config configuration/rollup.config.js"
79
+ }
79
80
  }
package/source/craft.ts CHANGED
@@ -1,128 +1,40 @@
1
- import {stripIndent} from 'common-tags';
2
-
3
- import {createProjectPlugin, MAGIC_MODULE_REQUEST_ROUTER} from '@quilted/craft';
4
- import type {
5
- Project,
6
- BuildProjectOptions,
7
- DevelopProjectOptions,
8
- ResolvedBuildProjectConfigurationHooks,
9
- ResolvedDevelopProjectConfigurationHooks,
10
- } from '@quilted/craft/kit';
11
- import type {PolyfillFeature} from '@quilted/craft/polyfills';
12
- import type {} from '@quilted/craft/browserslist';
13
-
14
- export interface Options {}
15
-
16
- export interface DenoDevelopHooks {}
17
-
18
- declare module '@quilted/craft/kit' {
19
- interface DevelopProjectConfigurationHooks extends DenoDevelopHooks {}
20
- }
21
-
22
- /**
23
- * Configures any code generated for this project to run on Deno.
24
- */
25
- export function deno(_: Options = {}) {
26
- return createProjectPlugin({
27
- name: 'Quilt.Deno',
28
- build({project, configure}) {
29
- configure(
30
- addConfiguration({
31
- project,
32
- mode: 'production',
33
- }),
34
- );
35
- },
36
- // develop({project, configure, hooks}) {
37
- // hooks<DenoDevelopHooks>(() => ({}));
38
-
39
- // configure(
40
- // addConfiguration({
41
- // project,
42
- // mode: 'development',
43
- // }),
44
- // );
45
- // },
46
- });
1
+ import {
2
+ multiline,
3
+ MAGIC_MODULE_REQUEST_ROUTER,
4
+ type ServerRuntime,
5
+ } from '@quilted/craft/rollup';
6
+
7
+ export interface DenoRuntimeOptions {
8
+ /**
9
+ * The port that the server will listen on when it runs.
10
+ *
11
+ * If you do not provide a value, the server will listen for
12
+ * requests on the port specified by `Deno.env.get('PORT')`.
13
+ */
14
+ port?: number | string;
15
+
16
+ /**
17
+ * The host that the server will listen on when it runs.
18
+ */
19
+ host?: string;
47
20
  }
48
21
 
49
- function addConfiguration({mode}: {mode: string; project: Project}) {
50
- return (
51
- {
52
- runtimes,
53
- browserslistTargets,
54
- rollupPlugins,
55
- rollupNodeBundle,
56
- quiltRequestRouterPort,
57
- quiltRequestRouterHost,
58
- quiltServiceOutputFormat,
59
- quiltAppServerOutputFormat,
60
- quiltRequestRouterRuntimeContent,
61
- quiltPolyfillFeaturesForEnvironment,
62
- quiltRuntimeEnvironmentVariables,
63
- }: Partial<
64
- ResolvedBuildProjectConfigurationHooks &
65
- ResolvedDevelopProjectConfigurationHooks
66
- >,
67
- options: Partial<BuildProjectOptions & DevelopProjectOptions>,
68
- ) => {
69
- if (!options.quiltAppServer && !options.quiltService) {
70
- return;
71
- }
72
-
73
- runtimes?.(() => [{target: 'deno'}]);
74
-
75
- browserslistTargets?.(() => ['last 1 chrome version']);
76
-
77
- rollupPlugins?.(async (plugins) => {
78
- const {rollupReplaceProcessEnv} = await import('@quilted/craft/rollup');
79
-
80
- return [
81
- ...plugins,
82
- await rollupReplaceProcessEnv({mode, preserve: false}),
83
- ];
84
- });
85
-
86
- rollupNodeBundle?.(() => true);
87
-
88
- quiltRuntimeEnvironmentVariables?.(() => `Deno.env.toObject()`);
89
-
90
- quiltServiceOutputFormat?.(() => 'module');
91
- quiltAppServerOutputFormat?.(() => 'module');
92
-
93
- const polyfillsWithNativeWorkersSupport = new Set<PolyfillFeature>([
94
- 'crypto',
95
- 'fetch',
96
- 'abort-controller',
97
- ]);
98
-
99
- quiltPolyfillFeaturesForEnvironment?.((features) => {
100
- return features.filter(
101
- (feature) => !polyfillsWithNativeWorkersSupport.has(feature),
102
- );
103
- });
104
-
105
- // @see https://deno.land/api@v1.37.0?s=Deno.ServeOptions
106
- quiltRequestRouterRuntimeContent?.(async () => {
107
- const [port, host] = await Promise.all([
108
- quiltRequestRouterPort!.run(undefined),
109
- quiltRequestRouterHost!.run(undefined),
110
- ]);
111
-
112
- return stripIndent`
22
+ export function deno({port, host}: DenoRuntimeOptions) {
23
+ return {
24
+ env: 'Deno.env.toObject()',
25
+ requestRouter() {
26
+ return multiline`
113
27
  import {createServeHandler} from '@quilted/deno/request-router';
114
- import RequestRouter from ${JSON.stringify(
115
- MAGIC_MODULE_REQUEST_ROUTER,
116
- )};
28
+ import router from ${JSON.stringify(MAGIC_MODULE_REQUEST_ROUTER)};
117
29
 
118
30
  const port = ${
119
31
  port ?? `Number.parseInt(Deno.env.get('PORT') ?? '8080', 10)`
120
32
  };
121
33
  const hostname = ${host ? JSON.stringify(host) : 'undefined'};
122
- const handleRequest = createServeHandler(RequestRouter);
34
+ const handleRequest = createServeHandler(router);
123
35
 
124
36
  Deno.serve({port, hostname}, handleRequest);
125
37
  `;
126
- });
127
- };
38
+ },
39
+ } satisfies ServerRuntime;
128
40
  }
package/tsconfig.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "extends": "@quilted/typescript/project.json",
2
+ "extends": "@quilted/craft/typescript/project.json",
3
3
  "compilerOptions": {
4
4
  "rootDir": "source",
5
5
  "outDir": "build/typescript"
6
6
  },
7
7
  "include": ["source"],
8
- "exclude": ["quilt.project.ts", "**/*.test.ts", "**/*.test.tsx"],
8
+ "exclude": ["**/*.test.ts", "**/*.test.tsx"],
9
9
  "references": [
10
10
  {"path": "../../packages/craft"},
11
11
  {"path": "../../packages/quilt"}
@@ -1,106 +0,0 @@
1
- 'use strict';
2
-
3
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.cjs');
4
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.cjs');
5
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsAnd/commaListsAnd.cjs');
6
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsOr/commaListsOr.cjs');
7
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/html/html.cjs');
8
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/safeHtml/safeHtml.cjs');
9
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLine/oneLine.cjs');
10
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineTrim/oneLineTrim.cjs');
11
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.cjs');
12
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.cjs');
13
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.cjs');
14
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.cjs');
15
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.cjs');
16
- var stripIndent = require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.cjs');
17
- require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.cjs');
18
- var craft = require('@quilted/craft');
19
-
20
- /**
21
- * Configures any code generated for this project to run on Deno.
22
- */
23
- function deno(_ = {}) {
24
- return craft.createProjectPlugin({
25
- name: 'Quilt.Deno',
26
- build({
27
- project,
28
- configure
29
- }) {
30
- configure(addConfiguration({
31
- project,
32
- mode: 'production'
33
- }));
34
- }
35
- // develop({project, configure, hooks}) {
36
- // hooks<DenoDevelopHooks>(() => ({}));
37
-
38
- // configure(
39
- // addConfiguration({
40
- // project,
41
- // mode: 'development',
42
- // }),
43
- // );
44
- // },
45
- });
46
- }
47
-
48
- function addConfiguration({
49
- mode
50
- }) {
51
- return ({
52
- runtimes,
53
- browserslistTargets,
54
- rollupPlugins,
55
- rollupNodeBundle,
56
- quiltRequestRouterPort,
57
- quiltRequestRouterHost,
58
- quiltServiceOutputFormat,
59
- quiltAppServerOutputFormat,
60
- quiltRequestRouterRuntimeContent,
61
- quiltPolyfillFeaturesForEnvironment,
62
- quiltRuntimeEnvironmentVariables
63
- }, options) => {
64
- if (!options.quiltAppServer && !options.quiltService) {
65
- return;
66
- }
67
- runtimes?.(() => [{
68
- target: 'deno'
69
- }]);
70
- browserslistTargets?.(() => ['last 1 chrome version']);
71
- rollupPlugins?.(async plugins => {
72
- const {
73
- rollupReplaceProcessEnv
74
- } = await import('@quilted/craft/rollup');
75
- return [...plugins, await rollupReplaceProcessEnv({
76
- mode,
77
- preserve: false
78
- })];
79
- });
80
- rollupNodeBundle?.(() => true);
81
- quiltRuntimeEnvironmentVariables?.(() => `Deno.env.toObject()`);
82
- quiltServiceOutputFormat?.(() => 'module');
83
- quiltAppServerOutputFormat?.(() => 'module');
84
- const polyfillsWithNativeWorkersSupport = new Set(['crypto', 'fetch', 'abort-controller']);
85
- quiltPolyfillFeaturesForEnvironment?.(features => {
86
- return features.filter(feature => !polyfillsWithNativeWorkersSupport.has(feature));
87
- });
88
-
89
- // @see https://deno.land/api@v1.37.0?s=Deno.ServeOptions
90
- quiltRequestRouterRuntimeContent?.(async () => {
91
- const [port, host] = await Promise.all([quiltRequestRouterPort.run(undefined), quiltRequestRouterHost.run(undefined)]);
92
- return stripIndent["default"]`
93
- import {createServeHandler} from '@quilted/deno/request-router';
94
- import RequestRouter from ${JSON.stringify(craft.MAGIC_MODULE_REQUEST_ROUTER)};
95
-
96
- const port = ${port ?? `Number.parseInt(Deno.env.get('PORT') ?? '8080', 10)`};
97
- const hostname = ${host ? JSON.stringify(host) : 'undefined'};
98
- const handleRequest = createServeHandler(RequestRouter);
99
-
100
- Deno.serve({port, hostname}, handleRequest);
101
- `;
102
- });
103
- };
104
- }
105
-
106
- exports.deno = deno;
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1,168 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
6
-
7
- var _templateObject = _taggedTemplateLiteral(['', ''], ['', '']);
8
-
9
- function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
10
-
11
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
-
13
- /**
14
- * @class TemplateTag
15
- * @classdesc Consumes a pipeline of composable transformer plugins and produces a template tag.
16
- */
17
- var TemplateTag = function () {
18
- /**
19
- * constructs a template tag
20
- * @constructs TemplateTag
21
- * @param {...Object} [...transformers] - an array or arguments list of transformers
22
- * @return {Function} - a template tag
23
- */
24
- function TemplateTag() {
25
- var _this = this;
26
-
27
- for (var _len = arguments.length, transformers = Array(_len), _key = 0; _key < _len; _key++) {
28
- transformers[_key] = arguments[_key];
29
- }
30
-
31
- _classCallCheck(this, TemplateTag);
32
-
33
- this.tag = function (strings) {
34
- for (var _len2 = arguments.length, expressions = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
35
- expressions[_key2 - 1] = arguments[_key2];
36
- }
37
-
38
- if (typeof strings === 'function') {
39
- // if the first argument passed is a function, assume it is a template tag and return
40
- // an intermediary tag that processes the template using the aforementioned tag, passing the
41
- // result to our tag
42
- return _this.interimTag.bind(_this, strings);
43
- }
44
-
45
- if (typeof strings === 'string') {
46
- // if the first argument passed is a string, just transform it
47
- return _this.transformEndResult(strings);
48
- }
49
-
50
- // else, return a transformed end result of processing the template with our tag
51
- strings = strings.map(_this.transformString.bind(_this));
52
- return _this.transformEndResult(strings.reduce(_this.processSubstitutions.bind(_this, expressions)));
53
- };
54
-
55
- // if first argument is an array, extrude it as a list of transformers
56
- if (transformers.length > 0 && Array.isArray(transformers[0])) {
57
- transformers = transformers[0];
58
- }
59
-
60
- // if any transformers are functions, this means they are not initiated - automatically initiate them
61
- this.transformers = transformers.map(function (transformer) {
62
- return typeof transformer === 'function' ? transformer() : transformer;
63
- });
64
-
65
- // return an ES2015 template tag
66
- return this.tag;
67
- }
68
-
69
- /**
70
- * Applies all transformers to a template literal tagged with this method.
71
- * If a function is passed as the first argument, assumes the function is a template tag
72
- * and applies it to the template, returning a template tag.
73
- * @param {(Function|String|Array<String>)} strings - Either a template tag or an array containing template strings separated by identifier
74
- * @param {...*} ...expressions - Optional list of substitution values.
75
- * @return {(String|Function)} - Either an intermediary tag function or the results of processing the template.
76
- */
77
-
78
-
79
- _createClass(TemplateTag, [{
80
- key: 'interimTag',
81
-
82
-
83
- /**
84
- * An intermediary template tag that receives a template tag and passes the result of calling the template with the received
85
- * template tag to our own template tag.
86
- * @param {Function} nextTag - the received template tag
87
- * @param {Array<String>} template - the template to process
88
- * @param {...*} ...substitutions - `substitutions` is an array of all substitutions in the template
89
- * @return {*} - the final processed value
90
- */
91
- value: function interimTag(previousTag, template) {
92
- for (var _len3 = arguments.length, substitutions = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
93
- substitutions[_key3 - 2] = arguments[_key3];
94
- }
95
-
96
- return this.tag(_templateObject, previousTag.apply(undefined, [template].concat(substitutions)));
97
- }
98
-
99
- /**
100
- * Performs bulk processing on the tagged template, transforming each substitution and then
101
- * concatenating the resulting values into a string.
102
- * @param {Array<*>} substitutions - an array of all remaining substitutions present in this template
103
- * @param {String} resultSoFar - this iteration's result string so far
104
- * @param {String} remainingPart - the template chunk after the current substitution
105
- * @return {String} - the result of joining this iteration's processed substitution with the result
106
- */
107
-
108
- }, {
109
- key: 'processSubstitutions',
110
- value: function processSubstitutions(substitutions, resultSoFar, remainingPart) {
111
- var substitution = this.transformSubstitution(substitutions.shift(), resultSoFar);
112
- return ''.concat(resultSoFar, substitution, remainingPart);
113
- }
114
-
115
- /**
116
- * Iterate through each transformer, applying the transformer's `onString` method to the template
117
- * strings before all substitutions are processed.
118
- * @param {String} str - The input string
119
- * @return {String} - The final results of processing each transformer
120
- */
121
-
122
- }, {
123
- key: 'transformString',
124
- value: function transformString(str) {
125
- var cb = function cb(res, transform) {
126
- return transform.onString ? transform.onString(res) : res;
127
- };
128
- return this.transformers.reduce(cb, str);
129
- }
130
-
131
- /**
132
- * When a substitution is encountered, iterates through each transformer and applies the transformer's
133
- * `onSubstitution` method to the substitution.
134
- * @param {*} substitution - The current substitution
135
- * @param {String} resultSoFar - The result up to and excluding this substitution.
136
- * @return {*} - The final result of applying all substitution transformations.
137
- */
138
-
139
- }, {
140
- key: 'transformSubstitution',
141
- value: function transformSubstitution(substitution, resultSoFar) {
142
- var cb = function cb(res, transform) {
143
- return transform.onSubstitution ? transform.onSubstitution(res, resultSoFar) : res;
144
- };
145
- return this.transformers.reduce(cb, substitution);
146
- }
147
-
148
- /**
149
- * Iterates through each transformer, applying the transformer's `onEndResult` method to the
150
- * template literal after all substitutions have finished processing.
151
- * @param {String} endResult - The processed template, just before it is returned from the tag
152
- * @return {String} - The final results of processing each transformer
153
- */
154
-
155
- }, {
156
- key: 'transformEndResult',
157
- value: function transformEndResult(endResult) {
158
- var cb = function cb(res, transform) {
159
- return transform.onEndResult ? transform.onEndResult(res) : res;
160
- };
161
- return this.transformers.reduce(cb, endResult);
162
- }
163
- }]);
164
-
165
- return TemplateTag;
166
- }();
167
-
168
- exports["default"] = TemplateTag;
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- var TemplateTag = require('../TemplateTag/TemplateTag.cjs');
4
- var stripIndentTransformer = require('../stripIndentTransformer/stripIndentTransformer.cjs');
5
- var inlineArrayTransformer = require('../inlineArrayTransformer/inlineArrayTransformer.cjs');
6
- var trimResultTransformer = require('../trimResultTransformer/trimResultTransformer.cjs');
7
-
8
- new TemplateTag["default"](inlineArrayTransformer["default"]({ separator: ',' }), stripIndentTransformer["default"], trimResultTransformer["default"]);
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- var TemplateTag = require('../TemplateTag/TemplateTag.cjs');
4
- var stripIndentTransformer = require('../stripIndentTransformer/stripIndentTransformer.cjs');
5
- var inlineArrayTransformer = require('../inlineArrayTransformer/inlineArrayTransformer.cjs');
6
- var trimResultTransformer = require('../trimResultTransformer/trimResultTransformer.cjs');
7
-
8
- new TemplateTag["default"](inlineArrayTransformer["default"]({ separator: ',', conjunction: 'and' }), stripIndentTransformer["default"], trimResultTransformer["default"]);
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- var TemplateTag = require('../TemplateTag/TemplateTag.cjs');
4
- var stripIndentTransformer = require('../stripIndentTransformer/stripIndentTransformer.cjs');
5
- var inlineArrayTransformer = require('../inlineArrayTransformer/inlineArrayTransformer.cjs');
6
- var trimResultTransformer = require('../trimResultTransformer/trimResultTransformer.cjs');
7
-
8
- new TemplateTag["default"](inlineArrayTransformer["default"]({ separator: ',', conjunction: 'or' }), stripIndentTransformer["default"], trimResultTransformer["default"]);
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- var TemplateTag = require('../TemplateTag/TemplateTag.cjs');
4
- var stripIndentTransformer = require('../stripIndentTransformer/stripIndentTransformer.cjs');
5
- var inlineArrayTransformer = require('../inlineArrayTransformer/inlineArrayTransformer.cjs');
6
- var trimResultTransformer = require('../trimResultTransformer/trimResultTransformer.cjs');
7
- var splitStringTransformer = require('../splitStringTransformer/splitStringTransformer.cjs');
8
- var removeNonPrintingValuesTransformer = require('../removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.cjs');
9
-
10
- new TemplateTag["default"](splitStringTransformer["default"]('\n'), removeNonPrintingValuesTransformer["default"], inlineArrayTransformer["default"], stripIndentTransformer["default"], trimResultTransformer["default"]);
@@ -1,48 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var defaults = {
6
- separator: '',
7
- conjunction: '',
8
- serial: false
9
- };
10
-
11
- /**
12
- * Converts an array substitution to a string containing a list
13
- * @param {String} [opts.separator = ''] - the character that separates each item
14
- * @param {String} [opts.conjunction = ''] - replace the last separator with this
15
- * @param {Boolean} [opts.serial = false] - include the separator before the conjunction? (Oxford comma use-case)
16
- *
17
- * @return {Object} - a TemplateTag transformer
18
- */
19
- var inlineArrayTransformer = function inlineArrayTransformer() {
20
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaults;
21
- return {
22
- onSubstitution: function onSubstitution(substitution, resultSoFar) {
23
- // only operate on arrays
24
- if (Array.isArray(substitution)) {
25
- var arrayLength = substitution.length;
26
- var separator = opts.separator;
27
- var conjunction = opts.conjunction;
28
- var serial = opts.serial;
29
- // join each item in the array into a string where each item is separated by separator
30
- // be sure to maintain indentation
31
- var indent = resultSoFar.match(/(\n?[^\S\n]+)$/);
32
- if (indent) {
33
- substitution = substitution.join(separator + indent[1]);
34
- } else {
35
- substitution = substitution.join(separator + ' ');
36
- }
37
- // if conjunction is set, replace the last separator with conjunction, but only if there is more than one substitution
38
- if (conjunction && arrayLength > 1) {
39
- var separatorIndex = substitution.lastIndexOf(separator);
40
- substitution = substitution.slice(0, separatorIndex) + (serial ? separator : '') + ' ' + conjunction + substitution.slice(separatorIndex + 1);
41
- }
42
- }
43
- return substitution;
44
- }
45
- };
46
- };
47
-
48
- exports["default"] = inlineArrayTransformer;
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- var TemplateTag = require('../TemplateTag/TemplateTag.cjs');
4
- var stripIndentTransformer = require('../stripIndentTransformer/stripIndentTransformer.cjs');
5
- var inlineArrayTransformer = require('../inlineArrayTransformer/inlineArrayTransformer.cjs');
6
- var trimResultTransformer = require('../trimResultTransformer/trimResultTransformer.cjs');
7
-
8
- new TemplateTag["default"](inlineArrayTransformer["default"], stripIndentTransformer["default"], trimResultTransformer["default"]);