marko 5.18.1 → 5.19.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,11 @@ var defaults = extend({}, globalConfig);
16
16
 
17
17
 
18
18
 
19
+
20
+
21
+
22
+
23
+
19
24
  var defaultOptionsExportDefinition = {
20
25
  get: function () {
21
26
  return globalConfig;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compiler/index.js"],"names":["compiler","require","extend","globalConfig","ok","fs","taglib","defaults","defaultOptionsExportDefinition","get","enumerable","configurable","Object","defineProperties","exports","defaultOptions","config","configure","newConfig","resultCompat","code","meta","map","options","sourceOnly","_compile","src","filename","userConfig","callback","compile","then","result","error","compileSync","compileForBrowser","output","compileFile","readFile","encoding","err","templateSrc","readFileSync","compileFileForBrowser","taglibLookup","lookup","taglibLoader","loader","taglibFinder","finder","buildTaglibLookup","buildLookup","clearCaches","_clearDefaults","clearCache","registerTaglib","filePath","registerFromFile","isVDOMSupported"],"mappings":"AAAA;;;AAGA,IAAIA,QAAQ,GAAGC,OAAO,CAAC,iBAAD,CAAtB;AACA,IAAIC,MAAM,GAAGD,OAAO,CAAC,oBAAD,CAApB;AACA,IAAIE,YAAY,GAAGF,OAAO,CAAC,UAAD,CAA1B;AACA,IAAIG,EAAE,GAAGH,OAAO,CAAC,QAAD,CAAP,CAAkBG,EAA3B;AACA,IAAIC,EAAE,GAAGJ,OAAO,CAAC,IAAD,CAAhB;AACA,IAAIK,MAAM,GAAGL,OAAO,CAAC,WAAD,CAApB;AACA,IAAIM,QAAQ,GAAGL,MAAM,CAAC,EAAD,EAAKC,YAAL,CAArB;;AAEA;;;;;;;AAOA,IAAIK,8BAA8B,GAAG;AACnCC,EAAAA,GAAG,EAAE,YAAY;AACf,WAAON,YAAP;AACD,GAHkC;AAInCO,EAAAA,UAAU,EAAE,IAJuB;AAKnCC,EAAAA,YAAY,EAAE,KALqB,EAArC;;;AAQAC,MAAM,CAACC,gBAAP,CAAwBC,OAAxB,EAAiC;AAC/BC,EAAAA,cAAc,EAAEP,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AA5B;AACArB,OAAO,CAAC6B,qBAAR,GAAgCA,qBAAhC;;AAEA7B,OAAO,CAACG,SAAR,GAAoBA,SAApB;;AAEAH,OAAO,CAAC8B,YAAR,GAAuBtC,MAAM,CAACuC,MAA9B;AACA/B,OAAO,CAACgC,YAAR,GAAuBxC,MAAM,CAACyC,MAA9B;AACAjC,OAAO,CAACkC,YAAR,GAAuB1C,MAAM,CAAC2C,MAA9B;AACAnC,OAAO,CAACoC,iBAAR,GAA4B5C,MAAM,CAACuC,MAAP,CAAcM,WAA1C;AACArC,OAAO,CAACsC,WAAR,GAAsB,SAASA,WAAT,GAAuB;AAC3CpD,EAAAA,QAAQ,CAACqD,cAAT;AACA/C,EAAAA,MAAM,CAACgD,UAAP;AACD,CAHD;;AAKAxC,OAAO,CAACyC,cAAR,GAAyB,UAAUC,QAAV,EAAoB;AAC3CpD,EAAAA,EAAE,CAAC,OAAOoD,QAAP,KAAoB,QAArB,EAA+B,+BAA/B,CAAF;AACAlD,EAAAA,MAAM,CAACmD,gBAAP,CAAwBD,QAAxB;AACA1C,EAAAA,OAAO,CAACsC,WAAR;AACD,CAJD;;AAMAtC,OAAO,CAAC4C,eAAR,GAA0B,IAA1B","sourcesContent":["\"use strict\";\n\nvar complain = \"MARKO_DEBUG\" && require(\"complain\");\nvar compiler = require(\"@marko/compiler\");\nvar extend = require(\"raptor-util/extend\");\nvar globalConfig = require(\"./config\");\nvar ok = require(\"assert\").ok;\nvar fs = require(\"fs\");\nvar taglib = require(\"../taglib\");\nvar defaults = extend({}, globalConfig);\n\n// eslint-disable-next-line no-constant-condition\nif (\"MARKO_DEBUG\") {\n complain(\n \"Using `marko/compiler` has been deprecated, please upgrade to the `@marko/compiler` module.\"\n );\n}\n\nvar defaultOptionsExportDefinition = {\n get: function () {\n return globalConfig;\n },\n enumerable: true,\n configurable: false\n};\n\nObject.defineProperties(exports, {\n defaultOptions: defaultOptionsExportDefinition,\n config: defaultOptionsExportDefinition\n});\n\nfunction configure(newConfig) {\n if (!newConfig) {\n newConfig = {};\n }\n\n globalConfig = extend({}, defaults);\n extend(globalConfig, newConfig);\n\n compiler.configure(newConfig);\n}\n\nfunction resultCompat({ code, meta, map }, options = {}) {\n if (options.sourceOnly !== false) {\n return code;\n } else {\n return { code, meta, map };\n }\n}\n\nfunction _compile(src, filename, userConfig, callback) {\n ok(filename, '\"filename\" argument is required');\n ok(typeof filename === \"string\", '\"filename\" argument should be a string');\n var options = {};\n\n extend(options, globalConfig);\n\n if (userConfig) {\n extend(options, userConfig);\n }\n\n if (callback) {\n compiler.compile(src, filename, options).then(\n result => callback(null, resultCompat(result, options)),\n error => callback(error)\n );\n } else {\n return resultCompat(compiler.compileSync(src, filename, options), options);\n }\n}\n\nfunction compile(src, filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n options = options || {};\n options.sourceOnly = options.sourceOnly !== false;\n\n return _compile(src, filename, options, callback);\n}\n\nfunction compileForBrowser(src, filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n options = extend(\n {\n output: \"dom\",\n meta: false,\n sourceOnly: false\n },\n options\n );\n\n return compile(src, filename, options, callback);\n}\n\nfunction compileFile(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n options = options || {};\n options.sourceOnly = options.sourceOnly !== false;\n\n if (callback) {\n fs.readFile(filename, { encoding: \"utf8\" }, function (err, templateSrc) {\n if (err) {\n return callback(err);\n }\n\n _compile(templateSrc, filename, options, callback);\n });\n } else {\n let templateSrc = fs.readFileSync(filename, { encoding: \"utf8\" });\n return _compile(templateSrc, filename, options, callback);\n }\n}\n\nfunction compileFileForBrowser(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n options = extend({ output: \"dom\", meta: false, sourceOnly: false }, options);\n return compileFile(filename, options, callback);\n}\n\nexports.compileFile = compileFile;\nexports.compile = compile;\nexports.compileForBrowser = compileForBrowser;\nexports.compileFileForBrowser = compileFileForBrowser;\n\nexports.configure = configure;\n\nexports.taglibLookup = taglib.lookup;\nexports.taglibLoader = taglib.loader;\nexports.taglibFinder = taglib.finder;\nexports.buildTaglibLookup = taglib.lookup.buildLookup;\nexports.clearCaches = function clearCaches() {\n compiler._clearDefaults();\n taglib.clearCache();\n};\n\nexports.registerTaglib = function (filePath) {\n ok(typeof filePath === \"string\", '\"filePath\" should be a string');\n taglib.registerFromFile(filePath);\n exports.clearCaches();\n};\n\nexports.isVDOMSupported = true;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/compiler/index.js"],"names":["compiler","require","extend","globalConfig","ok","fs","taglib","defaults","defaultOptionsExportDefinition","get","enumerable","configurable","Object","defineProperties","exports","defaultOptions","config","configure","newConfig","resultCompat","code","meta","map","options","sourceOnly","_compile","src","filename","userConfig","callback","compile","then","result","error","compileSync","compileForBrowser","output","compileFile","readFile","encoding","err","templateSrc","readFileSync","compileFileForBrowser","taglibLookup","lookup","taglibLoader","loader","taglibFinder","finder","buildTaglibLookup","buildLookup","clearCaches","_clearDefaults","clearCache","registerTaglib","filePath","registerFromFile","isVDOMSupported"],"mappings":"AAAA;;;AAGA,IAAIA,QAAQ,GAAGC,OAAO,CAAC,iBAAD,CAAtB;AACA,IAAIC,MAAM,GAAGD,OAAO,CAAC,oBAAD,CAApB;AACA,IAAIE,YAAY,GAAGF,OAAO,CAAC,UAAD,CAA1B;AACA,IAAIG,EAAE,GAAGH,OAAO,CAAC,QAAD,CAAP,CAAkBG,EAA3B;AACA,IAAIC,EAAE,GAAGJ,OAAO,CAAC,IAAD,CAAhB;AACA,IAAIK,MAAM,GAAGL,OAAO,CAAC,WAAD,CAApB;AACA,IAAIM,QAAQ,GAAGL,MAAM,CAAC,EAAD,EAAKC,YAAL,CAArB;;AAEA;;;;;;;;;;;;AAYA,IAAIK,8BAA8B,GAAG;AACnCC,EAAAA,GAAG,EAAE,YAAY;AACf,WAAON,YAAP;AACD,GAHkC;AAInCO,EAAAA,UAAU,EAAE,I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D;;AAEDf,OAAO,CAACuB,WAAR,GAAsBA,WAAtB;AACAvB,OAAO,CAACgB,OAAR,GAAkBA,OAAlB;AACAhB,OAAO,CAACqB,iBAAR,GAA4BA,iBAA5B;AACArB,OAAO,CAAC6B,qBAAR,GAAgCA,qBAAhC;;AAEA7B,OAAO,CAACG,SAAR,GAAoBA,SAApB;;AAEAH,OAAO,CAAC8B,YAAR,GAAuBtC,MAAM,CAACuC,MAA9B;AACA/B,OAAO,CAACgC,YAAR,GAAuBxC,MAAM,CAACyC,MAA9B;AACAjC,OAAO,CAACkC,YAAR,GAAuB1C,MAAM,CAAC2C,MAA9B;AACAnC,OAAO,CAACoC,iBAAR,GAA4B5C,MAAM,CAACuC,MAAP,CAAcM,WAA1C;AACArC,OAAO,CAACsC,WAAR,GAAsB,SAASA,WAAT,GAAuB;AAC3CpD,EAAAA,QAAQ,CAACqD,cAAT;AACA/C,EAAAA,MAAM,CAACgD,UAAP;AACD,CAHD;;AAKAxC,OAAO,CAACyC,cAAR,GAAyB,UAAUC,QAAV,EAAoB;AAC3CpD,EAAAA,EAAE,CAAC,OAAOoD,QAAP,KAAoB,QAArB,EAA+B,+BAA/B,CAAF;AACAlD,EAAAA,MAAM,CAACmD,gBAAP,CAAwBD,QAAxB;AACA1C,EAAAA,OAAO,CAACsC,WAAR;AACD,CAJD;;AAMAtC,OAAO,CAAC4C,eAAR,GAA0B,IAA1B","sourcesContent":["\"use strict\";\n\nvar complain = \"MARKO_DEBUG\" && require(\"complain\");\nvar compiler = require(\"@marko/compiler\");\nvar extend = require(\"raptor-util/extend\");\nvar globalConfig = require(\"./config\");\nvar ok = require(\"assert\").ok;\nvar fs = require(\"fs\");\nvar taglib = require(\"../taglib\");\nvar defaults = extend({}, globalConfig);\n\n// eslint-disable-next-line no-constant-condition\nif (\"MARKO_DEBUG\") {\n if (\n require.main &&\n require.main.filename !== require.resolve(\"../../bin/markoc\")\n ) {\n complain(\n \"Using `marko/compiler` has been deprecated, please upgrade to the `@marko/compiler` module.\"\n );\n }\n}\n\nvar defaultOptionsExportDefinition = {\n get: function () {\n return globalConfig;\n },\n enumerable: true,\n configurable: false\n};\n\nObject.defineProperties(exports, {\n defaultOptions: defaultOptionsExportDefinition,\n config: defaultOptionsExportDefinition\n});\n\nfunction configure(newConfig) {\n if (!newConfig) {\n newConfig = {};\n }\n\n globalConfig = extend({}, defaults);\n extend(globalConfig, newConfig);\n\n compiler.configure(newConfig);\n}\n\nfunction resultCompat({ code, meta, map }, options = {}) {\n if (options.sourceOnly !== false) {\n return code;\n } else {\n return { code, meta, map };\n }\n}\n\nfunction _compile(src, filename, userConfig, callback) {\n ok(filename, '\"filename\" argument is required');\n ok(typeof filename === \"string\", '\"filename\" argument should be a string');\n var options = {};\n\n extend(options, globalConfig);\n\n if (userConfig) {\n extend(options, userConfig);\n }\n\n if (callback) {\n compiler.compile(src, filename, options).then(\n result => callback(null, resultCompat(result, options)),\n error => callback(error)\n );\n } else {\n return resultCompat(compiler.compileSync(src, filename, options), options);\n }\n}\n\nfunction compile(src, filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n options = options || {};\n options.sourceOnly = options.sourceOnly !== false;\n\n return _compile(src, filename, options, callback);\n}\n\nfunction compileForBrowser(src, filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n options = extend(\n {\n output: \"dom\",\n meta: false,\n sourceOnly: false\n },\n options\n );\n\n return compile(src, filename, options, callback);\n}\n\nfunction compileFile(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n options = options || {};\n options.sourceOnly = options.sourceOnly !== false;\n\n if (callback) {\n fs.readFile(filename, { encoding: \"utf8\" }, function (err, templateSrc) {\n if (err) {\n return callback(err);\n }\n\n _compile(templateSrc, filename, options, callback);\n });\n } else {\n let templateSrc = fs.readFileSync(filename, { encoding: \"utf8\" });\n return _compile(templateSrc, filename, options, callback);\n }\n}\n\nfunction compileFileForBrowser(filename, options, callback) {\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n options = extend({ output: \"dom\", meta: false, sourceOnly: false }, options);\n return compileFile(filename, options, callback);\n}\n\nexports.compileFile = compileFile;\nexports.compile = compile;\nexports.compileForBrowser = compileForBrowser;\nexports.compileFileForBrowser = compileFileForBrowser;\n\nexports.configure = configure;\n\nexports.taglibLookup = taglib.lookup;\nexports.taglibLoader = taglib.loader;\nexports.taglibFinder = taglib.finder;\nexports.buildTaglibLookup = taglib.lookup.buildLookup;\nexports.clearCaches = function clearCaches() {\n compiler._clearDefaults();\n taglib.clearCache();\n};\n\nexports.registerTaglib = function (filePath) {\n ok(typeof filePath === \"string\", '\"filePath\" should be a string');\n taglib.registerFromFile(filePath);\n exports.clearCaches();\n};\n\nexports.isVDOMSupported = true;\n"],"file":"index.js"}
package/docs/compiler.md CHANGED
@@ -361,6 +361,13 @@ At this stage, you are given a fully parsed and migrated AST to do what you will
361
361
 
362
362
  To hook into the `transform` stage you can use the `transform` option in the `marko.json` file.
363
363
 
364
+ ### Analyze
365
+
366
+ Next up is the analyze stage. This stage is intended to do non mutative analysis of the entire AST in a way that is cached in memory.
367
+ Meta data should be stored on the `.extra` property of nodes and typically read in the [translate](#translate) stage, or using the child template analysis helpers.
368
+
369
+ To hook into the `analyze` stage you can use the `analyze` option in the `marko.json` file.
370
+
364
371
  ### Translate
365
372
 
366
373
  Finally, we have the translation stage. This stage is Marko's "Rosetta Stone" and is responsible for turning your beautiful Marko code into the optimized JavaScript you'd rather avoid writing.
@@ -113,6 +113,7 @@ Typically, you should let Marko find these files automatically, but here is a re
113
113
  "parse": "./parse.js", // Used to augment parsing.
114
114
  "migrate": "./migrate.js", // Used for migrating deprecated features.
115
115
  "transform": "./transform.js", // Used to modify the AST before generating it.
116
+ "analyze": "./analyze.js" // Used to analyze metadata the entire ast before beginning to translate it.
116
117
  "translate": "./translate.js" // Used to generate custom JS.
117
118
  }
118
119
  ```
@@ -633,7 +633,7 @@ response stream:
633
633
  require("./components/hello").render({ name: "John" }, res);
634
634
  ```
635
635
 
636
- > The user’s of a Marko UI component do not need to know that the component was
636
+ > The users of a Marko UI component do not need to know that the component was
637
637
  > implemented using Marko.
638
638
 
639
639
  Contrast this with React as an example:
package/docs/state.md CHANGED
@@ -3,7 +3,7 @@
3
3
  The output of a component is based on input properties passed from its parent as attributes. However, a component may also maintain internal state that it uses to control its view. If Marko detects a change to either input or to the internal state, the view will automatically be updated.
4
4
 
5
5
  > **ProTip:**
6
- > Only data that is owned and modified by the component should go into its `state`. State should be exclusively used for data that triggers rerenders. Parents control `input` the component controls its own `state`.
6
+ > Only data that is owned and modified by the component should go into its `state`. State should be exclusively used for data that triggers rerenders. Parents control `input`, and the component controls its own `state`.
7
7
 
8
8
  ## Initializing state
9
9
 
package/docs/syntax.md CHANGED
@@ -583,7 +583,7 @@ As a shorthand you can also import components by providing it's html tag name wr
583
583
  import MyComponent from "<my-component>"
584
584
  ```
585
585
 
586
- This is especially useful with the [dynamic tag name syntax]("#dynamic-tagname") and uses the same [component discovery](./custom-tags.md#how-tags-are-discovered) as if the tag was used in the template.
586
+ This is especially useful with the [dynamic tag name syntax](./syntax.md#dynamic-tagname) and uses the same [component discovery](./custom-tags.md#how-tags-are-discovered) as if the tag was used in the template.
587
587
 
588
588
  ## Comments
589
589
 
package/docs/vite.md CHANGED
@@ -18,7 +18,7 @@ export default defineConfig({
18
18
 
19
19
  # Linked Mode
20
20
 
21
- By default this plugin operates in `linked` mode (you can disabled this by passing [`linked: false` as an option](#options.linked)). In `linked` mode the plugin automatically discovers all of the entry `.marko` files while compiling the server, and tells `Vite` which modules to load in the browser.
21
+ By default this plugin operates in `linked` mode (you can disabled this by passing [`linked: false` as an option](#optionslinked)). In `linked` mode the plugin automatically discovers all of the entry `.marko` files while compiling the server, and tells `Vite` which modules to load in the browser.
22
22
 
23
23
  With this you _do not_ create `.html` files for `Vite`, it's Marko all the way down!
24
24
  Scripts, styles and other content that _would have_ been injected into the `.html` files is instead automatically injected into your `.marko` templates.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.18.1",
3
+ "version": "5.19.2",
4
4
  "license": "MIT",
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "dependencies": {
7
- "@marko/compiler": "^5.18.1",
8
- "@marko/translator-default": "^5.18.1",
7
+ "@marko/compiler": "^5.19.0",
8
+ "@marko/translator-default": "^5.19.2",
9
9
  "app-module-path": "^2.2.0",
10
10
  "argly": "^1.2.0",
11
11
  "browser-refresh-client": "1.1.4",
@@ -72,5 +72,5 @@
72
72
  "index.js",
73
73
  "node-require.js"
74
74
  ],
75
- "gitHead": "9d5254c0a1739b1607c3c0edbe7c9d2b00e70838"
75
+ "gitHead": "b229fc19a03f96a44a8f58b852097a4f72ca080c"
76
76
  }
@@ -11,9 +11,14 @@ var defaults = extend({}, globalConfig);
11
11
 
12
12
  // eslint-disable-next-line no-constant-condition
13
13
  if ("MARKO_DEBUG") {
14
- complain(
15
- "Using `marko/compiler` has been deprecated, please upgrade to the `@marko/compiler` module."
16
- );
14
+ if (
15
+ require.main &&
16
+ require.main.filename !== require.resolve("../../bin/markoc")
17
+ ) {
18
+ complain(
19
+ "Using `marko/compiler` has been deprecated, please upgrade to the `@marko/compiler` module."
20
+ );
21
+ }
17
22
  }
18
23
 
19
24
  var defaultOptionsExportDefinition = {