marko 5.39.13 → 5.39.14

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/README.md CHANGED
@@ -138,8 +138,8 @@ ul.example-list
138
138
  <th><img alt="Discord" src="https://user-images.githubusercontent.com/4985201/89313514-6edbea80-d62d-11ea-8447-ca2fd8983661.png" width="162">
139
139
  <th><img alt="Twitter" src="https://user-images.githubusercontent.com/1958812/56055707-07e74380-5d0f-11e9-8a59-d529fbb5a81e.png" width="53">
140
140
  <tbody><tr><td>
141
-
142
- Ask and answer [StackOverflow questions with the `#marko` tag](https://stackoverflow.com/questions/tagged/marko)<td>
141
+
142
+ Ask and answer [StackOverflow questions with the `#marko` tag](https://stackoverflow.com/questions/tagged/marko)<td>
143
143
 
144
144
  Come [hang out in our Discord chat](https://discord.gg/RFGxYGs), ask questions, and discuss project direction<td>
145
145
 
@@ -3,20 +3,46 @@
3
3
  var flushHereAndAfter = require("../../core-tags/core/__flush_here_and_after__");
4
4
  var escapeScript = require("../html/helpers/escape-script-placeholder");
5
5
  var FLAG_WILL_RERENDER_IN_BROWSER = 1;
6
+ var DEFAULT_RUNTIME_ID = "M";
6
7
  var kAssets = Symbol();
7
8
  var kBlockIndex = Symbol();
8
9
  var kDeferIndex = Symbol();
9
10
  var assetFlush;
10
11
 
11
- exports.withPageAssets = function withPageAssets(typeId, template, runtime) {
12
+ exports.withPageAssets = function withPageAssets(
13
+ typeId,
14
+ template,
15
+ runtime,
16
+ runtimeId)
17
+ {
12
18
  assetFlush = runtime;
13
19
  var flushBeforeInput = { renderBody: flush };
14
20
  return createFacade(template, function (input, out) {
15
- var hasAssets = !!out.global[kAssets];
21
+ var g = out.global;
22
+ if (runtimeId) {
23
+ // eslint-disable-next-line no-constant-condition
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ // The client half of the runtimeId contract is baked into the
37
+ // compiled browser entry, so the compiled value must win for the
38
+ // halves to agree.
39
+ g.runtimeId = runtimeId;
40
+ }
41
+ var hasAssets = !!g[kAssets];
16
42
  var key = out.ad_;
17
43
  var def = out.ac_;
18
44
  var component = def && def.s_;
19
- addAsset(out.global, typeId);
45
+ addAsset(g, typeId);
20
46
 
21
47
  if (hasAssets) {
22
48
  if (willRerender(def)) {
@@ -281,9 +281,17 @@ const translate = exports.translate = {
281
281
  }
282
282
 
283
283
  if (file.markoOpts.output === "html" && file.markoOpts.entry === "page") {
284
- const { linkAssets } = file.markoOpts;
284
+ const { linkAssets, runtimeId } = file.markoOpts;
285
285
  const templateId = file.metadata.marko.id;
286
286
  const relPath = (0, _babelUtils.resolveRelativePath)(file, file.opts.filename);
287
+ const pageAssetArgs = [
288
+ _compiler.types.stringLiteral(templateId),
289
+ _compiler.types.identifier("template"),
290
+ _compiler.types.identifier("flush")];
291
+
292
+ if (runtimeId) {
293
+ pageAssetArgs.push(_compiler.types.stringLiteral(runtimeId));
294
+ }
287
295
  linkAssets.onAsset("page", file.opts.filename, templateId);
288
296
  path.node.body = [
289
297
  _compiler.types.importDeclaration(
@@ -305,11 +313,7 @@ const translate = exports.translate = {
305
313
  ),
306
314
  _compiler.types.exportAllDeclaration(_compiler.types.stringLiteral(relPath)),
307
315
  _compiler.types.exportDefaultDeclaration(
308
- _compiler.types.callExpression(_compiler.types.identifier("withPageAssets"), [
309
- _compiler.types.stringLiteral(templateId),
310
- _compiler.types.identifier("template"),
311
- _compiler.types.identifier("flush")]
312
- )
316
+ _compiler.types.callExpression(_compiler.types.identifier("withPageAssets"), pageAssetArgs)
313
317
  )];
314
318
 
315
319
  path.skip();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.39.13",
3
+ "version": "5.39.14",
4
4
  "private": false,
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "keywords": [
@@ -70,7 +70,7 @@
70
70
  "build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
71
71
  },
72
72
  "dependencies": {
73
- "@marko/compiler": "^5.39.66",
73
+ "@marko/compiler": "^5.40.1",
74
74
  "@marko/runtime-tags": "^6.1.19",
75
75
  "app-module-path": "^2.2.0",
76
76
  "argly": "^1.2.0",
@@ -80,7 +80,7 @@
80
80
  "events-light": "^1.0.5",
81
81
  "listener-tracker": "^2.0.0",
82
82
  "magic-string": "^0.30.21",
83
- "minimatch": "^9.0.5",
83
+ "minimatch": "^10.2.5",
84
84
  "raptor-util": "^3.2.0",
85
85
  "resolve-from": "^5.0.0",
86
86
  "self-closing-tags": "^1.0.1",
@@ -146,7 +146,7 @@ function checkInputChanged(existingComponent, oldInput, newInput) {
146
146
  return true;
147
147
  }
148
148
 
149
- for (var i = len; i--; ) {
149
+ for (var i = len; i--;) {
150
150
  var key = oldKeys[i];
151
151
  if (!(key in newInput && oldInput[key] === newInput[key])) {
152
152
  return true;
@@ -167,7 +167,7 @@ function addEvents(componentDef, customEvents, props) {
167
167
  var result = props || {};
168
168
  var event;
169
169
 
170
- for (var i = len; i--; ) {
170
+ for (var i = len; i--;) {
171
171
  event = customEvents[i];
172
172
  result["on" + event[0]] = componentDef.d(
173
173
  event[0],
@@ -3,20 +3,46 @@
3
3
  var flushHereAndAfter = require("../../core-tags/core/__flush_here_and_after__");
4
4
  var escapeScript = require("../html/helpers/escape-script-placeholder");
5
5
  var FLAG_WILL_RERENDER_IN_BROWSER = 1;
6
+ var DEFAULT_RUNTIME_ID = "M";
6
7
  var kAssets = Symbol();
7
8
  var kBlockIndex = Symbol();
8
9
  var kDeferIndex = Symbol();
9
10
  var assetFlush;
10
11
 
11
- exports.withPageAssets = function withPageAssets(typeId, template, runtime) {
12
+ exports.withPageAssets = function withPageAssets(
13
+ typeId,
14
+ template,
15
+ runtime,
16
+ runtimeId,
17
+ ) {
12
18
  assetFlush = runtime;
13
19
  var flushBeforeInput = { renderBody: flush };
14
20
  return createFacade(template, function (input, out) {
15
- var hasAssets = !!out.global[kAssets];
21
+ var g = out.global;
22
+ if (runtimeId) {
23
+ // eslint-disable-next-line no-constant-condition
24
+ if ("MARKO_DEBUG") {
25
+ if (g.runtimeId !== DEFAULT_RUNTIME_ID && g.runtimeId !== runtimeId) {
26
+ throw new Error(
27
+ '$global.runtimeId ("' +
28
+ g.runtimeId +
29
+ '") conflicts with the runtimeId this entry was compiled with ("' +
30
+ runtimeId +
31
+ '").',
32
+ );
33
+ }
34
+ }
35
+
36
+ // The client half of the runtimeId contract is baked into the
37
+ // compiled browser entry, so the compiled value must win for the
38
+ // halves to agree.
39
+ g.runtimeId = runtimeId;
40
+ }
41
+ var hasAssets = !!g[kAssets];
16
42
  var key = out.___assignedKey;
17
43
  var def = out.___assignedComponentDef;
18
44
  var component = def && def.___component;
19
- addAsset(out.global, typeId);
45
+ addAsset(g, typeId);
20
46
 
21
47
  if (hasAssets) {
22
48
  if (willRerender(def)) {
@@ -25,7 +25,7 @@ module.exports = function dynamicAttr(name, value) {
25
25
  // In practice however the only character that does not become an attribute name
26
26
  // is when there is a >.
27
27
  function isInvalidAttrName(name) {
28
- for (let i = name.length; i--; ) {
28
+ for (let i = name.length; i--;) {
29
29
  if (name[i] === ">") {
30
30
  return true;
31
31
  }
@@ -281,9 +281,17 @@ export const translate = {
281
281
  }
282
282
 
283
283
  if (file.markoOpts.output === "html" && file.markoOpts.entry === "page") {
284
- const { linkAssets } = file.markoOpts;
284
+ const { linkAssets, runtimeId } = file.markoOpts;
285
285
  const templateId = file.metadata.marko.id;
286
286
  const relPath = resolveRelativePath(file, file.opts.filename);
287
+ const pageAssetArgs = [
288
+ t.stringLiteral(templateId),
289
+ t.identifier("template"),
290
+ t.identifier("flush"),
291
+ ];
292
+ if (runtimeId) {
293
+ pageAssetArgs.push(t.stringLiteral(runtimeId));
294
+ }
287
295
  linkAssets.onAsset("page", file.opts.filename, templateId);
288
296
  path.node.body = [
289
297
  t.importDeclaration(
@@ -305,11 +313,7 @@ export const translate = {
305
313
  ),
306
314
  t.exportAllDeclaration(t.stringLiteral(relPath)),
307
315
  t.exportDefaultDeclaration(
308
- t.callExpression(t.identifier("withPageAssets"), [
309
- t.stringLiteral(templateId),
310
- t.identifier("template"),
311
- t.identifier("flush"),
312
- ]),
316
+ t.callExpression(t.identifier("withPageAssets"), pageAssetArgs),
313
317
  ),
314
318
  ];
315
319
  path.skip();
@@ -68,7 +68,7 @@ export default function (path, attrs) {
68
68
  let curString = "";
69
69
 
70
70
  // Remove duplicate attrs so last one wins.
71
- for (let i = len; i--; ) {
71
+ for (let i = len; i--;) {
72
72
  const attr = attrs[i];
73
73
  const { name, value } = attr.node;
74
74
  if (attrValues.has(name)) continue;
@@ -60,7 +60,7 @@ export default function (path, attrs) {
60
60
  const props = [];
61
61
 
62
62
  // Remove duplicate attrs so last one wins.
63
- for (let i = len; i--; ) {
63
+ for (let i = len; i--;) {
64
64
  const attr = attrs[i];
65
65
  const { name, value } = attr.node;
66
66
  if (attrValues.has(name)) continue;
@@ -226,7 +226,7 @@ function camelCase(string) {
226
226
  }
227
227
 
228
228
  function findLastIndex(arr, check) {
229
- for (let i = arr.length; i--; ) {
229
+ for (let i = arr.length; i--;) {
230
230
  if (check(arr[i])) {
231
231
  return i;
232
232
  }
package/tags-html.d.ts CHANGED
@@ -823,13 +823,7 @@ declare global {
823
823
  * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-method
824
824
  */
825
825
  method?:
826
- | AttrMissing
827
- | "POST"
828
- | "post"
829
- | "GET"
830
- | "get"
831
- | "dialog"
832
- | "DIALOG";
826
+ AttrMissing | "POST" | "post" | "GET" | "get" | "dialog" | "DIALOG";
833
827
  /**
834
828
  * The name attribute represents the form's name within the forms collection.
835
829
  * @see https://html.spec.whatwg.org/multipage/forms.html#attr-form-name
@@ -2479,11 +2473,7 @@ declare global {
2479
2473
  * @see https://html.spec.whatwg.org/multipage/interaction.html#attr-autocapitalize
2480
2474
  */
2481
2475
  autocapitalize?:
2482
- | AttrOnOff
2483
- | "characters"
2484
- | "none"
2485
- | "sentences"
2486
- | "words";
2476
+ AttrOnOff | "characters" | "none" | "sentences" | "words";
2487
2477
 
2488
2478
  /**
2489
2479
  * Indicates whether the element should automatically get focus when the page loads.
@@ -3593,13 +3583,7 @@ declare global {
3593
3583
  * @see https://www.w3.org/TR/wai-aria-1.1/#aria-dropeffect
3594
3584
  * */
3595
3585
  "aria-dropeffect"?:
3596
- | AttrMissing
3597
- | "copy"
3598
- | "execute"
3599
- | "link"
3600
- | "move"
3601
- | "none"
3602
- | "popup";
3586
+ AttrMissing | "copy" | "execute" | "link" | "move" | "none" | "popup";
3603
3587
  /**
3604
3588
  * Identifies the element that provides an error message for the object.
3605
3589
  * @see https://www.w3.org/TR/wai-aria-1.1/#aria-errormessage
@@ -3629,12 +3613,7 @@ declare global {
3629
3613
  * @see https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup
3630
3614
  */
3631
3615
  "aria-haspopup"?:
3632
- | AttrBooleanString
3633
- | "dialog"
3634
- | "grid"
3635
- | "listbox"
3636
- | "menu"
3637
- | "tree";
3616
+ AttrBooleanString | "dialog" | "grid" | "listbox" | "menu" | "tree";
3638
3617
  /**
3639
3618
  * Indicates whether the element is exposed to an accessibility API.
3640
3619
  * @see https://www.w3.org/TR/wai-aria-1.1/#aria-hidden
@@ -3893,22 +3872,13 @@ declare global {
3893
3872
 
3894
3873
  type AttrMissing = undefined | null | false;
3895
3874
  type AttrClass =
3896
- | AttrMissing
3897
- | string
3898
- | AttrClass[]
3899
- | Record<string, AttrMissing | boolean>;
3875
+ AttrMissing | string | AttrClass[] | Record<string, AttrMissing | boolean>;
3900
3876
  type AttrStyle = AttrMissing | string | Marko.CSS.Properties | AttrStyle[];
3901
3877
  type AttrCrossOrigin = AttrBoolean | "anonymous" | "use-credentials";
3902
3878
  type AttrEventHandler<Event, Target> =
3903
- | AttrMissing
3904
- | ((event: Event, target: Target) => unknown);
3879
+ AttrMissing | ((event: Event, target: Target) => unknown);
3905
3880
  type AttrTarget =
3906
- | AttrMissing
3907
- | "_blank"
3908
- | "_parent"
3909
- | "_self"
3910
- | "_top"
3911
- | (string & {});
3881
+ AttrMissing | "_blank" | "_parent" | "_self" | "_top" | (string & {});
3912
3882
  type AttrReferrerPolicy =
3913
3883
  | AttrMissing
3914
3884
  | "no-referrer-when-downgrade"
@@ -3938,13 +3908,7 @@ type AttrHref =
3938
3908
  * so any URL is accepted while suggesting common prefixes in autocomplete.
3939
3909
  */
3940
3910
  type AttrSrc =
3941
- | AttrMissing
3942
- | "/"
3943
- | "./"
3944
- | "https://"
3945
- | "data:"
3946
- | "blob:"
3947
- | (string & {});
3911
+ AttrMissing | "/" | "./" | "https://" | "data:" | "blob:" | (string & {});
3948
3912
  /**
3949
3913
  * MIME type for type, codetype, and enctype attributes. Use (string & {}) so
3950
3914
  * any MIME type is accepted while suggesting common values in autocomplete.