edge-functions 1.0.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/.eslintrc.json +60 -15
  2. package/.github/workflows/major.yml +1 -1
  3. package/.github/workflows/minor.yml +1 -2
  4. package/README.md +36 -0
  5. package/aliases.js +1 -1
  6. package/docs/overview.md +4 -3
  7. package/docs/presets.md +18 -6
  8. package/examples/angular-static/package.json +0 -1
  9. package/examples/simple-js-esm/main.js +13 -8
  10. package/examples/simple-js-esm-node/index.js +45 -0
  11. package/examples/simple-ts-esm/main.ts +24 -0
  12. package/examples/simple-ts-esm/messages.ts +11 -0
  13. package/examples/simple-ts-esm/package.json +9 -0
  14. package/examples/simple-ts-esm/tsconfig.json +109 -0
  15. package/examples/simple-ts-esm/yarn.lock +8 -0
  16. package/examples/vue-vite-static/README.md +29 -0
  17. package/examples/vue-vite-static/index.html +13 -0
  18. package/examples/vue-vite-static/package.json +18 -0
  19. package/examples/vue-vite-static/public/favicon.ico +0 -0
  20. package/examples/vue-vite-static/src/App.vue +85 -0
  21. package/examples/vue-vite-static/src/assets/base.css +73 -0
  22. package/examples/vue-vite-static/src/assets/logo.svg +1 -0
  23. package/examples/vue-vite-static/src/assets/main.css +35 -0
  24. package/examples/vue-vite-static/src/components/HelloWorld.vue +44 -0
  25. package/examples/vue-vite-static/src/components/TheWelcome.vue +86 -0
  26. package/examples/vue-vite-static/src/components/WelcomeItem.vue +86 -0
  27. package/examples/vue-vite-static/src/components/icons/IconCommunity.vue +7 -0
  28. package/examples/vue-vite-static/src/components/icons/IconDocumentation.vue +7 -0
  29. package/examples/vue-vite-static/src/components/icons/IconEcosystem.vue +7 -0
  30. package/examples/vue-vite-static/src/components/icons/IconSupport.vue +7 -0
  31. package/examples/vue-vite-static/src/components/icons/IconTooling.vue +19 -0
  32. package/examples/vue-vite-static/src/main.js +11 -0
  33. package/examples/vue-vite-static/src/router/index.js +23 -0
  34. package/examples/vue-vite-static/src/views/AboutView.vue +15 -0
  35. package/examples/vue-vite-static/src/views/HomeView.vue +9 -0
  36. package/examples/vue-vite-static/vite.config.js +16 -0
  37. package/jsconfig.json +1 -1
  38. package/lib/build/bundlers/esbuild/esbuild.config.js +12 -0
  39. package/lib/build/bundlers/esbuild/index.js +46 -0
  40. package/lib/build/bundlers/esbuild/plugins/node-polyfills/index.js +147 -0
  41. package/lib/build/bundlers/esbuild/plugins/node-polyfills/node-polyfills-paths.js +124 -0
  42. package/lib/build/bundlers/index.js +2 -2
  43. package/lib/build/bundlers/webpack/index.js +16 -7
  44. package/lib/build/bundlers/webpack/webpack.config.js +5 -25
  45. package/lib/build/dispatcher/dispatcher.js +116 -66
  46. package/lib/constants/framework-initializer.constants.js +51 -0
  47. package/lib/constants/index.js +4 -1
  48. package/lib/constants/messages/build.messages.js +2 -0
  49. package/lib/constants/messages/env.messages.js +5 -3
  50. package/lib/constants/messages/global.messages.js +4 -1
  51. package/lib/env/polyfills/FetchEvent.polyfills.js +13 -0
  52. package/lib/env/polyfills/fetch.polyfills.js +39 -0
  53. package/lib/env/polyfills/index.js +4 -0
  54. package/lib/env/runtime.env.js +57 -63
  55. package/lib/env/server.env.js +32 -76
  56. package/lib/main.js +234 -90
  57. package/lib/notations/namespaces.js +5 -0
  58. package/lib/platform/actions/core/auth.actions.js +1 -1
  59. package/lib/platform/actions/core/propagation.actions.js +8 -5
  60. package/lib/platform/actions/core/storage.actions.js +1 -1
  61. package/lib/platform/actions/function/showFunctionLogs.actions.js +71 -92
  62. package/lib/platform/edgehooks/debugRequest/debugRequest.hooks.js +28 -0
  63. package/lib/platform/edgehooks/debugRequest/index.js +3 -0
  64. package/lib/platform/edgehooks/index.js +4 -1
  65. package/lib/polyfills/FetchEvent.polyfills.js +13 -0
  66. package/lib/polyfills/fetch.polyfills.js +39 -0
  67. package/lib/polyfills/index.js +4 -0
  68. package/lib/presets/custom/angular/deliver/config.js +2 -4
  69. package/lib/presets/custom/angular/deliver/handler.js +12 -5
  70. package/lib/presets/custom/angular/deliver/prebuild.js +8 -11
  71. package/lib/presets/custom/astro/deliver/config.js +2 -4
  72. package/lib/presets/custom/astro/deliver/handler.js +14 -7
  73. package/lib/presets/custom/astro/deliver/prebuild.js +18 -21
  74. package/lib/presets/custom/hexo/deliver/config.js +2 -4
  75. package/lib/presets/custom/hexo/deliver/handler.js +13 -6
  76. package/lib/presets/custom/hexo/deliver/prebuild.js +18 -21
  77. package/lib/presets/custom/next/deliver/config.js +2 -6
  78. package/lib/presets/custom/next/deliver/handler.js +14 -7
  79. package/lib/presets/custom/next/deliver/prebuild.js +37 -40
  80. package/lib/presets/custom/react/deliver/config.js +2 -4
  81. package/lib/presets/custom/react/deliver/handler.js +10 -3
  82. package/lib/presets/custom/react/deliver/prebuild.js +4 -7
  83. package/lib/presets/custom/vue/deliver/config.js +2 -4
  84. package/lib/presets/custom/vue/deliver/handler.js +10 -3
  85. package/lib/presets/custom/vue/deliver/prebuild.js +66 -10
  86. package/lib/presets/default/html/deliver/config.js +1 -4
  87. package/lib/presets/default/html/deliver/handler.js +14 -7
  88. package/lib/presets/default/html/deliver/prebuild.js +3 -2
  89. package/lib/presets/default/javascript/compute/config.js +2 -5
  90. package/lib/presets/default/javascript/compute/handler.js +15 -4
  91. package/lib/presets/default/javascript/compute/prebuild.js +2 -1
  92. package/lib/presets/default/typescript/compute/config.js +10 -0
  93. package/lib/presets/default/typescript/compute/handler.js +16 -0
  94. package/lib/presets/default/typescript/compute/prebuild.js +7 -0
  95. package/lib/providers/azion/worker.js +6 -2
  96. package/lib/utils/exec/exec.utils.js +34 -23
  97. package/lib/utils/feedback/feedback.utils.js +6 -2
  98. package/lib/utils/getAbsoluteLibDirPath/getAbsoluteLibDirPath.utils.js +11 -2
  99. package/lib/utils/getVulcanBuildId/getVulcanBuildId.utils.js +1 -1
  100. package/lib/utils/index.js +4 -2
  101. package/lib/utils/overrideStaticOutputPath/overrideStaticOutputPath.utils.js +2 -2
  102. package/lib/utils/presets/index.js +3 -0
  103. package/lib/utils/presets/presets.utils.js +169 -0
  104. package/lib/utils/spinner/index.js +3 -0
  105. package/lib/utils/spinner/spinner.utils.js +32 -0
  106. package/package.json +17 -4
  107. package/examples/hexo-static/yarn.lock +0 -1625
  108. package/lib/build/polyfills/index.js +0 -0
  109. package/lib/utils/getPresetsList/getPresetsList.utils.js +0 -50
  110. package/lib/utils/getPresetsList/index.js +0 -3
  111. /package/lib/utils/{getPresetsList/getPresetsList.utils.test.js → presets/presets.utils.test.js} +0 -0
package/.eslintrc.json CHANGED
@@ -4,7 +4,10 @@
4
4
  "es2021": true,
5
5
  "jest/globals": true
6
6
  },
7
- "plugins": ["jsdoc", "jest"],
7
+ "plugins": [
8
+ "jsdoc",
9
+ "jest"
10
+ ],
8
11
  "extends": [
9
12
  "airbnb-base",
10
13
  "plugin:jsdoc/recommended",
@@ -19,24 +22,66 @@
19
22
  "import/resolver": {
20
23
  "alias": {
21
24
  "map": [
22
- ["#root/*", "./"],
23
- ["#lib/*", "./lib"],
24
- ["#utils", "./lib/utils/index.js"],
25
- ["#polyfills", "./lib/build/polyfills/index.js"],
26
- ["#build", "./lib/build/dispatcher/index.js"],
27
- ["#bundlers", "./lib/build/bundlers/index.js"],
28
- ["#notations/*", "./lib/notations"],
29
- ["#env", "./lib/env/index.js"],
30
- ["#platform", "./lib/platform/index.js"],
31
- ["#constants", "./lib/constants/index.js"],
32
- ["#edge", "./lib/platform/edgehooks/index.js"]
25
+ [
26
+ "#root/*",
27
+ "./"
28
+ ],
29
+ [
30
+ "#lib/*",
31
+ "./lib"
32
+ ],
33
+ [
34
+ "#utils",
35
+ "./lib/utils/index.js"
36
+ ],
37
+ [
38
+ "#polyfills",
39
+ "./lib/env/polyfills/index.js"
40
+ ],
41
+ [
42
+ "#build",
43
+ "./lib/build/dispatcher/index.js"
44
+ ],
45
+ [
46
+ "#bundlers",
47
+ "./lib/build/bundlers/index.js"
48
+ ],
49
+ [
50
+ "#notations/*",
51
+ "./lib/notations"
52
+ ],
53
+ [
54
+ "#env",
55
+ "./lib/env/index.js"
56
+ ],
57
+ [
58
+ "#platform",
59
+ "./lib/platform/index.js"
60
+ ],
61
+ [
62
+ "#constants",
63
+ "./lib/constants/index.js"
64
+ ],
65
+ [
66
+ "#edge",
67
+ "./lib/platform/edgehooks/index.js"
68
+ ]
33
69
  ],
34
- "extensions": [".js", ".json"]
70
+ "extensions": [
71
+ ".js",
72
+ ".json"
73
+ ]
35
74
  }
36
75
  }
37
76
  },
38
77
  "rules": {
39
- "import/extensions": ["error", "always"],
78
+ "import/extensions": [
79
+ "error",
80
+ "always"
81
+ ],
40
82
  "no-console": "off"
83
+ },
84
+ "globals": {
85
+ "AZION_VERSION_ID": "readonly"
41
86
  }
42
- }
87
+ }
@@ -25,4 +25,4 @@ jobs:
25
25
  - name: Create Release
26
26
  env:
27
27
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
28
- run: npx semantic-release -e ./releaserc.json
28
+ run: npx semantic-release -e ./releaserc.jsong
@@ -1,8 +1,7 @@
1
1
  name: Release (Minor/Patch)
2
2
 
3
3
  on:
4
- pull_request:
5
- types: [closed]
4
+ push:
6
5
  branches:
7
6
  - dev
8
7
  jobs:
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
 
2
2
  # Vulcan - Forging The Edge
3
+ ![vulcan](https://github.com/aziontech/vulcan/assets/12740219/a5043e6f-11cb-4498-a300-5bdb617a9989)
4
+
3
5
 
4
6
  Vulcan is a powerful tool designed to streamline the development and deployment of JavaScript applications and frameworks. This powerful utility automates polyfills for Edge Computing, significantly simplifying the process of creating Workers, particularly for the Azion platform.
5
7
 
@@ -45,6 +47,40 @@ Follow these steps to start using Vulcan:
45
47
 
46
48
  5. Start developing: Once the project is set up, you can start developing your JavaScript applications or frameworks using the power of Vulcan. Leverage the automated polyfills, Worker creation assistance, and other features provided by Vulcan to enhance your development workflow.
47
49
 
50
+ ## Using Vulcan
51
+
52
+ See some examples below:
53
+
54
+ * Build a JavaScript/Node project (back-end)
55
+
56
+ ```shell
57
+ vulcan build
58
+ ```
59
+
60
+ * Build a TypeScript/Node (back-end)
61
+
62
+ ```shell
63
+ vulcan build --preset typescript
64
+ ```
65
+
66
+ * Build a Static Next.js project
67
+
68
+ ```shell
69
+ vulcan build --preset next --mode deliver
70
+ ```
71
+
72
+ * Build a Static Astro.js project
73
+
74
+ ```shell
75
+ vulcan build --preset astro --mode deliver
76
+ ```
77
+
78
+ * Test your project locally (after build)
79
+
80
+ ```shell
81
+ vulcan dev
82
+ ```
83
+
48
84
 
49
85
  ## Docs
50
86
  * [Overview](docs/overview.md)
package/aliases.js CHANGED
@@ -2,7 +2,7 @@ export default [
2
2
  ['#root/*', './'],
3
3
  ['#lib/*', './lib'],
4
4
  ['#utils', './lib/utils/index.js'],
5
- ['#polyfills', './lib/build/polyfills/index.js'],
5
+ ['#polyfills', './lib/env/polyfills/index.js'],
6
6
  ['#build', './lib/build/dispatcher/index.js'],
7
7
  ['#bundlers', './lib/build/bundlers/index.js'],
8
8
  ['#notations/*', './lib/notations'],
package/docs/overview.md CHANGED
@@ -31,6 +31,7 @@ Polyfills can be used to generate the worker(s) file(s).
31
31
  Some configs can be passed to the builder but if user tries to override `azion worker configs` this passed configs will be ignored.
32
32
 
33
33
  ### Artifacts
34
- Files generated to run in azion structure:
35
- * js worker(s);
36
- * Storage assets files;
34
+ The **'.edge'** folder will be generated representing the edge locally. Files generated to run on the infrastructure:
35
+ * JS worker(s) => '.edge/workers.js';
36
+ * Assets => '.edge/storage/*';
37
+ * Environment variables => '.edge/.env'.
package/docs/presets.md CHANGED
@@ -9,8 +9,9 @@ Vulcan is an extensible platform that allows you to easily create new presets fo
9
9
  To add a new preset, you need to create appropriate folders in two directories: `presets/default` or `presets/custom`. The folder representing your framework or library will automatically be included in the preset listings. Each preset has two modes, represented by folders of the same name: `compute` and `deliver`.
10
10
 
11
11
 
12
+ https://github.com/aziontech/vulcan/assets/12740219/84c7d7a1-4167-4e7e-993f-41a6eb653758
13
+
12
14
 
13
- https://github.com/aziontech/vulcan/assets/12740219/06edb9a0-26cd-4055-bd2e-d400b6a06f3c
14
15
 
15
16
 
16
17
 
@@ -35,7 +36,7 @@ Each preset is made up of three primary files: `config.js`, `prebuild.js`, and `
35
36
 
36
37
  - `getPackageManager`: This method returns the package manager relative to the user's project (can be yarn, npm, or pnpm).
37
38
 
38
- - `copyDirectory`: This function is used to copy the resulting static files from the framework build to the local Edge environment (.edge/statics).
39
+ - `copyDirectory`: This function is used to copy the resulting static files from the framework build to the local Edge environment (.edge/storage).
39
40
 
40
41
  - `feedback`: This interface is used to display messages during the process, if necessary, or in case of error.
41
42
 
@@ -54,7 +55,18 @@ Each preset is made up of three primary files: `config.js`, `prebuild.js`, and `
54
55
 
55
56
  Here's a step-by-step guide on how to add a new preset in Vulcan:
56
57
 
57
- 1. ## **Create a folder inside `./lib/presets/custom`:**
58
+ ## **Use the command to automatic creation:**
59
+
60
+ vulcan presets create
61
+
62
+ https://github.com/aziontech/vulcan/assets/12740219/9ca7371e-713a-4b29-a99b-c1a18d28bc67
63
+
64
+
65
+
66
+ ### Or do it manually:
67
+
68
+
69
+ ## 1. **Create a folder inside `./lib/presets/custom`:**
58
70
  https://github.com/aziontech/vulcan/assets/12740219/abb1b2cc-5f74-473d-b731-c0b7157cb95e
59
71
 
60
72
  - The name of this folder should represent the name of your framework or library.
@@ -65,7 +77,7 @@ Here's a step-by-step guide on how to add a new preset in Vulcan:
65
77
 
66
78
  - **Deliver**: This mode should be used when you intend to use the worker only for routing requests and delivering static files that will be computed on the client side.
67
79
 
68
- 3. ## **Create the following files in your preset's folder:**
80
+ 2. ## **Create the following files in your preset's folder:**
69
81
 
70
82
  ## handler.js
71
83
  This file contains the code that is executed within the worker in the edge function. Essentially, it is the code that runs directly on the edge. In the context of the `deliver` mode, this may simply act as a router. However, in cases where computation is needed, it can be designed to perform more complex tasks. Remember, the capabilities of your handler.js are dependent on your use case and the mode of operation you've chosen for your preset.
@@ -83,7 +95,7 @@ Here's a step-by-step guide on how to add a new preset in Vulcan:
83
95
  This file serves as an extension to the edge build. It enables the inclusion of polyfills, plugins, or any other procedures that relate to the build process executed on the edge. Although it is editable, we strongly advise against making changes to this file unless absolutely necessary. It's designed to ensure optimal operation, and modifications should be undertaken with careful consideration.
84
96
 
85
97
  ## prebuild.js
86
- In this file, you should adapt the native build process of your framework or library. Usually, in the case of *deliver* presets, this file will be used to ensure that the generated static artifacts are placed in the *.edge/statics/* directory.
98
+ In this file, you should adapt the native build process of your framework or library. Usually, in the case of *deliver* presets, this file will be used to ensure that the generated static artifacts are placed in the *.edge/storage/* directory.
87
99
  #### React (deliver) Example:
88
100
 
89
101
  ![prebuild](https://github.com/aziontech/vulcan/assets/12740219/85adc374-220b-4003-8c3e-6ec5b06a483f)
@@ -112,4 +124,4 @@ For `deliver` mode:
112
124
 
113
125
  vulcan build --preset <name> --mode deliver
114
126
 
115
- Replace `<name>` with the name of your preset. This will initiate Vulcan's build process for your preset, allowing you to verify its functionality.
127
+ Replace `<name>` with the name of your preset. This will initiate Vulcan's build process for your preset, allowing you to verify its functionality.
@@ -27,7 +27,6 @@
27
27
  "@angular/cli": "~16.1.3",
28
28
  "@angular/compiler-cli": "^16.1.0",
29
29
  "@types/jasmine": "~4.3.0",
30
- "edge-functions": "^0.0.1",
31
30
  "jasmine-core": "~4.6.0",
32
31
  "karma": "~6.4.0",
33
32
  "karma-chrome-launcher": "~3.2.0",
@@ -4,11 +4,16 @@ import messages from './messages.js';
4
4
 
5
5
  const message = messages[Math.floor(Math.random() * messages.length)];
6
6
 
7
- console.log('selected message:', message);
8
-
9
- return new Response(message, {
10
- headers: new Headers([
11
- ["X-Custom-Feat", "my random message"],
12
- ]),
13
- status: 200,
14
- });
7
+ function main(event) {
8
+ console.log('selected message:', message);
9
+ console.log('VERSION_ID =', AZION_VERSION_ID);
10
+
11
+ return new Response(message, {
12
+ headers: new Headers([
13
+ ["X-Custom-Feat", "my random message"],
14
+ ]),
15
+ status: 200,
16
+ });
17
+ }
18
+
19
+ /* eslint-enable */
@@ -0,0 +1,45 @@
1
+ import { Buffer } from 'buffer';
2
+
3
+ /**
4
+ * Buffer use examples
5
+ */
6
+ function buffeExamples() {
7
+ const buffer1 = Buffer.alloc(10);
8
+ const buffer2 = Buffer.from([1, 2, 3]);
9
+ const buffer3 = Buffer.from('Hello, world!', 'utf-8');
10
+
11
+ console.log(buffer1); // Output: <Buffer 00 00 00 00 00 00 00 00 00 00>
12
+ console.log(buffer2); // Output: <Buffer 01 02 03>
13
+ console.log(buffer3.toString()); // Output: "Hello, world!"
14
+
15
+ buffer1.write('Hello', 'utf-8');
16
+ console.log(buffer1.toString()); // Output: "Hello"
17
+
18
+ buffer1[5] = 33;
19
+ console.log(buffer1); // Output: <Buffer 48 65 6c 6c 6f 21>
20
+
21
+ const combinedBuffer = Buffer.concat([buffer1, buffer2]);
22
+ console.log(combinedBuffer.toString()); // Output: "Hello, world!♡"
23
+
24
+ const slicedBuffer = buffer3.slice(0, 5);
25
+ console.log(slicedBuffer.toString()); // Output: "Hello"
26
+
27
+ console.log(buffer1.length); // Output: 10
28
+ console.log(buffer1.equals(buffer2)); // Output: false
29
+
30
+ const json = JSON.stringify(buffer3);
31
+ // Output: {"type":"Buffer","data":[72,101,108,108,111,44,32,119,111,114,108,100,33]}
32
+ console.log(json);
33
+
34
+ const parsedJson = JSON.parse(json, (key, value) => (value && value.type === 'Buffer' ? Buffer.from(value.data) : value));
35
+ console.log(parsedJson.toString()); // Output: "Hello, world!"
36
+ }
37
+
38
+ // eslint-disable-next-line
39
+ function main(event) {
40
+ buffeExamples();
41
+
42
+ return new Response('Hello!', {
43
+ status: 200,
44
+ });
45
+ }
@@ -0,0 +1,24 @@
1
+ /* eslint-disable */
2
+ declare const AZION_VERSION_ID: string;
3
+
4
+ import getMessages from "./messages.js";
5
+
6
+ function getRandomMessage(messages: string[]): string {
7
+ const randomIndex: number = Math.floor(Math.random() * messages.length);
8
+
9
+ return messages[randomIndex];
10
+ }
11
+
12
+ function main(event: any) {
13
+ const messages = getMessages();
14
+ const message = getRandomMessage(messages);
15
+
16
+ console.log("selected message:", message);
17
+ console.log("VERSION_ID =", AZION_VERSION_ID);
18
+
19
+ return new Response(message, {
20
+ headers: new Headers([["X-Custom-Feat", "my random message"]]),
21
+ status: 200,
22
+ });
23
+ }
24
+ /* eslint-enable */
@@ -0,0 +1,11 @@
1
+ function getMessages(): string[] {
2
+ return [
3
+ "Even the smallest person can change the course of the future. — Galadriel",
4
+ "Not all those who wander are lost. — Bilbo Baggins",
5
+ "Despair is only for those who see the end beyond all doubt. We do not. — Gandalf",
6
+ "All we have to decide is what to do with the time that is given us. — Gandalf",
7
+ "You are the luckiest, the canniest, and the most reckless man I ever knew. – Gimli",
8
+ ];
9
+ }
10
+
11
+ export default getMessages;
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "simple-ts-esm",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "license": "MIT",
6
+ "devDependencies": {
7
+ "typescript": "^5.1.6"
8
+ }
9
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
+
27
+ /* Modules */
28
+ "module": "ES2022" /* Specify what module code is generated. */,
29
+ // "rootDir": "./", /* Specify the root folder within your source files. */
30
+ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42
+ // "resolveJsonModule": true, /* Enable importing .json files. */
43
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
+
46
+ /* JavaScript Support */
47
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
+
51
+ /* Emit */
52
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
59
+ // "removeComments": true, /* Disable emitting comments. */
60
+ // "noEmit": true, /* Disable emitting files from a compilation. */
61
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
66
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
67
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
68
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
69
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
70
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
72
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75
+
76
+ /* Interop Constraints */
77
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
81
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
83
+
84
+ /* Type Checking */
85
+ "strict": true /* Enable all strict type-checking options. */,
86
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
89
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
90
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
91
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
92
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
93
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
94
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
95
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
96
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
97
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
98
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
99
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
100
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104
+
105
+ /* Completeness */
106
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
108
+ }
109
+ }
@@ -0,0 +1,8 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ typescript@^5.1.6:
6
+ version "5.1.6"
7
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
8
+ integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==
@@ -0,0 +1,29 @@
1
+ # vue-vite-static
2
+
3
+ This template should help get you started developing with Vue 3 in Vite.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8
+
9
+ ## Customize configuration
10
+
11
+ See [Vite Configuration Reference](https://vitejs.dev/config/).
12
+
13
+ ## Project Setup
14
+
15
+ ```sh
16
+ npm install
17
+ ```
18
+
19
+ ### Compile and Hot-Reload for Development
20
+
21
+ ```sh
22
+ npm run dev
23
+ ```
24
+
25
+ ### Compile and Minify for Production
26
+
27
+ ```sh
28
+ npm run build
29
+ ```
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" href="/favicon.ico">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Vite App</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.js"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "vue-vite-static",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "vite build",
8
+ "preview": "vite preview"
9
+ },
10
+ "dependencies": {
11
+ "vue": "^3.3.4",
12
+ "vue-router": "^4.2.4"
13
+ },
14
+ "devDependencies": {
15
+ "@vitejs/plugin-vue": "^4.2.3",
16
+ "vite": "^4.4.6"
17
+ }
18
+ }
@@ -0,0 +1,85 @@
1
+ <script setup>
2
+ import { RouterLink, RouterView } from 'vue-router'
3
+ import HelloWorld from './components/HelloWorld.vue'
4
+ </script>
5
+
6
+ <template>
7
+ <header>
8
+ <img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
9
+
10
+ <div class="wrapper">
11
+ <HelloWorld msg="You did it!" />
12
+
13
+ <nav>
14
+ <RouterLink to="/">Home</RouterLink>
15
+ <RouterLink to="/about">About</RouterLink>
16
+ </nav>
17
+ </div>
18
+ </header>
19
+
20
+ <RouterView />
21
+ </template>
22
+
23
+ <style scoped>
24
+ header {
25
+ line-height: 1.5;
26
+ max-height: 100vh;
27
+ }
28
+
29
+ .logo {
30
+ display: block;
31
+ margin: 0 auto 2rem;
32
+ }
33
+
34
+ nav {
35
+ width: 100%;
36
+ font-size: 12px;
37
+ text-align: center;
38
+ margin-top: 2rem;
39
+ }
40
+
41
+ nav a.router-link-exact-active {
42
+ color: var(--color-text);
43
+ }
44
+
45
+ nav a.router-link-exact-active:hover {
46
+ background-color: transparent;
47
+ }
48
+
49
+ nav a {
50
+ display: inline-block;
51
+ padding: 0 1rem;
52
+ border-left: 1px solid var(--color-border);
53
+ }
54
+
55
+ nav a:first-of-type {
56
+ border: 0;
57
+ }
58
+
59
+ @media (min-width: 1024px) {
60
+ header {
61
+ display: flex;
62
+ place-items: center;
63
+ padding-right: calc(var(--section-gap) / 2);
64
+ }
65
+
66
+ .logo {
67
+ margin: 0 2rem 0 0;
68
+ }
69
+
70
+ header .wrapper {
71
+ display: flex;
72
+ place-items: flex-start;
73
+ flex-wrap: wrap;
74
+ }
75
+
76
+ nav {
77
+ text-align: left;
78
+ margin-left: -1rem;
79
+ font-size: 1rem;
80
+
81
+ padding: 1rem 0;
82
+ margin-top: 1rem;
83
+ }
84
+ }
85
+ </style>