@marko/vite 2.0.0 → 2.0.3

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 (59) hide show
  1. package/LICENSE +1 -1
  2. package/dist/chunk-HWRQJHCN.mjs +22 -0
  3. package/dist/chunk-MPTD6LHF.mjs +65 -0
  4. package/dist/chunk-VL2HLMVE.mjs +80 -0
  5. package/dist/chunk-Z64RCGRQ.mjs +74 -0
  6. package/dist/components/vite.marko +34 -0
  7. package/dist/esbuild-plugin.d.ts +3 -0
  8. package/dist/esbuild-plugin.js +97 -0
  9. package/dist/esbuild-plugin.mjs +6 -0
  10. package/dist/{cjs/index.d.ts → index.d.ts} +1 -1
  11. package/dist/index.js +416 -0
  12. package/dist/index.mjs +400 -0
  13. package/dist/{cjs/manifest-generator.d.ts → manifest-generator.d.ts} +0 -0
  14. package/dist/manifest-generator.js +88 -0
  15. package/dist/manifest-generator.mjs +9 -0
  16. package/dist/{cjs/render-assets-transform.d.ts → render-assets-transform.d.ts} +0 -0
  17. package/dist/render-assets-transform.js +34 -0
  18. package/dist/render-assets-transform.mjs +13 -0
  19. package/dist/{cjs/serializer.d.ts → serializer.d.ts} +0 -0
  20. package/dist/serializer.js +100 -0
  21. package/dist/serializer.mjs +6 -0
  22. package/dist/{cjs/server-entry-template.d.ts → server-entry-template.d.ts} +0 -0
  23. package/dist/server-entry-template.js +45 -0
  24. package/dist/server-entry-template.mjs +6 -0
  25. package/package.json +62 -45
  26. package/CHANGELOG.md +0 -72
  27. package/components/vite-watch.marko +0 -31
  28. package/components/vite.marko +0 -31
  29. package/dist/cjs/esbuild-plugin.d.ts +0 -0
  30. package/dist/cjs/esbuild-plugin.js +0 -2
  31. package/dist/cjs/esbuild-plugin.js.map +0 -1
  32. package/dist/cjs/index.js +0 -417
  33. package/dist/cjs/index.js.map +0 -1
  34. package/dist/cjs/manifest-generator.js +0 -63
  35. package/dist/cjs/manifest-generator.js.map +0 -1
  36. package/dist/cjs/render-assets-transform.js +0 -12
  37. package/dist/cjs/render-assets-transform.js.map +0 -1
  38. package/dist/cjs/serializer.js +0 -81
  39. package/dist/cjs/serializer.js.map +0 -1
  40. package/dist/cjs/server-entry-template.js +0 -22
  41. package/dist/cjs/server-entry-template.js.map +0 -1
  42. package/dist/esm/esbuild-plugin.d.ts +0 -0
  43. package/dist/esm/esbuild-plugin.js +0 -2
  44. package/dist/esm/esbuild-plugin.js.map +0 -1
  45. package/dist/esm/index.d.ts +0 -10
  46. package/dist/esm/index.js +0 -413
  47. package/dist/esm/index.js.map +0 -1
  48. package/dist/esm/manifest-generator.d.ts +0 -11
  49. package/dist/esm/manifest-generator.js +0 -57
  50. package/dist/esm/manifest-generator.js.map +0 -1
  51. package/dist/esm/render-assets-transform.d.ts +0 -3
  52. package/dist/esm/render-assets-transform.js +0 -10
  53. package/dist/esm/render-assets-transform.js.map +0 -1
  54. package/dist/esm/serializer.d.ts +0 -2
  55. package/dist/esm/serializer.js +0 -78
  56. package/dist/esm/serializer.js.map +0 -1
  57. package/dist/esm/server-entry-template.d.ts +0 -6
  58. package/dist/esm/server-entry-template.js +0 -19
  59. package/dist/esm/server-entry-template.js.map +0 -1
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var server_entry_template_exports = {};
23
+ __export(server_entry_template_exports, {
24
+ default: () => server_entry_template_default
25
+ });
26
+ module.exports = __toCommonJS(server_entry_template_exports);
27
+ var import_path = __toESM(require("path"));
28
+ var server_entry_template_default = async (opts) => {
29
+ const fileNameStr = JSON.stringify(`./${import_path.default.basename(opts.fileName)}`);
30
+ return `import template from ${fileNameStr};
31
+ export * from ${fileNameStr};
32
+ $ const $global = out.global;
33
+ ${opts.runtimeId ? `$ $global.runtimeId = ${JSON.stringify(opts.runtimeId)};
34
+ ` : ""}$ ($global.___viteEntries || ($global.___viteEntries = [])).push(${opts.entryData});
35
+ <_vite slot="head-prepend"/>
36
+ <_vite slot="head"/>
37
+ <_vite slot="body-prepend"/>
38
+ <\${template} ...input/>
39
+ <init-components/>
40
+ <await-reorderer/>
41
+ <_vite slot="body"/>
42
+ `;
43
+ };
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {});
@@ -0,0 +1,6 @@
1
+ import {
2
+ server_entry_template_default
3
+ } from "./chunk-HWRQJHCN.mjs";
4
+ export {
5
+ server_entry_template_default as default
6
+ };
package/package.json CHANGED
@@ -1,46 +1,60 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
3
  "description": "A Marko plugin for Vite",
4
- "version": "2.0.0",
4
+ "version": "2.0.3",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {
8
8
  "anymatch": "^3.1.2",
9
- "domelementtype": "^2.2.0",
10
- "domhandler": "^4.2.0",
11
- "htmlparser2": "^6.1.0",
12
- "tslib": "^2.3.0"
9
+ "domelementtype": "^2.3.0",
10
+ "domhandler": "^5.0.3",
11
+ "htmlparser2": "^8.0.1",
12
+ "relative-import-path": "^1.0.0"
13
13
  },
14
14
  "devDependencies": {
15
- "@commitlint/cli": "^13.1.0",
16
- "@commitlint/config-conventional": "^13.1.0",
17
- "@marko/compiler": "^5.15.0",
18
- "@types/jest": "^26.0.24",
19
- "@types/jsesc": "^3.0.1",
20
- "@types/node": "^16.4.7",
21
- "@typescript-eslint/eslint-plugin": "^4.28.5",
22
- "@typescript-eslint/parser": "^4.28.5",
23
- "codecov": "^3.8.3",
24
- "eslint": "^7.31.0",
25
- "eslint-config-prettier": "^8.3.0",
26
- "eslint-plugin-jest": "^24.4.0",
27
- "eslint-plugin-prettier": "^3.4.0",
15
+ "@changesets/changelog-github": "^0.4.5",
16
+ "@changesets/cli": "^2.23.1",
17
+ "@marko/compiler": "^5.21.6",
18
+ "@marko/fixture-snapshots": "^2.1.7",
19
+ "@marko/testing-library": "^6.1.2",
20
+ "@types/jsdom": "^16.2.14",
21
+ "@types/mocha": "^9.1.1",
22
+ "@types/node": "^18.0.3",
23
+ "@types/serve-handler": "^6.1.1",
24
+ "@typescript-eslint/eslint-plugin": "^5.30.6",
25
+ "@typescript-eslint/parser": "^5.30.6",
26
+ "cross-env": "^7.0.3",
27
+ "esbuild": "^0.14.49",
28
+ "eslint": "^8.19.0",
29
+ "eslint-config-prettier": "^8.5.0",
30
+ "fast-glob": "^3.2.11",
28
31
  "fixpack": "^4.0.0",
29
- "husky": "^4.3.8",
30
- "jest": "^26.6.3",
31
- "jest-file-snapshot": "0.3.8",
32
- "lint-staged": "^11.1.1",
33
- "marko": "^5.15.0",
34
- "prettier": "^2.3.2",
35
- "standard-version": "^9.3.1",
36
- "ts-jest": "^26.5.4",
37
- "typescript": "^4.3.5",
38
- "vite": "^2.4.4"
32
+ "husky": "^8.0.1",
33
+ "jsdom": "^19.0.0",
34
+ "lint-staged": "^13.0.3",
35
+ "marko": "^5.21.2",
36
+ "mocha": "^10.0.0",
37
+ "mocha-snap": "^4.3.0",
38
+ "nyc": "^15.1.0",
39
+ "playwright": "^1.23.2",
40
+ "prettier": "^2.7.1",
41
+ "serve-handler": "^6.1.3",
42
+ "tsx": "^3.7.1",
43
+ "typescript": "^4.7.4",
44
+ "vite": "3.0.0-beta.10"
45
+ },
46
+ "exports": {
47
+ ".": {
48
+ "import": "./dist/index.mjs",
49
+ "default": "./dist/index.js"
50
+ },
51
+ "./dist/components/vite.marko": "./dist/components/vite.marko",
52
+ "./dist/components/vite-watch.marko": "./dist/components/vite-watch.marko"
39
53
  },
40
54
  "files": [
41
- "components",
42
- "dist/cjs",
43
- "dist/esm"
55
+ "dist",
56
+ "!**/__tests__",
57
+ "!**/*.tsbuildinfo"
44
58
  ],
45
59
  "homepage": "https://github.com/marko-js/vite",
46
60
  "keywords": [
@@ -51,28 +65,31 @@
51
65
  "vite"
52
66
  ],
53
67
  "license": "MIT",
54
- "main": "dist/cjs/index.js",
55
- "module": "dist/esm/index.js",
68
+ "main": "./dist/index.js",
69
+ "module": "./dist/index.mjs",
56
70
  "peerDependencies": {
57
- "@marko/compiler": "^5.15.0",
58
- "vite": "^2.4.4"
71
+ "@marko/compiler": "^5",
72
+ "vite": "^2 || ^3"
59
73
  },
60
74
  "repository": {
61
75
  "type": "git",
62
76
  "url": "https://github.com/marko-js/vite"
63
77
  },
64
78
  "scripts": {
65
- "build": "tsc -b",
66
- "ci:report": "codecov",
67
- "ci:test": "jest --ci --coverage",
79
+ "build": "tsc -b && tsx build.mts",
80
+ "change": "changeset add",
81
+ "ci:test": "nyc npm test -- --forbid-only",
68
82
  "format": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write && (fixpack || true)",
69
- "lint": "npm run build && npm run lint:eslint && npm run lint:prettier -- -l && fixpack",
83
+ "lint": "tsc -b && npm run lint:eslint && npm run lint:prettier -- -l && fixpack",
70
84
  "lint:eslint": "eslint -f visualstudio .",
71
- "lint:prettier": "prettier \"**/*{.ts,.js,.json,.md,.yml,rc}\"",
72
- "prepublishOnly": "npm run build",
73
- "release": "standard-version",
74
- "test": "jest --watch",
75
- "test:inspect": "node --inspect=0.0.0.0 $(which jest) --watch --runInBand --testTimeout 99999999"
85
+ "lint:prettier": "prettier \"./**/*{.ts,.js,.json,.md,.yml,rc}\"",
86
+ "prepare": "husky install",
87
+ "release": "npm run build && changeset publish",
88
+ "report": "open ./coverage/lcov-report/index.html",
89
+ "test": "cross-env NODE_ENV=test mocha \"./src/**/__tests__/*.test.ts\"",
90
+ "test:inspect": "npm test -- --inspect",
91
+ "test:update": "npm test -- --update",
92
+ "version": "changeset version && npm i --package-lock-only"
76
93
  },
77
- "types": "dist/esm/index.d.ts"
94
+ "types": "dist/index.d.ts"
78
95
  }
package/CHANGELOG.md DELETED
@@ -1,72 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ## [2.0.0](https://github.com/marko-js/vite/compare/v1.3.2...v2.0.0) (2021-07-30)
6
-
7
-
8
- ### ⚠ BREAKING CHANGES
9
-
10
- * requires a minimum Marko peer version of `^5.15.0`
11
-
12
- ### Features
13
-
14
- * improve support for loading Marko files from node_modules ([c9d189f](https://github.com/marko-js/vite/commit/c9d189f48333aa04f6e997d80cce86afc86bead2))
15
-
16
- ### [1.3.2](https://github.com/marko-js/vite/compare/v1.3.1...v1.3.2) (2021-05-18)
17
-
18
-
19
- ### Bug Fixes
20
-
21
- * issue with resolving nested entry paths ([e0b2dd4](https://github.com/marko-js/vite/commit/e0b2dd4a08ccc719782d19645e9385071369e2e6))
22
-
23
- ### [1.3.1](https://github.com/marko-js/vite/compare/v1.3.0...v1.3.1) (2021-05-03)
24
-
25
-
26
- ### Bug Fixes
27
-
28
- * issue with loading missing virtual file in build mode ([493466e](https://github.com/marko-js/vite/commit/493466e0c08e012ef831f1adcf38a994d975dd27))
29
-
30
- ## [1.3.0](https://github.com/marko-js/vite/compare/v1.2.1...v1.3.0) (2021-05-03)
31
-
32
-
33
- ### Features
34
-
35
- * handle adding/removing optional related files ([5756ad2](https://github.com/marko-js/vite/commit/5756ad224b6397630e4d936128bc4a9968cdcac0))
36
-
37
- ### [1.2.1](https://github.com/marko-js/vite/compare/v1.2.0...v1.2.1) (2021-04-30)
38
-
39
-
40
- ### Bug Fixes
41
-
42
- * issue with common ids across multiple templates for entry files ([7633c9b](https://github.com/marko-js/vite/commit/7633c9bbf6198bb1ae33e86fc382ca8c4163d54f))
43
-
44
- ## 1.2.0 (2021-04-30)
45
-
46
-
47
- ### Features
48
-
49
- * enable hmr ([8d3fca7](https://github.com/marko-js/vite/commit/8d3fca71b29c22cbf08f1b3d264f25b69fc4b670))
50
- * initial release ([c4c1747](https://github.com/marko-js/vite/commit/c4c17471260fc8c1ea0640198fefd946a66a75be))
51
-
52
-
53
- ### Bug Fixes
54
-
55
- * invalid entry id output in windows ([cbe9696](https://github.com/marko-js/vite/commit/cbe9696ca79d79a9d0541a61e61b82a9e1fa85eb))
56
-
57
- ## 1.1.0 (2021-04-28)
58
-
59
- ### Bug Fixes
60
-
61
- * invalid entry id output in windows ([8db353f](https://github.com/marko-js/vite/commit/8db353f8d986df076dc89c2f23490f549d092330))
62
-
63
- ## 1.0.0 (2021-04-24)
64
-
65
-
66
- ### Features
67
-
68
- * initial commit ([9204a9d](https://github.com/marko-js/vite/commit/9204a9d5112429d7b835caf431c46a32a2939776))
69
-
70
- # Changelog
71
-
72
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
@@ -1,31 +0,0 @@
1
- static function renderAssets(out, slot) {
2
- const entries = this.___viteEntries;
3
-
4
- if (entries) {
5
- const slotWrittenEntriesKey = `___viteWrittenEntries-${slot}`;
6
- const lastWrittenEntry = this[slotWrittenEntriesKey] || 0;
7
- const writtenEntries = this[slotWrittenEntriesKey] = entries.length;
8
- let html = "";
9
-
10
- for (let i = lastWrittenEntry; i < writtenEntries; i++) {
11
- const slotParts = entries[i][slot];
12
- const slotHtml = slotParts && slotParts.join(this.___viteInjectAttrs);
13
-
14
- if (slotHtml) {
15
- html += slotHtml;
16
- }
17
- }
18
-
19
- out.write(html);
20
- }
21
- }
22
-
23
- $ const $global = out.global;
24
- $ if (!$global.___viteRenderAssets) {
25
- $global.___viteInjectAttrs = $global.cspNonce ? ` nonce="${$global.cspNonce.replace(/"/g, "&#39;")}"` : "";
26
- $global.___viteRenderAssets = renderAssets;
27
- }
28
-
29
- <__flush_here_and_after__>
30
- $ $global.___viteRenderAssets(out, input.slot);
31
- </>
@@ -1,31 +0,0 @@
1
- static function renderAssets(out, slot) {
2
- const entries = this.___viteEntries;
3
-
4
- if (entries) {
5
- const slotWrittenEntriesKey = `___viteWrittenEntries-${slot}`;
6
- const lastWrittenEntry = this[slotWrittenEntriesKey] || 0;
7
- const writtenEntries = this[slotWrittenEntriesKey] = entries.length;
8
- let html = "";
9
-
10
- for (let i = lastWrittenEntry; i < writtenEntries; i++) {
11
- const manifest = __MARKO_MANIFEST__[entries[i]];
12
- const slotHtml = manifest && manifest[slot] && manifest[slot].join(this.___viteInjectAttrs);
13
-
14
- if (slotHtml) {
15
- html += slotHtml;
16
- }
17
- }
18
-
19
- out.write(html);
20
- }
21
- }
22
-
23
- $ const $global = out.global;
24
- $ if (!$global.___viteRenderAssets) {
25
- $global.___viteInjectAttrs = $global.cspNonce ? ` nonce="${$global.cspNonce.replace(/"/g, "&#39;")}"` : "";
26
- $global.___viteRenderAssets = renderAssets;
27
- }
28
-
29
- <__flush_here_and_after__>
30
- $ $global.___viteRenderAssets(out, input.slot);
31
- </>
File without changes
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=esbuild-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"esbuild-plugin.js","sourceRoot":"","sources":["../../src/esbuild-plugin.ts"],"names":[],"mappings":""}