@marko/vite 3.1.4 → 3.1.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.
@@ -0,0 +1,31 @@
1
+ import type { PluginObj } from "@babel/core";
2
+ /**
3
+ * This plugin is designed to transform imports within Marko files to interop between ESM and CJS.
4
+ * In Node, ESM files cannot reliably use named imports and default imports from CJS files.
5
+ * Additionally, modules which are transpiled from ESM to CJS will use a `__esModule` property to
6
+ * signal that the consuming ESM code should treat `exports.default` as the default import.
7
+ * This plugin only modifies imports it determined to be for CJS modules
8
+ *
9
+ * Examples
10
+ * 1. Source: ```import { bar as baz } from 'foo';```
11
+ * Becomes:```
12
+ * import _foo from 'foo';
13
+ * const { bar: baz } = _foo
14
+ * ```
15
+ *
16
+ * 2. Source: ```import myFoo from 'foo';```
17
+ * Becomes: ```
18
+ * import * as _myFoo from 'foo';
19
+ * const myFoo = _myFoo?.__esModule ? _myFoo.default : _myFoo;
20
+ * ```
21
+ *
22
+ * 3. Source: ```import foo, * as nsFoo from 'foo';```
23
+ * Becomes: ```
24
+ * import nsFoo from 'foo';
25
+ * const myFoo = nsFoo?.__esModule ? nsFoo.default : nsFoo
26
+ * ```
27
+ */
28
+ export default function plugin(options: {
29
+ extensions: string[];
30
+ conditions: string[];
31
+ }): PluginObj;
@@ -0,0 +1,117 @@
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(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var babel_plugin_cjs_interop_exports = {};
30
+ __export(babel_plugin_cjs_interop_exports, {
31
+ default: () => plugin
32
+ });
33
+ module.exports = __toCommonJS(babel_plugin_cjs_interop_exports);
34
+ var t = __toESM(require("@babel/types"));
35
+ var import_resolve = require("./resolve");
36
+ function plugin(options) {
37
+ return {
38
+ name: "marko-import-interop",
39
+ visitor: {
40
+ ImportDeclaration(path) {
41
+ if (!path.node.specifiers.length || /\.(?:mjs|marko)$|\?/.test(path.node.source.value)) {
42
+ return;
43
+ }
44
+ try {
45
+ const resolved = (0, import_resolve.resolve)(
46
+ path.node.source.value,
47
+ path.hub.file.opts.filename,
48
+ options.extensions,
49
+ options.conditions
50
+ );
51
+ if (!/\.c?js$/.test(resolved) || !(0, import_resolve.isCJSModule)(resolved)) {
52
+ return;
53
+ }
54
+ } catch (_) {
55
+ return;
56
+ }
57
+ let namespaceId;
58
+ let defaultImportId;
59
+ let imports;
60
+ for (const s of path.node.specifiers) {
61
+ if (t.isImportSpecifier(s)) {
62
+ (imports || (imports = [])).push({
63
+ name: t.isStringLiteral(s.imported) ? s.imported.value : s.imported.name,
64
+ alias: s.local.name
65
+ });
66
+ } else if (t.isImportDefaultSpecifier(s)) {
67
+ defaultImportId = s.local;
68
+ } else if (t.isImportNamespaceSpecifier(s)) {
69
+ namespaceId = s.local;
70
+ }
71
+ }
72
+ namespaceId || (namespaceId = path.scope.generateUidIdentifier(
73
+ (defaultImportId == null ? void 0 : defaultImportId.name) || path.node.source.value
74
+ ));
75
+ path.node.specifiers = [t.importDefaultSpecifier(namespaceId)];
76
+ if (defaultImportId) {
77
+ path.insertAfter(
78
+ t.variableDeclaration("const", [
79
+ t.variableDeclarator(
80
+ defaultImportId,
81
+ t.conditionalExpression(
82
+ t.optionalMemberExpression(
83
+ namespaceId,
84
+ t.identifier("__esModule"),
85
+ false,
86
+ true
87
+ ),
88
+ t.memberExpression(namespaceId, t.identifier("default")),
89
+ namespaceId
90
+ )
91
+ )
92
+ ])
93
+ );
94
+ }
95
+ if (imports) {
96
+ path.insertAfter(
97
+ t.variableDeclaration("const", [
98
+ t.variableDeclarator(
99
+ t.objectPattern(
100
+ imports.map(
101
+ ({ name, alias }) => t.objectProperty(
102
+ t.identifier(name),
103
+ t.identifier(alias),
104
+ false,
105
+ name === alias
106
+ )
107
+ )
108
+ ),
109
+ namespaceId
110
+ )
111
+ ])
112
+ );
113
+ }
114
+ }
115
+ }
116
+ };
117
+ }
@@ -0,0 +1,7 @@
1
+ import {
2
+ plugin
3
+ } from "./chunk-4NVOXZG5.mjs";
4
+ import "./chunk-XYEU3RSG.mjs";
5
+ export {
6
+ plugin as default
7
+ };
@@ -0,0 +1,93 @@
1
+ import {
2
+ isCJSModule,
3
+ resolve
4
+ } from "./chunk-XYEU3RSG.mjs";
5
+
6
+ // src/babel-plugin-cjs-interop.ts
7
+ import * as t from "@babel/types";
8
+ function plugin(options) {
9
+ return {
10
+ name: "marko-import-interop",
11
+ visitor: {
12
+ ImportDeclaration(path) {
13
+ if (!path.node.specifiers.length || /\.(?:mjs|marko)$|\?/.test(path.node.source.value)) {
14
+ return;
15
+ }
16
+ try {
17
+ const resolved = resolve(
18
+ path.node.source.value,
19
+ path.hub.file.opts.filename,
20
+ options.extensions,
21
+ options.conditions
22
+ );
23
+ if (!/\.c?js$/.test(resolved) || !isCJSModule(resolved)) {
24
+ return;
25
+ }
26
+ } catch (_) {
27
+ return;
28
+ }
29
+ let namespaceId;
30
+ let defaultImportId;
31
+ let imports;
32
+ for (const s of path.node.specifiers) {
33
+ if (t.isImportSpecifier(s)) {
34
+ (imports || (imports = [])).push({
35
+ name: t.isStringLiteral(s.imported) ? s.imported.value : s.imported.name,
36
+ alias: s.local.name
37
+ });
38
+ } else if (t.isImportDefaultSpecifier(s)) {
39
+ defaultImportId = s.local;
40
+ } else if (t.isImportNamespaceSpecifier(s)) {
41
+ namespaceId = s.local;
42
+ }
43
+ }
44
+ namespaceId || (namespaceId = path.scope.generateUidIdentifier(
45
+ (defaultImportId == null ? void 0 : defaultImportId.name) || path.node.source.value
46
+ ));
47
+ path.node.specifiers = [t.importDefaultSpecifier(namespaceId)];
48
+ if (defaultImportId) {
49
+ path.insertAfter(
50
+ t.variableDeclaration("const", [
51
+ t.variableDeclarator(
52
+ defaultImportId,
53
+ t.conditionalExpression(
54
+ t.optionalMemberExpression(
55
+ namespaceId,
56
+ t.identifier("__esModule"),
57
+ false,
58
+ true
59
+ ),
60
+ t.memberExpression(namespaceId, t.identifier("default")),
61
+ namespaceId
62
+ )
63
+ )
64
+ ])
65
+ );
66
+ }
67
+ if (imports) {
68
+ path.insertAfter(
69
+ t.variableDeclaration("const", [
70
+ t.variableDeclarator(
71
+ t.objectPattern(
72
+ imports.map(
73
+ ({ name, alias }) => t.objectProperty(
74
+ t.identifier(name),
75
+ t.identifier(alias),
76
+ false,
77
+ name === alias
78
+ )
79
+ )
80
+ ),
81
+ namespaceId
82
+ )
83
+ ])
84
+ );
85
+ }
86
+ }
87
+ }
88
+ };
89
+ }
90
+
91
+ export {
92
+ plugin
93
+ };
@@ -0,0 +1,61 @@
1
+ // src/resolve.ts
2
+ import { exports } from "resolve.exports";
3
+ import * as Resolve from "resolve";
4
+ import path from "path";
5
+ import fs from "fs";
6
+ var exportsMainFile = `__package_exports__`;
7
+ var modulePathReg = /^.*[/\\]node_modules[/\\](?:@[^/\\]+[/\\])?[^/\\]+[/\\]/;
8
+ var cjsModuleLookup = /* @__PURE__ */ new Map();
9
+ function isCJSModule(id) {
10
+ var _a;
11
+ const modulePath = (_a = modulePathReg.exec(id)) == null ? void 0 : _a[0];
12
+ if (modulePath) {
13
+ const pkgPath = modulePath + "package.json";
14
+ let isCJS = cjsModuleLookup.get(pkgPath);
15
+ if (isCJS === void 0) {
16
+ try {
17
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
18
+ isCJS = pkg.type !== "module" && !pkg.exports;
19
+ } catch {
20
+ isCJS = false;
21
+ }
22
+ cjsModuleLookup.set(pkgPath, isCJS);
23
+ }
24
+ return isCJS;
25
+ }
26
+ return false;
27
+ }
28
+ function resolve(id, from, extensions, conditions) {
29
+ return Resolve.sync(id, {
30
+ basedir: path.dirname(from),
31
+ filename: from,
32
+ pathFilter,
33
+ packageFilter,
34
+ extensions
35
+ });
36
+ function pathFilter(pkg, pkgFile, relativePath) {
37
+ var _a;
38
+ cjsModuleLookup.set(pkgFile, pkg.type !== "module" && !pkg.exports);
39
+ if (pkg.exports) {
40
+ return (_a = exports(
41
+ pkg,
42
+ relativePath === exportsMainFile ? "." : relativePath,
43
+ {
44
+ conditions
45
+ }
46
+ )) == null ? void 0 : _a[0];
47
+ }
48
+ return relativePath;
49
+ }
50
+ }
51
+ function packageFilter(pkg) {
52
+ if (pkg.exports) {
53
+ pkg.main = exportsMainFile;
54
+ }
55
+ return pkg;
56
+ }
57
+
58
+ export {
59
+ isCJSModule,
60
+ resolve
61
+ };
package/dist/index.js CHANGED
@@ -41,13 +41,15 @@ var import_server_entry_template = __toESM(require("./server-entry-template"));
41
41
  var import_manifest_generator = require("./manifest-generator");
42
42
  var import_esbuild_plugin = __toESM(require("./esbuild-plugin"));
43
43
  var import_store = require("./store");
44
+ var import_babel_plugin_cjs_interop = __toESM(require("./babel-plugin-cjs-interop"));
45
+ var import_resolve = require("./resolve");
44
46
  __reExport(src_exports, require("./store"), module.exports);
45
47
  const import_meta = {};
46
48
  const POSIX_SEP = "/";
47
49
  const WINDOWS_SEP = "\\";
48
50
  const normalizePath = import_path.default.sep === WINDOWS_SEP ? (id) => id.replace(/\\/g, POSIX_SEP) : (id) => id;
49
51
  const virtualFiles = /* @__PURE__ */ new Map();
50
- const queryReg = /\?marko-.+$/;
52
+ const queryReg = /\?marko-[^?]+$/;
51
53
  const browserEntryQuery = "?marko-browser-entry";
52
54
  const serverEntryQuery = "?marko-server-entry";
53
55
  const virtualFileQuery = "?marko-virtual";
@@ -73,6 +75,7 @@ function markoPlugin(opts = {}) {
73
75
  let basePathVar;
74
76
  let baseConfig;
75
77
  let ssrConfig;
78
+ let ssrCjsConfig;
76
79
  let domConfig;
77
80
  let hydrateConfig;
78
81
  const resolveVirtualDependency = (from, dep) => {
@@ -247,6 +250,19 @@ function markoPlugin(opts = {}) {
247
250
  },
248
251
  configResolved(config) {
249
252
  basePath = config.base;
253
+ ssrCjsConfig = {
254
+ ...ssrConfig,
255
+ //modules: 'cjs'
256
+ babelConfig: {
257
+ ...ssrConfig.babelConfig,
258
+ plugins: (ssrConfig.babelConfig.plugins || []).concat(
259
+ (0, import_babel_plugin_cjs_interop.default)({
260
+ extensions: config.resolve.extensions,
261
+ conditions: config.resolve.conditions
262
+ })
263
+ )
264
+ }
265
+ };
250
266
  },
251
267
  configureServer(_server) {
252
268
  ssrConfig.hot = domConfig.hot = true;
@@ -413,8 +429,15 @@ function markoPlugin(opts = {}) {
413
429
  if (linked) {
414
430
  cachedSources.set(id, source);
415
431
  }
416
- if (!query) {
417
- if (!isBuild && isCJSModule(id)) {
432
+ if (!query && (0, import_resolve.isCJSModule)(id)) {
433
+ if (isBuild) {
434
+ const { code: code2, map: map2 } = await compiler.compile(
435
+ source,
436
+ id,
437
+ ssrCjsConfig
438
+ );
439
+ return { code: code2, map: map2, meta: { source } };
440
+ } else {
418
441
  const { ast } = await compiler.compile(source, id, {
419
442
  cache,
420
443
  ast: true,
@@ -648,26 +671,6 @@ function isEmpty(obj) {
648
671
  }
649
672
  return true;
650
673
  }
651
- const cjsModuleLookup = /* @__PURE__ */ new Map();
652
- function isCJSModule(id) {
653
- var _a;
654
- const modulePath = (_a = /^.*[/\\]node_modules[/\\](?:@[^/\\]+[/\\])?[^/\\]+[/\\]/.exec(id)) == null ? void 0 : _a[0];
655
- if (modulePath) {
656
- let isCJS = cjsModuleLookup.get(modulePath);
657
- if (isCJS === void 0) {
658
- const pkgPath = modulePath + "package.json";
659
- try {
660
- const pkg = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf8"));
661
- isCJS = pkg.type !== "module" && !pkg.exports;
662
- } catch {
663
- isCJS = false;
664
- }
665
- cjsModuleLookup.set(modulePath, isCJS);
666
- }
667
- return isCJS;
668
- }
669
- return false;
670
- }
671
674
  function stripVersionAndTimeStamp(id) {
672
675
  const queryStart = id.indexOf("?");
673
676
  if (queryStart === -1)
package/dist/index.mjs CHANGED
@@ -1,3 +1,13 @@
1
+ import "./chunk-KIYHBIE6.mjs";
2
+ import {
3
+ FileStore
4
+ } from "./chunk-FCWFM7VD.mjs";
5
+ import {
6
+ MemoryStore
7
+ } from "./chunk-DCBMHGK4.mjs";
8
+ import {
9
+ plugin
10
+ } from "./chunk-4NVOXZG5.mjs";
1
11
  import {
2
12
  esbuildPlugin
3
13
  } from "./chunk-HR4PYNIR.mjs";
@@ -5,17 +15,13 @@ import {
5
15
  generateDocManifest,
6
16
  generateInputDoc
7
17
  } from "./chunk-2E5QX7AF.mjs";
18
+ import {
19
+ isCJSModule
20
+ } from "./chunk-XYEU3RSG.mjs";
8
21
  import "./chunk-NTHVNXFC.mjs";
9
22
  import {
10
23
  server_entry_template_default
11
24
  } from "./chunk-6IJ5UJ3N.mjs";
12
- import "./chunk-KIYHBIE6.mjs";
13
- import {
14
- MemoryStore
15
- } from "./chunk-DCBMHGK4.mjs";
16
- import {
17
- FileStore
18
- } from "./chunk-FCWFM7VD.mjs";
19
25
 
20
26
  // src/index.ts
21
27
  import fs from "fs";
@@ -27,7 +33,7 @@ var POSIX_SEP = "/";
27
33
  var WINDOWS_SEP = "\\";
28
34
  var normalizePath = path.sep === WINDOWS_SEP ? (id) => id.replace(/\\/g, POSIX_SEP) : (id) => id;
29
35
  var virtualFiles = /* @__PURE__ */ new Map();
30
- var queryReg = /\?marko-.+$/;
36
+ var queryReg = /\?marko-[^?]+$/;
31
37
  var browserEntryQuery = "?marko-browser-entry";
32
38
  var serverEntryQuery = "?marko-server-entry";
33
39
  var virtualFileQuery = "?marko-virtual";
@@ -53,6 +59,7 @@ function markoPlugin(opts = {}) {
53
59
  let basePathVar;
54
60
  let baseConfig;
55
61
  let ssrConfig;
62
+ let ssrCjsConfig;
56
63
  let domConfig;
57
64
  let hydrateConfig;
58
65
  const resolveVirtualDependency = (from, dep) => {
@@ -227,6 +234,19 @@ function markoPlugin(opts = {}) {
227
234
  },
228
235
  configResolved(config) {
229
236
  basePath = config.base;
237
+ ssrCjsConfig = {
238
+ ...ssrConfig,
239
+ //modules: 'cjs'
240
+ babelConfig: {
241
+ ...ssrConfig.babelConfig,
242
+ plugins: (ssrConfig.babelConfig.plugins || []).concat(
243
+ plugin({
244
+ extensions: config.resolve.extensions,
245
+ conditions: config.resolve.conditions
246
+ })
247
+ )
248
+ }
249
+ };
230
250
  },
231
251
  configureServer(_server) {
232
252
  ssrConfig.hot = domConfig.hot = true;
@@ -393,8 +413,15 @@ function markoPlugin(opts = {}) {
393
413
  if (linked) {
394
414
  cachedSources.set(id, source);
395
415
  }
396
- if (!query) {
397
- if (!isBuild && isCJSModule(id)) {
416
+ if (!query && isCJSModule(id)) {
417
+ if (isBuild) {
418
+ const { code: code2, map: map2 } = await compiler.compile(
419
+ source,
420
+ id,
421
+ ssrCjsConfig
422
+ );
423
+ return { code: code2, map: map2, meta: { source } };
424
+ } else {
398
425
  const { ast } = await compiler.compile(source, id, {
399
426
  cache,
400
427
  ast: true,
@@ -628,26 +655,6 @@ function isEmpty(obj) {
628
655
  }
629
656
  return true;
630
657
  }
631
- var cjsModuleLookup = /* @__PURE__ */ new Map();
632
- function isCJSModule(id) {
633
- var _a;
634
- const modulePath = (_a = /^.*[/\\]node_modules[/\\](?:@[^/\\]+[/\\])?[^/\\]+[/\\]/.exec(id)) == null ? void 0 : _a[0];
635
- if (modulePath) {
636
- let isCJS = cjsModuleLookup.get(modulePath);
637
- if (isCJS === void 0) {
638
- const pkgPath = modulePath + "package.json";
639
- try {
640
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
641
- isCJS = pkg.type !== "module" && !pkg.exports;
642
- } catch {
643
- isCJS = false;
644
- }
645
- cjsModuleLookup.set(modulePath, isCJS);
646
- }
647
- return isCJS;
648
- }
649
- return false;
650
- }
651
658
  function stripVersionAndTimeStamp(id) {
652
659
  const queryStart = id.indexOf("?");
653
660
  if (queryStart === -1)
@@ -0,0 +1,2 @@
1
+ export declare function isCJSModule(id: string): boolean;
2
+ export declare function resolve(id: string, from: string, extensions: string[], conditions: string[]): string;
@@ -0,0 +1,94 @@
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(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var resolve_exports = {};
30
+ __export(resolve_exports, {
31
+ isCJSModule: () => isCJSModule,
32
+ resolve: () => resolve
33
+ });
34
+ module.exports = __toCommonJS(resolve_exports);
35
+ var import_resolve = require("resolve.exports");
36
+ var Resolve = __toESM(require("resolve"));
37
+ var import_path = __toESM(require("path"));
38
+ var import_fs = __toESM(require("fs"));
39
+ const exportsMainFile = `__package_exports__`;
40
+ const modulePathReg = /^.*[/\\]node_modules[/\\](?:@[^/\\]+[/\\])?[^/\\]+[/\\]/;
41
+ const cjsModuleLookup = /* @__PURE__ */ new Map();
42
+ function isCJSModule(id) {
43
+ var _a;
44
+ const modulePath = (_a = modulePathReg.exec(id)) == null ? void 0 : _a[0];
45
+ if (modulePath) {
46
+ const pkgPath = modulePath + "package.json";
47
+ let isCJS = cjsModuleLookup.get(pkgPath);
48
+ if (isCJS === void 0) {
49
+ try {
50
+ const pkg = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf8"));
51
+ isCJS = pkg.type !== "module" && !pkg.exports;
52
+ } catch {
53
+ isCJS = false;
54
+ }
55
+ cjsModuleLookup.set(pkgPath, isCJS);
56
+ }
57
+ return isCJS;
58
+ }
59
+ return false;
60
+ }
61
+ function resolve(id, from, extensions, conditions) {
62
+ return Resolve.sync(id, {
63
+ basedir: import_path.default.dirname(from),
64
+ filename: from,
65
+ pathFilter,
66
+ packageFilter,
67
+ extensions
68
+ });
69
+ function pathFilter(pkg, pkgFile, relativePath) {
70
+ var _a;
71
+ cjsModuleLookup.set(pkgFile, pkg.type !== "module" && !pkg.exports);
72
+ if (pkg.exports) {
73
+ return (_a = (0, import_resolve.exports)(
74
+ pkg,
75
+ relativePath === exportsMainFile ? "." : relativePath,
76
+ {
77
+ conditions
78
+ }
79
+ )) == null ? void 0 : _a[0];
80
+ }
81
+ return relativePath;
82
+ }
83
+ }
84
+ function packageFilter(pkg) {
85
+ if (pkg.exports) {
86
+ pkg.main = exportsMainFile;
87
+ }
88
+ return pkg;
89
+ }
90
+ // Annotate the CommonJS export names for ESM import in node:
91
+ 0 && (module.exports = {
92
+ isCJSModule,
93
+ resolve
94
+ });
@@ -0,0 +1,8 @@
1
+ import {
2
+ isCJSModule,
3
+ resolve
4
+ } from "./chunk-XYEU3RSG.mjs";
5
+ export {
6
+ isCJSModule,
7
+ resolve
8
+ };
@@ -1,10 +1,10 @@
1
1
  import "../chunk-KIYHBIE6.mjs";
2
- import {
3
- MemoryStore
4
- } from "../chunk-DCBMHGK4.mjs";
5
2
  import {
6
3
  FileStore
7
4
  } from "../chunk-FCWFM7VD.mjs";
5
+ import {
6
+ MemoryStore
7
+ } from "../chunk-DCBMHGK4.mjs";
8
8
  export {
9
9
  FileStore,
10
10
  MemoryStore
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
3
  "description": "A Marko plugin for Vite",
4
- "version": "3.1.4",
4
+ "version": "3.1.5",
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.3",
9
9
  "domelementtype": "^2.3.0",
10
10
  "domhandler": "^5.0.3",
11
- "htmlparser2": "^9.0.0"
11
+ "htmlparser2": "^9.0.0",
12
+ "resolve": "^1.22.8",
13
+ "resolve.exports": "^2.0.2"
12
14
  },
13
15
  "devDependencies": {
14
16
  "@changesets/changelog-github": "^0.4.8",
@@ -16,9 +18,11 @@
16
18
  "@marko/compiler": "^5.33.2",
17
19
  "@marko/fixture-snapshots": "^2.2.1",
18
20
  "@marko/testing-library": "^6.1.4",
21
+ "@types/babel__core": "^7.20.3",
19
22
  "@types/jsdom": "^21.1.3",
20
23
  "@types/mocha": "^10.0.2",
21
24
  "@types/node": "^20.8.2",
25
+ "@types/resolve": "^1.20.4",
22
26
  "@types/serve-handler": "^6.1.2",
23
27
  "@typescript-eslint/eslint-plugin": "^6.7.4",
24
28
  "@typescript-eslint/parser": "^6.7.4",
@@ -38,7 +42,7 @@
38
42
  "playwright": "^1.38.1",
39
43
  "prettier": "^2.8.8",
40
44
  "serve-handler": "^6.1.5",
41
- "tsx": "^3.13.0",
45
+ "tsx": "^3.14.0",
42
46
  "typescript": "^5.2.2",
43
47
  "vite": "^4.4.11"
44
48
  },