@marko/vite 4.1.9 → 4.1.11

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 +24 -15
  2. package/package.json +15 -15
package/dist/index.mjs CHANGED
@@ -222,8 +222,7 @@ function serialize(basePath, nodes, preload, parts) {
222
222
  return parts;
223
223
  }
224
224
  function stripBasePath(basePath, path6) {
225
- if (path6.startsWith(basePath))
226
- return path6.slice(basePath.length);
225
+ if (path6.startsWith(basePath)) return path6.slice(basePath.length);
227
226
  return path6;
228
227
  }
229
228
 
@@ -664,6 +663,7 @@ var babelCaller = {
664
663
  supportsTopLevelAwait: true,
665
664
  supportsExportNamespaceFrom: true
666
665
  };
666
+ var optimizedRegistryIds = /* @__PURE__ */ new Map();
667
667
  var registeredTagLib = false;
668
668
  function markoPlugin(opts = {}) {
669
669
  let compiler;
@@ -727,6 +727,7 @@ function markoPlugin(opts = {}) {
727
727
  baseConfig = {
728
728
  cache,
729
729
  optimize,
730
+ optimizedRegistryIds: optimize && linked ? optimizedRegistryIds : void 0,
730
731
  runtimeId,
731
732
  sourceMaps: true,
732
733
  writeVersionComment: false,
@@ -826,6 +827,13 @@ function markoPlugin(opts = {}) {
826
827
  ssr.noExternal = noExternalReg;
827
828
  }
828
829
  }
830
+ if (isSSRBuild && !config.build?.rollupOptions?.output) {
831
+ config.build ??= {};
832
+ config.build.rollupOptions ??= {};
833
+ config.build.rollupOptions.output = {
834
+ chunkFileNames: `[name]-[hash].js`
835
+ };
836
+ }
829
837
  if (basePathVar) {
830
838
  config.experimental ??= {};
831
839
  if (config.experimental.renderBuiltUrl) {
@@ -833,10 +841,6 @@ function markoPlugin(opts = {}) {
833
841
  "Cannot use @marko/vite `basePathVar` with Vite's `renderBuiltUrl` option."
834
842
  );
835
843
  }
836
- if (isSSRBuild && !config.build?.ssrEmitAssets) {
837
- config.build ??= {};
838
- config.build.assetsDir ??= "";
839
- }
840
844
  const assetsDir = config.build?.assetsDir?.replace(/[/\\]$/, "") ?? "assets";
841
845
  const assetsDirLen = assetsDir.length;
842
846
  const assetsDirEnd = assetsDirLen + 1;
@@ -867,7 +871,7 @@ function markoPlugin(opts = {}) {
867
871
  resolve: {
868
872
  alias: [
869
873
  {
870
- find: /^~/,
874
+ find: /^~(?!\/)/,
871
875
  replacement: ""
872
876
  }
873
877
  ]
@@ -942,6 +946,14 @@ function markoPlugin(opts = {}) {
942
946
  if (isBuild && linked && !isSSRBuild) {
943
947
  try {
944
948
  serverManifest = await store.read();
949
+ if (serverManifest.optimizedRegistryIds) {
950
+ for (const id in serverManifest.optimizedRegistryIds) {
951
+ optimizedRegistryIds.set(
952
+ id,
953
+ serverManifest.optimizedRegistryIds[id]
954
+ );
955
+ }
956
+ }
945
957
  inputOptions.input = toHTMLEntries(root, serverManifest.entries);
946
958
  for (const entry in serverManifest.entrySources) {
947
959
  const id = normalizePath(path5.resolve(root, entry));
@@ -997,8 +1009,7 @@ function markoPlugin(opts = {}) {
997
1009
  const resolved = normalizePath(
998
1010
  path5.resolve(importer, "..", importee)
999
1011
  );
1000
- if (resolved === normalizePath(importer))
1001
- return resolved;
1012
+ if (resolved === normalizePath(importer)) return resolved;
1002
1013
  }
1003
1014
  return this.resolve(importee, importer, resolveOpts);
1004
1015
  }
@@ -1179,6 +1190,7 @@ if (import.meta.hot) import.meta.hot.accept(() => {});`;
1179
1190
  }
1180
1191
  }
1181
1192
  }
1193
+ serverManifest.optimizedRegistryIds = Object.fromEntries(optimizedRegistryIds);
1182
1194
  store.write(serverManifest);
1183
1195
  } else {
1184
1196
  const browserManifest = {};
@@ -1282,18 +1294,15 @@ function isEmpty(obj) {
1282
1294
  }
1283
1295
  function stripVersionAndTimeStamp(id) {
1284
1296
  const queryStart = id.indexOf("?");
1285
- if (queryStart === -1)
1286
- return id;
1297
+ if (queryStart === -1) return id;
1287
1298
  const url = id.slice(0, queryStart);
1288
1299
  const query = id.slice(queryStart + 1).replace(/(?:^|[&])[vt]=[^&]+/g, "");
1289
- if (query)
1290
- return `${url}?${query}`;
1300
+ if (query) return `${url}?${query}`;
1291
1301
  return url;
1292
1302
  }
1293
1303
  function getConfigForFileSystem(info, config) {
1294
1304
  const fileSystem = info?.meta.arcFS;
1295
- if (!fileSystem)
1296
- return config;
1305
+ if (!fileSystem) return config;
1297
1306
  let configsForFileSystem = configsByFileSystem.get(fileSystem);
1298
1307
  if (!configsForFileSystem) {
1299
1308
  configsForFileSystem = /* @__PURE__ */ new Map();
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": "4.1.9",
4
+ "version": "4.1.11",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {
@@ -15,37 +15,37 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@changesets/changelog-github": "^0.5.0",
18
- "@changesets/cli": "^2.27.1",
19
- "@marko/compiler": "^5.34.7",
18
+ "@changesets/cli": "^2.27.5",
19
+ "@marko/compiler": "^5.37.0",
20
20
  "@marko/fixture-snapshots": "^2.2.1",
21
21
  "@marko/testing-library": "^6.2.0",
22
22
  "@types/babel__core": "^7.20.5",
23
23
  "@types/jsdom": "^21.1.6",
24
24
  "@types/mocha": "^10.0.6",
25
- "@types/node": "^20.11.20",
25
+ "@types/node": "^20.12.12",
26
26
  "@types/resolve": "^1.20.6",
27
27
  "@types/serve-handler": "^6.1.4",
28
- "@typescript-eslint/eslint-plugin": "^7.1.0",
29
- "@typescript-eslint/parser": "^7.1.0",
28
+ "@typescript-eslint/eslint-plugin": "^7.11.0",
29
+ "@typescript-eslint/parser": "^7.11.0",
30
30
  "cross-env": "^7.0.3",
31
- "esbuild": "^0.20.1",
31
+ "esbuild": "^0.21.4",
32
32
  "eslint": "^8.57.0",
33
33
  "eslint-config-prettier": "^9.1.0",
34
34
  "fixpack": "^4.0.0",
35
35
  "husky": "^9.0.11",
36
- "jsdom": "^24.0.0",
36
+ "jsdom": "^24.1.0",
37
37
  "less": "^4.2.0",
38
- "lint-staged": "^15.2.2",
39
- "marko": "^5.32.13",
40
- "mocha": "^10.3.0",
38
+ "lint-staged": "^15.2.5",
39
+ "marko": "^5.35.0",
40
+ "mocha": "^10.4.0",
41
41
  "mocha-snap": "^5.0.0",
42
42
  "nyc": "^15.1.0",
43
- "playwright": "^1.41.2",
43
+ "playwright": "^1.44.1",
44
44
  "prettier": "^3.2.5",
45
45
  "serve-handler": "^6.1.5",
46
- "tsx": "^4.7.1",
47
- "typescript": "^5.3.3",
48
- "vite": "^5.1.4"
46
+ "tsx": "^4.11.0",
47
+ "typescript": "^5.4.5",
48
+ "vite": "^5.2.12"
49
49
  },
50
50
  "files": [
51
51
  "dist",