@marko/vite 5.0.4 → 5.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 (2) hide show
  1. package/dist/index.mjs +19 -26
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -3,7 +3,6 @@ import * as compiler2 from "@marko/compiler";
3
3
  import fs4 from "fs";
4
4
  import path6 from "path";
5
5
  import crypto from "crypto";
6
- import glob2 from "fast-glob";
7
6
  import anyMatch from "anymatch";
8
7
  import { pathToFileURL } from "url";
9
8
 
@@ -803,7 +802,6 @@ var babelCaller = {
803
802
  supportsTopLevelAwait: true,
804
803
  supportsExportNamespaceFrom: true
805
804
  };
806
- var optimizeKnownTemplatesForRoot = /* @__PURE__ */ new Map();
807
805
  var registeredTagLib = false;
808
806
  var cjsToEsm;
809
807
  function noop2() {
@@ -846,6 +844,7 @@ function markoPlugin(opts = {}) {
846
844
  );
847
845
  const entryIds = /* @__PURE__ */ new Set();
848
846
  const cachedSources = /* @__PURE__ */ new Map();
847
+ const optimizedRegisistyIdMap = /* @__PURE__ */ new Map();
849
848
  const transformWatchFiles = /* @__PURE__ */ new Map();
850
849
  const transformOptionalFiles = /* @__PURE__ */ new Map();
851
850
  const store = new ReadOncePersistedStore(
@@ -875,7 +874,16 @@ function markoPlugin(opts = {}) {
875
874
  runtimeId,
876
875
  sourceMaps: true,
877
876
  writeVersionComment: false,
878
- optimizeKnownTemplates: optimize && linked ? await getKnownTemplates(root) : void 0,
877
+ optimizeRegistryId(id) {
878
+ let registryId = optimizedRegisistyIdMap.get(id);
879
+ if (registryId === void 0) {
880
+ optimizedRegisistyIdMap.set(
881
+ id,
882
+ registryId = optimizedRegisistyIdMap.size
883
+ );
884
+ }
885
+ return registryId;
886
+ },
879
887
  babelConfig: opts.babelConfig ? {
880
888
  ...opts.babelConfig,
881
889
  caller: opts.babelConfig.caller ? {
@@ -1080,7 +1088,6 @@ function markoPlugin(opts = {}) {
1080
1088
  handleHotUpdate(ctx) {
1081
1089
  compiler2.taglib.clearCaches();
1082
1090
  baseConfig.cache.clear();
1083
- optimizeKnownTemplatesForRoot.clear();
1084
1091
  for (const [, cache2] of configsByFileSystem) {
1085
1092
  cache2.clear();
1086
1093
  }
@@ -1095,6 +1102,11 @@ function markoPlugin(opts = {}) {
1095
1102
  try {
1096
1103
  serverManifest = await store.read();
1097
1104
  inputOptions.input = toHTMLEntries(root, serverManifest.entries);
1105
+ if (serverManifest.registered) {
1106
+ for (let i = 0; i < serverManifest.registered.length; i++) {
1107
+ optimizedRegisistyIdMap.set(serverManifest.registered[i], i);
1108
+ }
1109
+ }
1098
1110
  for (const entry in serverManifest.entrySources) {
1099
1111
  const id = normalizePath(path6.resolve(root, entry));
1100
1112
  entryIds.add(id);
@@ -1359,6 +1371,9 @@ if (import.meta.hot) import.meta.hot.accept(() => {});`;
1359
1371
  }
1360
1372
  }
1361
1373
  }
1374
+ if (optimizedRegisistyIdMap.size) {
1375
+ serverManifest.registered = [...optimizedRegisistyIdMap.keys()];
1376
+ }
1362
1377
  store.write(serverManifest);
1363
1378
  } else {
1364
1379
  const browserManifest = {};
@@ -1487,28 +1502,6 @@ function getConfigForFileSystem(info, config) {
1487
1502
  }
1488
1503
  return configForFileSystem;
1489
1504
  }
1490
- function getKnownTemplates(root) {
1491
- let knownTemplates = optimizeKnownTemplatesForRoot.get(root);
1492
- if (!knownTemplates) {
1493
- optimizeKnownTemplatesForRoot.set(
1494
- root,
1495
- knownTemplates = glob2.globSync("**/*.marko", {
1496
- absolute: true,
1497
- cwd: root,
1498
- ignore: [
1499
- "**/*test*/**",
1500
- "**/*example*/**",
1501
- "**/*stories*/**",
1502
- "**/*coverage*/**",
1503
- "**/*snapshots*/**",
1504
- "**/node_modules/**",
1505
- "**/*.d.marko"
1506
- ]
1507
- })
1508
- );
1509
- }
1510
- return knownTemplates;
1511
- }
1512
1505
  export {
1513
1506
  markoPlugin as default
1514
1507
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
3
  "description": "A Marko plugin for Vite",
4
- "version": "5.0.4",
4
+ "version": "5.0.5",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {
@@ -16,15 +16,15 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@changesets/changelog-github": "^0.5.0",
19
- "@changesets/cli": "^2.27.9",
20
- "@marko/compiler": "^5.37.26",
19
+ "@changesets/cli": "^2.27.10",
20
+ "@marko/compiler": "^5.38.0",
21
21
  "@marko/fixture-snapshots": "^2.2.1",
22
22
  "@marko/testing-library": "^6.2.0",
23
23
  "@types/babel__core": "^7.20.5",
24
24
  "@types/diff": "^6.0.0",
25
25
  "@types/jsdom": "^21.1.7",
26
- "@types/mocha": "^10.0.9",
27
- "@types/node": "^22.9.0",
26
+ "@types/mocha": "^10.0.10",
27
+ "@types/node": "^22.9.1",
28
28
  "@types/resolve": "^1.20.6",
29
29
  "@types/serve-handler": "^6.1.4",
30
30
  "@typescript-eslint/eslint-plugin": "^7.11.0",
@@ -39,7 +39,7 @@
39
39
  "jsdom": "^25.0.1",
40
40
  "less": "^4.2.0",
41
41
  "lint-staged": "^15.2.10",
42
- "marko": "^5.35.35",
42
+ "marko": "^5.36.0",
43
43
  "mocha": "^10.8.2",
44
44
  "mocha-snap": "^5.0.0",
45
45
  "nyc": "^17.1.0",
@@ -47,7 +47,7 @@
47
47
  "prettier": "^3.3.3",
48
48
  "serve-handler": "^6.1.6",
49
49
  "tsx": "^4.19.2",
50
- "typescript": "^5.6.3",
50
+ "typescript": "^5.7.2",
51
51
  "vite": "^5.4.11"
52
52
  },
53
53
  "files": [