@marko/compiler 5.20.7 → 5.20.8

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/dist/config.js CHANGED
@@ -151,7 +151,7 @@ var _lassoPackageRoot = require("lasso-package-root");
151
151
 
152
152
  var _fs2 = require("./taglib/fs");let config;const globalThis = typeof window === "undefined" ? global : window;const MARKO_CONFIG_KEY = Symbol("Default Marko Compiler Config");if (globalThis[MARKO_CONFIG_KEY]) {config = globalThis[MARKO_CONFIG_KEY];} else {config = globalThis[MARKO_CONFIG_KEY] = { // The default output mode for compiled templates
153
153
  output: "html", // Override the runtimeid used when calling `marko/components.init` in the `hydrate` output.
154
- runtimeId: undefined, // Have Marko provide the final AST in the compile result.
154
+ runtimeId: null, // Have Marko provide the final AST in the compile result.
155
155
  ast: false, // Set the false to have Marko not generate the final code string, useful if just reading metadata or AST.
156
156
  code: true, /**
157
157
  * Whether the version should be written to the template as a comment e.g.
@@ -184,7 +184,7 @@ var _fs2 = require("./taglib/fs");let config;const globalThis = typeof window ==
184
184
  * This option should be set if `hydrate` output is specified.
185
185
  * Maps a virtual dependency to a resolved file which can be implemented
186
186
  * for specific bundlers.
187
- */resolveVirtualDependency: undefined, /**
187
+ */resolveVirtualDependency: null, /**
188
188
  * Compiling a Marko template may require other (used) Marko templates to compile.
189
189
  * To prevent compiling templates more than once, most of the compilation is cached.
190
190
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.js"],"names":["config","globalThis","window","global","MARKO_CONFIG_KEY","Symbol","output","runtimeId","undefined","ast","code","writeVersionComment","ignoreUnrecognizedTags","sourceMaps","meta","translator","translatorReg","pkg","process","cwd","name","dependencies","test","peerDependencies","devDependencies","fileSystem","fs","modules","optimize","resolveVirtualDependency","cache","Map","hydrateIncludeImports","hot","env","MARKO_CONFIG","Object","assign","JSON","parse"],"mappings":"qJAAA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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nimport { getRootPackage } from \"lasso-package-root\";\n\nlet config;\nconst globalThis = typeof window === \"undefined\" ? global : window;\nconst MARKO_CONFIG_KEY = Symbol(\"Default Marko Compiler Config\");\n\nif (globalThis[MARKO_CONFIG_KEY]) {\n config = globalThis[MARKO_CONFIG_KEY];\n} else {\n config = globalThis[MARKO_CONFIG_KEY] = {\n // The default output mode for compiled templates\n output: \"html\",\n\n // Override the runtimeid used when calling `marko/components.init` in the `hydrate` output.\n runtimeId: undefined,\n\n // Have Marko provide the final AST in the compile result.\n ast: false,\n\n // Set the false to have Marko not generate the final code string, useful if just reading metadata or AST.\n code: true,\n\n /**\n * Whether the version should be written to the template as a comment e.g.\n * // Compiled using marko@x.x.x - DO NOT EDIT\n */\n writeVersionComment: true,\n\n /**\n * Whether unrecognized tags should be ignored or not. This flag will\n * be enabled by default when compiling XML.\n */\n ignoreUnrecognizedTags: false,\n\n /**\n * Whether source maps should be output with the compiled templates.\n * When `true` a `map` property will be available on the compile result.\n * When `\"inline\"` the sourcemap will be inlined as a comment in the output code.\n * When `\"both\"` both of the above will be used.\n */\n sourceMaps: false,\n\n /**\n * This option inlines all of the meta data in the template.\n * You can also access this metadata via `compile(...).meta`.\n * This API is sticking around for compatibility purposes.\n */\n meta: false,\n\n /**\n * Allows configuring Marko to compile to different runtimes.\n */\n translator: (() => {\n const translatorReg = /^(@marko\\/|marko-)translator-/;\n let translator;\n let pkg;\n\n try {\n pkg = getRootPackage(process.cwd());\n // eslint-disable-next-line no-empty\n } catch {}\n\n if (pkg) {\n for (const name in pkg.dependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n\n for (const name in pkg.peerDependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n\n for (const name in pkg.devDependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n }\n\n return translator || \"@marko/translator-default\";\n })(),\n\n /**\n * Use a different file system object, eg webpacks CachedInputFileSystem or lasso-caching-fs\n */\n fileSystem: fs,\n /**\n * By default Marko 5 outputs esm, you can optionally specify commonjs.\n *\n * Valid options: esm | cjs\n */\n modules: \"esm\",\n\n /**\n * Enables production mode optimizations if true, or not if false.\n * If left as undefined checks for env === \"production\".\n */\n optimize: undefined,\n\n /**\n * This option should be set if `hydrate` output is specified.\n * Maps a virtual dependency to a resolved file which can be implemented\n * for specific bundlers.\n */\n resolveVirtualDependency: undefined,\n\n /**\n * Compiling a Marko template may require other (used) Marko templates to compile.\n * To prevent compiling templates more than once, most of the compilation is cached.\n *\n * The default cache strategy is to clear the cache on every macrotask.\n * If the default cache is overwritten it is up to the user to determine when the\n * cache is cleared.\n */\n cache: new Map(),\n\n /**\n * A regexp or function that receives an import path that matches file types known to be client side assets.\n */\n hydrateIncludeImports:\n /\\.(css|less|s[ac]ss|styl|png|jpe?g|gif|svg|ico|webp|avif|mp4|webm|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf)$/,\n\n /**\n * Set to true in order to bring in the hot module replacement runtime.\n */\n hot: false\n };\n\n if (process.env.MARKO_CONFIG) {\n Object.assign(config, JSON.parse(process.env.MARKO_CONFIG));\n }\n}\n\nexport default config;\n\nimport { setFS } from \"./taglib/fs\";\nsetFS(config.fileSystem);\n"],"file":"config.js"}
1
+ {"version":3,"sources":["../src/config.js"],"names":["config","globalThis","window","global","MARKO_CONFIG_KEY","Symbol","output","runtimeId","ast","code","writeVersionComment","ignoreUnrecognizedTags","sourceMaps","meta","translator","translatorReg","pkg","process","cwd","name","dependencies","test","peerDependencies","devDependencies","fileSystem","fs","modules","optimize","undefined","resolveVirtualDependency","cache","Map","hydrateIncludeImports","hot","env","MARKO_CONFIG","Object","assign","JSON","parse"],"mappings":"qJAAA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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GAAGK,IAAb,CACD,CACF,CAED,KAAK,MAAMA,IAAX,IAAmBH,GAAG,CAACM,gBAAvB,EAAyC,CACvC,IAAIP,aAAa,CAACM,IAAd,CAAmBF,IAAnB,CAAJ,EAA8B,CAC5B,IAAIL,UAAU,IAAIA,UAAU,KAAKK,IAAjC,EAAuC,CACrC,OACD,CAEDL,UAAU,GAAGK,IAAb,CACD,CACF,CAED,KAAK,MAAMA,IAAX,IAAmBH,GAAG,CAACO,eAAvB,EAAwC,CACtC,IAAIR,aAAa,CAACM,IAAd,CAAmBF,IAAnB,CAAJ,EAA8B,CAC5B,IAAIL,UAAU,IAAIA,UAAU,KAAKK,IAAjC,EAAuC,CACrC,OACD,CAEDL,UAAU,GAAGK,IAAb,CACD,CACF,CACF,CAED,OAAOL,UAAU,IAAI,2BAArB,CACD,CA3CW,GA3C0B,EAwFtC;AACJ;AACA,OACIU,UAAU,EAAEC,WA3F0B,EA4FtC;AACJ;AACA;AACA;AACA,OACIC,OAAO,EAAE,KAjG6B,EAmGtC;AACJ;AACA;AACA,OACIC,QAAQ,EAAEC,SAvG4B,EAyGtC;AACJ;AACA;AACA;AACA,OACIC,wBAAwB,EAAE,IA9GY,EAgHtC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,OACIC,KAAK,EAAE,IAAIC,GAAJ,EAxH+B,EA0HtC;AACJ;AACA,OACIC,qBAAqB,EACnB,6GA9HoC,EAgItC;AACJ;AACA,OACIC,GAAG,EAAE,KAnIiC,EAAxC,CAsIA,IAAIhB,OAAO,CAACiB,GAAR,CAAYC,YAAhB,EAA8B,CAC5BC,MAAM,CAACC,MAAP,CAAcrC,MAAd,EAAsBsC,IAAI,CAACC,KAAL,CAAWtB,OAAO,CAACiB,GAAR,CAAYC,YAAvB,CAAtB,EACD,CACF,C,eAEcnC,M,4BAGf,gBAAMA,MAAM,CAACwB,UAAb","sourcesContent":["import fs from \"fs\";\nimport { getRootPackage } from \"lasso-package-root\";\n\nlet config;\nconst globalThis = typeof window === \"undefined\" ? global : window;\nconst MARKO_CONFIG_KEY = Symbol(\"Default Marko Compiler Config\");\n\nif (globalThis[MARKO_CONFIG_KEY]) {\n config = globalThis[MARKO_CONFIG_KEY];\n} else {\n config = globalThis[MARKO_CONFIG_KEY] = {\n // The default output mode for compiled templates\n output: \"html\",\n\n // Override the runtimeid used when calling `marko/components.init` in the `hydrate` output.\n runtimeId: null,\n\n // Have Marko provide the final AST in the compile result.\n ast: false,\n\n // Set the false to have Marko not generate the final code string, useful if just reading metadata or AST.\n code: true,\n\n /**\n * Whether the version should be written to the template as a comment e.g.\n * // Compiled using marko@x.x.x - DO NOT EDIT\n */\n writeVersionComment: true,\n\n /**\n * Whether unrecognized tags should be ignored or not. This flag will\n * be enabled by default when compiling XML.\n */\n ignoreUnrecognizedTags: false,\n\n /**\n * Whether source maps should be output with the compiled templates.\n * When `true` a `map` property will be available on the compile result.\n * When `\"inline\"` the sourcemap will be inlined as a comment in the output code.\n * When `\"both\"` both of the above will be used.\n */\n sourceMaps: false,\n\n /**\n * This option inlines all of the meta data in the template.\n * You can also access this metadata via `compile(...).meta`.\n * This API is sticking around for compatibility purposes.\n */\n meta: false,\n\n /**\n * Allows configuring Marko to compile to different runtimes.\n */\n translator: (() => {\n const translatorReg = /^(@marko\\/|marko-)translator-/;\n let translator;\n let pkg;\n\n try {\n pkg = getRootPackage(process.cwd());\n // eslint-disable-next-line no-empty\n } catch {}\n\n if (pkg) {\n for (const name in pkg.dependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n\n for (const name in pkg.peerDependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n\n for (const name in pkg.devDependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n }\n\n return translator || \"@marko/translator-default\";\n })(),\n\n /**\n * Use a different file system object, eg webpacks CachedInputFileSystem or lasso-caching-fs\n */\n fileSystem: fs,\n /**\n * By default Marko 5 outputs esm, you can optionally specify commonjs.\n *\n * Valid options: esm | cjs\n */\n modules: \"esm\",\n\n /**\n * Enables production mode optimizations if true, or not if false.\n * If left as undefined checks for env === \"production\".\n */\n optimize: undefined,\n\n /**\n * This option should be set if `hydrate` output is specified.\n * Maps a virtual dependency to a resolved file which can be implemented\n * for specific bundlers.\n */\n resolveVirtualDependency: null,\n\n /**\n * Compiling a Marko template may require other (used) Marko templates to compile.\n * To prevent compiling templates more than once, most of the compilation is cached.\n *\n * The default cache strategy is to clear the cache on every macrotask.\n * If the default cache is overwritten it is up to the user to determine when the\n * cache is cleared.\n */\n cache: new Map(),\n\n /**\n * A regexp or function that receives an import path that matches file types known to be client side assets.\n */\n hydrateIncludeImports:\n /\\.(css|less|s[ac]ss|styl|png|jpe?g|gif|svg|ico|webp|avif|mp4|webm|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf)$/,\n\n /**\n * Set to true in order to bring in the hot module replacement runtime.\n */\n hot: false\n };\n\n if (process.env.MARKO_CONFIG) {\n Object.assign(config, JSON.parse(process.env.MARKO_CONFIG));\n }\n}\n\nexport default config;\n\nimport { setFS } from \"./taglib/fs\";\nsetFS(config.fileSystem);\n"],"file":"config.js"}
@@ -1187,7 +1187,7 @@ export interface BabelFile {
1187
1187
  watchFiles: string[]
1188
1188
  }
1189
1189
  },
1190
- markoOpts: import('@marko/compiler').Config
1190
+ markoOpts: Required<import('@marko/compiler').Config>
1191
1191
  }
1192
1192
 
1193
1193
  export interface HubInterface {
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@ type Dep = {
16
16
 
17
17
  export type Config = {
18
18
  output?: "html" | "dom" | "hydrate" | "migrate" | "source";
19
- runtimeId?: string;
19
+ runtimeId?: string | null;
20
20
  ast?: boolean;
21
21
  code?: boolean;
22
22
  writeVersionComment?: boolean;
@@ -25,7 +25,7 @@ export type Config = {
25
25
  translator?: any;
26
26
  fileSystem?: typeof import("fs");
27
27
  modules?: "esm" | "cjs";
28
- resolveVirtualDependency?(filename: string, dep: { virtualPath: string, code: string, map?: SourceMap }): string;
28
+ resolveVirtualDependency?: ((filename: string, dep: { virtualPath: string, code: string, map?: SourceMap }) => string) | null;
29
29
  hydrateIncludeImports?: RegExp | ((request: string) => boolean);
30
30
  optimize?: boolean;
31
31
  cache?: Map<unknown, unknown>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
3
  "description": "Marko template to JS compiler.",
4
- "version": "5.20.7",
4
+ "version": "5.20.8",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
7
7
  "dependencies": {
@@ -13,7 +13,7 @@
13
13
  "@babel/runtime": "^7.16.0",
14
14
  "@babel/traverse": "^7.16.0",
15
15
  "@babel/types": "^7.16.0",
16
- "@marko/babel-utils": "^5.20.7",
16
+ "@marko/babel-utils": "^5.20.8",
17
17
  "complain": "^1.6.0",
18
18
  "he": "^1.2.0",
19
19
  "htmljs-parser": "^2.11.1",
@@ -28,7 +28,7 @@
28
28
  "strip-json-comments": "^3.1.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@marko/translator-default": "^5.20.7"
31
+ "@marko/translator-default": "^5.20.8"
32
32
  },
33
33
  "files": [
34
34
  "dist",
@@ -59,5 +59,5 @@
59
59
  "url": "https://github.com/marko-js/marko/tree/master/packages/compiler"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "gitHead": "e980c3a4d2dc5cc37b75b98f07ef2e7856c892fb"
62
+ "gitHead": "8d1abfa37468bd28d781c2a26d49a582acba66d2"
63
63
  }