@marko/compiler 5.36.1 → 5.37.0

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.
package/config.d.ts CHANGED
@@ -24,6 +24,7 @@ declare const Config: {
24
24
  hydrateIncludeImports?: RegExp | ((request: string) => boolean);
25
25
  hydrateInit?: boolean;
26
26
  optimize?: boolean;
27
+ optimizedRegistryIds?: Map<string, string>;
27
28
  cache?: Map<unknown, unknown>;
28
29
  hot?: boolean;
29
30
  /** @deprecated */
@@ -158,7 +158,7 @@ function getMarkoFile(code, fileOpts, markoOpts) {
158
158
  const isSource = markoOpts.output === "source";
159
159
  const isMigrate = markoOpts.output === "migrate";
160
160
  const canCache = !(isSource || isMigrate);
161
- const id = (0, _babelUtils.getTemplateId)(markoOpts.optimize, filename);
161
+ const id = (0, _babelUtils.getTemplateId)(markoOpts, filename);
162
162
  const contentHash = canCache && (0, _crypto.createHash)("MD5").update(code).digest("hex");
163
163
  const cacheKey = canCache && (0, _crypto.createHash)("MD5").update(id).digest("hex");
164
164
 
@@ -49,7 +49,7 @@ Object.assign(_printer.default.prototype, {
49
49
  this.token("\n");
50
50
  }
51
51
 
52
- this.token(`${node.static ? "static" : "$"} `);
52
+ this.token(`${node.static ? node.target ?? "static" : "$"} `);
53
53
 
54
54
  if (
55
55
  node.body.length === 1 &&
@@ -76,7 +76,7 @@ const MarkoDefinitions = {
76
76
 
77
77
  MarkoScriptlet: {
78
78
  aliases: ["Marko", "Statement"],
79
- builder: ["body", "static"],
79
+ builder: ["body", "static", "target"],
80
80
  visitor: ["body"],
81
81
  fields: {
82
82
  body: {
@@ -85,6 +85,10 @@ const MarkoDefinitions = {
85
85
  static: {
86
86
  validate: (0, _utils.assertValueType)("boolean"),
87
87
  default: false
88
+ },
89
+ target: {
90
+ validate: (0, _utils.assertValueType)("string"),
91
+ optional: true
88
92
  }
89
93
  }
90
94
  },
package/dist/config.js CHANGED
@@ -159,6 +159,13 @@ var _lassoPackageRoot = require("lasso-package-root");
159
159
 
160
160
 
161
161
 
162
+
163
+
164
+
165
+
166
+
167
+
168
+
162
169
 
163
170
 
164
171
 
@@ -203,6 +210,10 @@ var _config = _interopRequireDefault(require("./taglib/config"));const config =
203
210
  * Enables production mode optimizations if true, or not if false.
204
211
  * If left as undefined checks for env === "production".
205
212
  */optimize: undefined, /**
213
+ * If `optimize` is enabled you can provide a Map which the compiler will
214
+ * use to store shorter registry/template id's in. This can only be used
215
+ * if the same `optimizedRegistryIds` are used for both server and client compilations.
216
+ */optimizedRegistryIds: undefined, /**
206
217
  * This option should be set if `hydrate` output is specified.
207
218
  * Maps a virtual dependency to a resolved file which can be implemented
208
219
  * for specific bundlers.
package/dist/types.d.ts CHANGED
@@ -1706,6 +1706,7 @@ export interface MarkoScriptlet extends BaseNode {
1706
1706
  type: "MarkoScriptlet";
1707
1707
  body: Array<Statement>;
1708
1708
  static: boolean;
1709
+ target: string | null;
1709
1710
  }
1710
1711
 
1711
1712
  export interface MarkoClass extends BaseNode {
@@ -2133,7 +2134,7 @@ export function markoCDATA(value: string): MarkoCDATA;
2133
2134
  export function markoComment(value: string): MarkoComment;
2134
2135
  export function markoText(value: string): MarkoText;
2135
2136
  export function markoPlaceholder(value: Expression, escape?: boolean): MarkoPlaceholder;
2136
- export function markoScriptlet(body: Array<Statement>, _static?: boolean): MarkoScriptlet;
2137
+ export function markoScriptlet(body: Array<Statement>, _static?: boolean, target?: string | null): MarkoScriptlet;
2137
2138
  export function markoClass(body: ClassBody): MarkoClass;
2138
2139
  export function markoAttribute(name: string, value: Expression, modifier?: string | null, _arguments?: Array<Expression | SpreadElement> | null, _default?: boolean | null, bound?: boolean | null): MarkoAttribute;
2139
2140
  export function markoSpreadAttribute(value: Expression): MarkoSpreadAttribute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
- "version": "5.36.1",
3
+ "version": "5.37.0",
4
4
  "description": "Marko template to JS compiler.",
5
5
  "keywords": [
6
6
  "babel",
@@ -66,7 +66,7 @@
66
66
  "@babel/traverse": "^7.24.1",
67
67
  "@babel/types": "^7.24.0",
68
68
  "@luxass/strip-json-comments": "^1.2.0",
69
- "@marko/babel-utils": "^6.4.3",
69
+ "@marko/babel-utils": "^6.5.0",
70
70
  "complain": "^1.6.0",
71
71
  "he": "^1.2.0",
72
72
  "htmljs-parser": "^5.5.2",
@@ -80,7 +80,7 @@
80
80
  "source-map-support": "^0.5.21"
81
81
  },
82
82
  "devDependencies": {
83
- "@marko/translator-default": "^5.33.1"
83
+ "@marko/translator-default": "^6.0.1"
84
84
  },
85
85
  "publishConfig": {
86
86
  "access": "public"