@marko/vite 5.0.0 → 5.0.1

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 +39 -10
  2. package/package.json +19 -19
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  // src/index.ts
2
2
  import * as compiler2 from "@marko/compiler";
3
- import defaultConfig from "@marko/compiler/config";
4
3
  import fs4 from "fs";
5
4
  import path6 from "path";
6
5
  import crypto from "crypto";
@@ -536,24 +535,45 @@ function plugin(options) {
536
535
  namespaceId = s.local;
537
536
  }
538
537
  }
539
- namespaceId ||= path7.scope.generateUidIdentifier(
540
- defaultImportId?.name || path7.node.source.value
538
+ const rawImport = path7.scope.generateUidIdentifier(
539
+ namespaceId?.name || defaultImportId?.name || path7.node.source.value
541
540
  );
542
- path7.node.specifiers = [t.importDefaultSpecifier(namespaceId)];
541
+ path7.node.specifiers = [t.importNamespaceSpecifier(rawImport)];
543
542
  if (defaultImportId) {
544
543
  path7.insertAfter(
545
544
  t.variableDeclaration("const", [
546
545
  t.variableDeclarator(
547
- defaultImportId,
546
+ t.objectPattern([
547
+ t.objectProperty(t.identifier("default"), defaultImportId)
548
+ ]),
548
549
  t.conditionalExpression(
549
550
  t.optionalMemberExpression(
550
- namespaceId,
551
+ t.memberExpression(rawImport, t.identifier("default")),
551
552
  t.identifier("__esModule"),
552
553
  false,
553
554
  true
554
555
  ),
555
- t.memberExpression(namespaceId, t.identifier("default")),
556
- namespaceId
556
+ t.memberExpression(rawImport, t.identifier("default")),
557
+ rawImport
558
+ )
559
+ )
560
+ ])
561
+ );
562
+ }
563
+ if (namespaceId) {
564
+ path7.insertAfter(
565
+ t.variableDeclaration("const", [
566
+ t.variableDeclarator(
567
+ namespaceId,
568
+ t.conditionalExpression(
569
+ t.optionalMemberExpression(
570
+ rawImport,
571
+ t.identifier("__esModule"),
572
+ false,
573
+ true
574
+ ),
575
+ rawImport,
576
+ t.memberExpression(rawImport, t.identifier("default"))
557
577
  )
558
578
  )
559
579
  ])
@@ -573,7 +593,16 @@ function plugin(options) {
573
593
  )
574
594
  )
575
595
  ),
576
- namespaceId
596
+ t.conditionalExpression(
597
+ t.optionalMemberExpression(
598
+ rawImport,
599
+ t.identifier("__esModule"),
600
+ false,
601
+ true
602
+ ),
603
+ rawImport,
604
+ t.memberExpression(rawImport, t.identifier("default"))
605
+ )
577
606
  )
578
607
  ])
579
608
  );
@@ -809,7 +838,7 @@ function markoPlugin(opts = {}) {
809
838
  let basePath = "/";
810
839
  let getMarkoAssetFns;
811
840
  const tagsAPI = !/^@marko\/translator-(?:default|interop-class-tags)$/.test(
812
- opts.translator ?? defaultConfig.translator
841
+ opts.translator || compiler2.globalConfig?.translator || "@marko/translator-default"
813
842
  );
814
843
  const entryIds = /* @__PURE__ */ new Set();
815
844
  const cachedSources = /* @__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": "5.0.0",
4
+ "version": "5.0.1",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {
@@ -16,37 +16,37 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@changesets/changelog-github": "^0.5.0",
19
- "@changesets/cli": "^2.27.5",
20
- "@marko/compiler": "^5.37.0",
19
+ "@changesets/cli": "^2.27.9",
20
+ "@marko/compiler": "^5.37.26",
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
- "@types/jsdom": "^21.1.6",
25
- "@types/mocha": "^10.0.6",
26
- "@types/node": "^20.12.12",
24
+ "@types/jsdom": "^21.1.7",
25
+ "@types/mocha": "^10.0.9",
26
+ "@types/node": "^22.9.0",
27
27
  "@types/resolve": "^1.20.6",
28
28
  "@types/serve-handler": "^6.1.4",
29
29
  "@typescript-eslint/eslint-plugin": "^7.11.0",
30
30
  "@typescript-eslint/parser": "^7.11.0",
31
31
  "cross-env": "^7.0.3",
32
- "esbuild": "^0.21.4",
32
+ "esbuild": "^0.24.0",
33
33
  "eslint": "^8.57.0",
34
34
  "eslint-config-prettier": "^9.1.0",
35
35
  "fixpack": "^4.0.0",
36
- "husky": "^9.0.11",
37
- "jsdom": "^24.1.0",
36
+ "husky": "^9.1.7",
37
+ "jsdom": "^25.0.1",
38
38
  "less": "^4.2.0",
39
- "lint-staged": "^15.2.5",
40
- "marko": "^5.35.0",
41
- "mocha": "^10.4.0",
39
+ "lint-staged": "^15.2.10",
40
+ "marko": "^5.35.35",
41
+ "mocha": "^10.8.2",
42
42
  "mocha-snap": "^5.0.0",
43
- "nyc": "^15.1.0",
44
- "playwright": "^1.44.1",
45
- "prettier": "^3.2.5",
46
- "serve-handler": "^6.1.5",
47
- "tsx": "^4.11.0",
48
- "typescript": "^5.4.5",
49
- "vite": "^5.2.12"
43
+ "nyc": "^17.1.0",
44
+ "playwright": "^1.49.0",
45
+ "prettier": "^3.3.3",
46
+ "serve-handler": "^6.1.6",
47
+ "tsx": "^4.19.2",
48
+ "typescript": "^5.6.3",
49
+ "vite": "^5.4.11"
50
50
  },
51
51
  "files": [
52
52
  "dist",