marko 5.29.2 → 5.30.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/README.md +1 -1
  2. package/bin/markoc.js +18 -18
  3. package/dist/core-tags/core/await/renderer.js +5 -1
  4. package/dist/node_modules/@internal/components-beginComponent/index.js +13 -3
  5. package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +331 -0
  6. package/dist/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
  7. package/dist/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
  8. package/dist/node_modules/@internal/components-entry/index-browser.js +2 -2
  9. package/dist/node_modules/@internal/components-entry/index.js +73 -45
  10. package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
  11. package/dist/node_modules/@internal/components-entry-legacy/index.js +15 -0
  12. package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
  13. package/dist/node_modules/@internal/components-registry/index-browser.js +70 -43
  14. package/dist/node_modules/@internal/components-registry/index.js +2 -2
  15. package/dist/node_modules/@internal/components-util/index-browser.js +17 -17
  16. package/dist/node_modules/@internal/components-util/index.js +18 -8
  17. package/dist/node_modules/@internal/create-readable/index-browser.js +1 -1
  18. package/dist/node_modules/@internal/create-readable/index.js +9 -9
  19. package/dist/node_modules/@internal/set-immediate/index-browser.js +1 -1
  20. package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -2
  21. package/dist/node_modules/@internal/set-immediate/index.js +2 -2
  22. package/dist/runtime/RenderResult.js +3 -3
  23. package/dist/runtime/components/Component.js +146 -148
  24. package/dist/runtime/components/ComponentDef.js +41 -27
  25. package/dist/runtime/components/ComponentsContext.js +6 -6
  26. package/dist/runtime/components/GlobalComponentsContext.js +3 -3
  27. package/dist/runtime/components/KeySequence.js +3 -3
  28. package/dist/runtime/components/ServerComponent.js +13 -13
  29. package/dist/runtime/components/State.js +27 -27
  30. package/dist/runtime/components/attach-detach.js +7 -7
  31. package/dist/runtime/components/defineComponent.js +5 -5
  32. package/dist/runtime/components/dom-data.js +6 -6
  33. package/dist/runtime/components/event-delegation.js +10 -10
  34. package/dist/runtime/components/legacy/browser.json +9 -0
  35. package/dist/runtime/components/legacy/defineComponent-legacy.js +32 -0
  36. package/dist/runtime/components/legacy/defineRenderer-legacy.js +171 -0
  37. package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -0
  38. package/dist/runtime/components/legacy/dependencies/html.js +3 -0
  39. package/dist/runtime/components/legacy/dependencies/index.js +178 -0
  40. package/dist/runtime/components/legacy/dependencies/vdom.js +3 -0
  41. package/dist/runtime/components/legacy/index.js +1 -0
  42. package/dist/runtime/components/legacy/jquery.js +51 -0
  43. package/dist/runtime/components/legacy/ready.js +152 -0
  44. package/dist/runtime/components/legacy/renderer-legacy.js +230 -0
  45. package/dist/runtime/components/renderer.js +30 -26
  46. package/dist/runtime/components/update-manager.js +10 -10
  47. package/dist/runtime/createOut.js +1 -1
  48. package/dist/runtime/dom-insert.js +5 -5
  49. package/dist/runtime/helpers/_change-case.js +2 -2
  50. package/dist/runtime/helpers/dynamic-tag.js +7 -9
  51. package/dist/runtime/helpers/style-value.js +7 -2
  52. package/dist/runtime/html/AsyncStream.js +20 -20
  53. package/dist/runtime/html/BufferedWriter.js +2 -2
  54. package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
  55. package/dist/runtime/html/helpers/attr.js +19 -6
  56. package/dist/runtime/html/helpers/attrs.js +7 -0
  57. package/dist/runtime/html/helpers/data-marko.js +2 -2
  58. package/dist/runtime/html/helpers/escape-quotes.js +1 -1
  59. package/dist/runtime/html/helpers/escape-xml.js +1 -1
  60. package/dist/runtime/html/helpers/merge-attrs.js +38 -7
  61. package/dist/runtime/html/index.js +2 -2
  62. package/dist/runtime/renderable.js +9 -6
  63. package/dist/runtime/vdom/AsyncVDOMBuilder.js +86 -86
  64. package/dist/runtime/vdom/VComponent.js +3 -3
  65. package/dist/runtime/vdom/VDocumentFragment.js +7 -7
  66. package/dist/runtime/vdom/VElement.js +61 -50
  67. package/dist/runtime/vdom/VFragment.js +8 -8
  68. package/dist/runtime/vdom/VNode.js +36 -36
  69. package/dist/runtime/vdom/VText.js +8 -8
  70. package/dist/runtime/vdom/helpers/attrs.js +24 -4
  71. package/dist/runtime/vdom/helpers/merge-attrs.js +16 -0
  72. package/dist/runtime/vdom/helpers/v-element.js +1 -1
  73. package/dist/runtime/vdom/helpers/v-text.js +1 -1
  74. package/dist/runtime/vdom/hot-reload.js +19 -19
  75. package/dist/runtime/vdom/index.js +2 -2
  76. package/dist/runtime/vdom/morphdom/fragment.js +5 -5
  77. package/dist/runtime/vdom/morphdom/helpers.js +5 -5
  78. package/dist/runtime/vdom/morphdom/index.js +56 -56
  79. package/dist/runtime/vdom/morphdom/specialElHandlers.js +7 -7
  80. package/dist/runtime/vdom/preserve-attrs.js +1 -1
  81. package/dist/runtime/vdom/vdom.js +14 -14
  82. package/docs/10-awesome-marko-features.md +1 -1
  83. package/docs/body-content.md +3 -3
  84. package/docs/class-components.md +6 -6
  85. package/docs/cloudflare-workers.md +3 -3
  86. package/docs/compiler.md +5 -5
  87. package/docs/express.md +2 -2
  88. package/docs/http.md +1 -1
  89. package/docs/koa.md +1 -1
  90. package/docs/lasso.md +1 -1
  91. package/docs/marko-vs-react.md +2 -2
  92. package/docs/rendering.md +6 -6
  93. package/docs/rollup.md +30 -30
  94. package/docs/troubleshooting-streaming.md +1 -1
  95. package/docs/typescript.md +1 -1
  96. package/docs/vite.md +3 -3
  97. package/docs/webpack.md +25 -25
  98. package/docs/why-is-marko-fast.md +2 -2
  99. package/index.d.ts +1 -0
  100. package/legacy-components-browser.marko +15 -0
  101. package/legacy-components.js +7 -0
  102. package/package.json +51 -45
  103. package/src/compiler/config.js +1 -1
  104. package/src/compiler/index.js +5 -5
  105. package/src/core-tags/core/__flush_here_and_after__.js +1 -1
  106. package/src/core-tags/core/await/AsyncValue.js +1 -1
  107. package/src/core-tags/core/await/renderer.js +8 -4
  108. package/src/core-tags/core/await/reorderer-renderer.js +1 -1
  109. package/src/node-require/browser-refresh.js +2 -2
  110. package/src/node-require/index.js +2 -2
  111. package/src/node_modules/@internal/components-beginComponent/index.js +16 -6
  112. package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +331 -0
  113. package/src/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
  114. package/src/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
  115. package/src/node_modules/@internal/components-entry/index.js +65 -37
  116. package/src/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
  117. package/src/node_modules/@internal/components-entry-legacy/index.js +15 -0
  118. package/src/node_modules/@internal/components-entry-legacy/package.json +11 -0
  119. package/src/node_modules/@internal/components-registry/index-browser.js +33 -6
  120. package/src/node_modules/@internal/components-util/index.js +10 -0
  121. package/src/runtime/RenderResult.js +3 -3
  122. package/src/runtime/components/Component.js +16 -18
  123. package/src/runtime/components/ComponentDef.js +22 -8
  124. package/src/runtime/components/ComponentsContext.js +1 -1
  125. package/src/runtime/components/State.js +2 -2
  126. package/src/runtime/components/attach-detach.js +1 -1
  127. package/src/runtime/components/dom-data.js +1 -1
  128. package/src/runtime/components/legacy/browser.json +9 -0
  129. package/src/runtime/components/legacy/defineComponent-legacy.js +32 -0
  130. package/src/runtime/components/legacy/defineRenderer-legacy.js +171 -0
  131. package/src/runtime/components/legacy/defineWidget-legacy.js +1 -0
  132. package/src/runtime/components/legacy/dependencies/html.js +3 -0
  133. package/src/runtime/components/legacy/dependencies/index.js +178 -0
  134. package/src/runtime/components/legacy/dependencies/vdom.js +3 -0
  135. package/src/runtime/components/legacy/index.js +1 -0
  136. package/src/runtime/components/legacy/jquery.js +51 -0
  137. package/src/runtime/components/legacy/ready.js +152 -0
  138. package/src/runtime/components/legacy/renderer-legacy.js +230 -0
  139. package/src/runtime/components/renderer.js +4 -0
  140. package/src/runtime/components/update-manager.js +1 -1
  141. package/src/runtime/dom-insert.js +1 -1
  142. package/src/runtime/helpers/dynamic-tag.js +2 -4
  143. package/src/runtime/helpers/style-value.js +7 -2
  144. package/src/runtime/html/AsyncStream.js +5 -5
  145. package/src/runtime/html/BufferedWriter.js +1 -1
  146. package/src/runtime/html/StringWriter.js +1 -1
  147. package/src/runtime/html/helpers/attr.js +15 -2
  148. package/src/runtime/html/helpers/attrs.js +7 -0
  149. package/src/runtime/html/helpers/merge-attrs.js +38 -7
  150. package/src/runtime/html/hot-reload.js +1 -1
  151. package/src/runtime/html/index.js +2 -2
  152. package/src/runtime/renderable.js +5 -2
  153. package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
  154. package/src/runtime/vdom/VComponent.js +1 -1
  155. package/src/runtime/vdom/VDocumentFragment.js +1 -1
  156. package/src/runtime/vdom/VElement.js +17 -6
  157. package/src/runtime/vdom/VFragment.js +1 -1
  158. package/src/runtime/vdom/VNode.js +1 -1
  159. package/src/runtime/vdom/VText.js +1 -1
  160. package/src/runtime/vdom/helpers/attrs.js +26 -6
  161. package/src/runtime/vdom/helpers/merge-attrs.js +16 -0
  162. package/src/runtime/vdom/hot-reload.js +1 -1
  163. package/src/runtime/vdom/index.js +2 -2
  164. package/src/runtime/vdom/morphdom/fragment.js +1 -1
  165. package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
  166. package/src/taglib/index.js +1 -1
  167. package/tags-html.d.ts +9 -0
package/docs/rollup.md CHANGED
@@ -102,7 +102,7 @@ const assetFileNames = "[name]-[hash][extname]";
102
102
 
103
103
  const externalDependencies = [
104
104
  ...Object.keys(pkg.dependencies),
105
- ...builtinModules
105
+ ...builtinModules,
106
106
  ];
107
107
 
108
108
  process.env.SASS_PATH = "./:./node_modules";
@@ -114,13 +114,13 @@ export default (async () => [
114
114
  dir: "built/server/",
115
115
  assetFileNames: `../browser/${assetFileNames}`,
116
116
  format: "cjs",
117
- sourcemap: true
117
+ sourcemap: true,
118
118
  },
119
- external: id =>
119
+ external: (id) =>
120
120
  externalDependencies.some(
121
- dependency => id === dependency || id.startsWith(dependency + "/")
121
+ (dependency) => id === dependency || id.startsWith(dependency + "/")
122
122
  ),
123
- plugins: [isWatch && runPlugin({ execArgv: ["--enable-source-maps"] })]
123
+ plugins: [isWatch && runPlugin({ execArgv: ["--enable-source-maps"] })],
124
124
  }),
125
125
 
126
126
  compiler("browser", {
@@ -130,7 +130,7 @@ export default (async () => [
130
130
  entryFileNames: __PROD__ ? "[name]-[hash].js" : null,
131
131
  assetFileNames,
132
132
  sourcemap: true,
133
- sourcemapExcludeSources: __PROD__
133
+ sourcemapExcludeSources: __PROD__,
134
134
  },
135
135
  plugins: [
136
136
  stylesPlugin({
@@ -138,13 +138,13 @@ export default (async () => [
138
138
  sourceMap: true,
139
139
  config: {
140
140
  target: "browserslist:css",
141
- plugins: [autoprefixer({ env: "css" })]
141
+ plugins: [autoprefixer({ env: "css" })],
142
142
  },
143
143
  minimize: __PROD__,
144
144
  url: {
145
145
  publicPath,
146
- hash: assetFileNames
147
- }
146
+ hash: assetFileNames,
147
+ },
148
148
  }),
149
149
  __PROD__ && (await import("rollup-plugin-terser")).terser(),
150
150
  __PROD__ &&
@@ -153,8 +153,8 @@ export default (async () => [
153
153
  minSize: 1024,
154
154
  gzipOptions: {
155
155
  level: 9,
156
- memLevel: 9
157
- }
156
+ memLevel: 9,
157
+ },
158
158
  }),
159
159
  __PROD__ &&
160
160
  !isWatch &&
@@ -170,10 +170,10 @@ export default (async () => [
170
170
  bundleAnalyzerFilename
171
171
  )}\x1b[0m`
172
172
  );
173
- }
174
- }
175
- ]
176
- })
173
+ },
174
+ },
175
+ ],
176
+ }),
177
177
  ])();
178
178
 
179
179
  function compiler(target, config) {
@@ -184,7 +184,7 @@ function compiler(target, config) {
184
184
  browserslistEnv,
185
185
  compact: false,
186
186
  babelrc: false,
187
- caller: { target }
187
+ caller: { target },
188
188
  };
189
189
  if (isBrowser) {
190
190
  babelConfig.presets = [
@@ -192,9 +192,9 @@ function compiler(target, config) {
192
192
  "@babel/preset-env",
193
193
  {
194
194
  browserslistEnv,
195
- bugfixes: true
196
- }
197
- ]
195
+ bugfixes: true,
196
+ },
197
+ ],
198
198
  ];
199
199
  }
200
200
 
@@ -205,16 +205,16 @@ function compiler(target, config) {
205
205
  markoPlugin[target]({ babelConfig }),
206
206
  nodeResolvePlugin({
207
207
  browser: isBrowser,
208
- preferBuiltins: !isBrowser
208
+ preferBuiltins: !isBrowser,
209
209
  }),
210
210
  commonjsPlugin(),
211
211
  replacePlugin({
212
212
  preventAssignment: true,
213
- values: { __DEV__, __PROD__ }
213
+ values: { __DEV__, __PROD__ },
214
214
  }),
215
215
  babelPlugin({
216
216
  babelHelpers: "bundled",
217
- ...babelConfig
217
+ ...babelConfig,
218
218
  }),
219
219
  jsonPlugin(),
220
220
  urlPlugin({
@@ -223,10 +223,10 @@ function compiler(target, config) {
223
223
  fileName: assetFileNames,
224
224
  include: "**/*.{svg,png,jpg,jpeg}",
225
225
  limit: 0, // Never Base64 & inline
226
- emitFiles: !isBrowser
226
+ emitFiles: !isBrowser,
227
227
  }),
228
- ...config.plugins
229
- ]
228
+ ...config.plugins,
229
+ ],
230
230
  };
231
231
  }
232
232
  ```
@@ -276,7 +276,7 @@ For example, if you have both `esm` and `iife` build outputs configured:
276
276
  {
277
277
  output: [
278
278
  { dir: "dist/iife", format: "iife" },
279
- { dir: "dist/esm", format: "esm" }
279
+ { dir: "dist/esm", format: "esm" },
280
280
  ];
281
281
  }
282
282
  ```
@@ -306,8 +306,8 @@ You can manually override the builtin Babel configuration by passing a `babelCon
306
306
  ```js
307
307
  marko.browser({
308
308
  babelConfig: {
309
- presets: ["@babel/preset-env"]
310
- }
309
+ presets: ["@babel/preset-env"],
310
+ },
311
311
  });
312
312
  ```
313
313
 
@@ -344,9 +344,9 @@ marko.browser({
344
344
  isEntry,
345
345
  fileName,
346
346
  // only inline code chunks below 1kB
347
- inline: code.trim().length < 1024 && code
347
+ inline: code.trim().length < 1024 && code,
348
348
  }
349
349
  );
350
- }
350
+ },
351
351
  });
352
352
  ```
@@ -60,7 +60,7 @@ http
60
60
  response.writeHead(200, { "content-type": "text/html;charset=utf-8" });
61
61
  const templateStream = MarkoTemplate.stream({});
62
62
  const gzipStream = zlib.createGzip({
63
- flush: zlib.constants.Z_PARTIAL_FLUSH
63
+ flush: zlib.constants.Z_PARTIAL_FLUSH,
64
64
  });
65
65
  templateStream.pipe(outputStream).pipe(response);
66
66
  })
@@ -376,7 +376,7 @@ _components/color-rotate-button/component.js_
376
376
  export default class extends Marko.Component {
377
377
  onCreate() {
378
378
  this.state = {
379
- colorIndex: 0
379
+ colorIndex: 0,
380
380
  };
381
381
  }
382
382
 
package/docs/vite.md CHANGED
@@ -12,7 +12,7 @@ npm install @marko/vite vite
12
12
  import { defineConfig } from "vite";
13
13
  import marko from "@marko/vite";
14
14
  export default defineConfig({
15
- plugins: [marko()]
15
+ plugins: [marko()],
16
16
  });
17
17
  ```
18
18
 
@@ -66,8 +66,8 @@ You can manually override Marko's Babel configuration by passing a `babelConfig`
66
66
  ```javascript
67
67
  marko({
68
68
  babelConfig: {
69
- presets: ["@babel/preset-env"]
70
- }
69
+ presets: ["@babel/preset-env"],
70
+ },
71
71
  });
72
72
  ```
73
73
 
package/docs/webpack.md CHANGED
@@ -42,16 +42,16 @@ The `<webpack-assets>` tag can be used along with the plugin in a multi-compiler
42
42
  export default [
43
43
  {
44
44
  entry: "./server.js",
45
- plugins: [markoPlugin.server]
45
+ plugins: [markoPlugin.server],
46
46
  // ...
47
47
  },
48
48
  {
49
49
  // ...
50
50
  entry: {
51
- tracking: "./tracking.js"
51
+ tracking: "./tracking.js",
52
52
  },
53
- plugins: [markoPlugin.browser]
54
- }
53
+ plugins: [markoPlugin.browser],
54
+ },
55
55
  ];
56
56
  ```
57
57
 
@@ -69,26 +69,26 @@ export default [
69
69
  rules: [
70
70
  {
71
71
  test: /\.marko$/,
72
- loader: "@marko/webpack/loader"
73
- }
74
- ]
72
+ loader: "@marko/webpack/loader",
73
+ },
74
+ ],
75
75
  },
76
- plugins: [markoPlugin.server]
76
+ plugins: [markoPlugin.server],
77
77
  },
78
78
  {
79
79
  rules: [
80
80
  {
81
81
  test: /\.marko$/,
82
- loader: "@marko/webpack/loader"
82
+ loader: "@marko/webpack/loader",
83
83
  },
84
84
  // If using `style` blocks with Marko you must use an appropriate loader
85
85
  {
86
86
  test: /\.css$/,
87
- use: ["style-loader", "css-loader"]
88
- }
87
+ use: ["style-loader", "css-loader"],
88
+ },
89
89
  ],
90
- plugins: [markoPlugin.browser]
91
- }
90
+ plugins: [markoPlugin.browser],
91
+ },
92
92
  ];
93
93
  ```
94
94
 
@@ -131,7 +131,7 @@ import germanTranslations from "./de.json";
131
131
 
132
132
  const languages = {
133
133
  en: null,
134
- de: germanTranslations
134
+ de: germanTranslations,
135
135
  };
136
136
 
137
137
  const markoPlugin = new MarkoPlugin();
@@ -144,27 +144,27 @@ export default [
144
144
  rules: [
145
145
  {
146
146
  test: /\.marko$/,
147
- loader: "@marko/webpack/loader"
148
- }
149
- ]
147
+ loader: "@marko/webpack/loader",
148
+ },
149
+ ],
150
150
  },
151
- plugins: [markoPlugin.server]
151
+ plugins: [markoPlugin.server],
152
152
  },
153
- ...Object.keys(languages).map(language => ({
153
+ ...Object.keys(languages).map((language) => ({
154
154
  name: `Browser-${language}`,
155
155
  rules: [
156
156
  {
157
157
  test: /\.marko$/,
158
- loader: "@marko/webpack/loader"
158
+ loader: "@marko/webpack/loader",
159
159
  },
160
160
  // If using `style` blocks with Marko you must use an appropriate loader
161
161
  {
162
162
  test: /\.css$/,
163
- use: ["style-loader", "css-loader"]
164
- }
163
+ use: ["style-loader", "css-loader"],
164
+ },
165
165
  ],
166
- plugins: [new I18nPlugin(languages[language]), markoPlugin.browser]
167
- }))
166
+ plugins: [new I18nPlugin(languages[language]), markoPlugin.browser],
167
+ })),
168
168
  ];
169
169
  ```
170
170
 
@@ -193,7 +193,7 @@ The `runtimeId` will default to the [`uniqueName` option](https://webpack.js.org
193
193
  import MarkoPlugin from "@marko/webpack/plugin";
194
194
 
195
195
  const markoPlugin = new MarkoPlugin({
196
- runtimeId: "MY_MARKO_RUNTIME_ID" // default to webpack `output.uniqueName` option.
196
+ runtimeId: "MY_MARKO_RUNTIME_ID", // default to webpack `output.uniqueName` option.
197
197
  });
198
198
  ```
199
199
 
@@ -109,8 +109,8 @@ function render(input, out) {
109
109
  "DIV",
110
110
  {
111
111
  style: marko_styleAttr({
112
- backgroundColor: color
113
- })
112
+ backgroundColor: color,
113
+ }),
114
114
  },
115
115
  0,
116
116
  4
package/index.d.ts CHANGED
@@ -216,6 +216,7 @@ declare global {
216
216
  }
217
217
 
218
218
  /** The top level api for a Marko Template. */
219
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
219
220
  export abstract class Template<Input = unknown, Return = unknown> {
220
221
  /** Creates a Marko compatible output stream. */
221
222
  createOut(): Out;
@@ -0,0 +1,15 @@
1
+ <module-code(function(require, opts) {
2
+ var file = `"./${opts.optimize ? "dist" : "src"}/runtime/components/legacy"`;
3
+
4
+ if (opts.modules === "cjs") {
5
+ return `module.exports = require(${file});\n`;
6
+ } else {
7
+ return `export { default } from ${file};\nexport * from ${file};\n`;
8
+ }
9
+ })/>
10
+
11
+ // What's going on here? We are using Marko to do JavaScript code generation
12
+ // during the module bundling phase to conditionally export either the
13
+ // "src" or the "dist" folder based on whether or not we are doing a
14
+ // debug or non-debug build. We are using Marko since we know the Marko compiler
15
+ // is enabled already (no extra babel transform required).
@@ -0,0 +1,7 @@
1
+ var isDebug = require("./env").isDebug;
2
+
3
+ if (isDebug) {
4
+ module.exports = require("./src/runtime/components/legacy");
5
+ } else {
6
+ module.exports = require("./dist/runtime/components/legacy");
7
+ }
package/package.json CHANGED
@@ -1,50 +1,7 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.29.2",
4
- "license": "MIT",
3
+ "version": "5.30.1",
5
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
- "dependencies": {
7
- "@marko/compiler": "^5.31.1",
8
- "@marko/translator-default": "^5.29.2",
9
- "app-module-path": "^2.2.0",
10
- "argly": "^1.2.0",
11
- "browser-refresh-client": "1.1.4",
12
- "complain": "^1.6.0",
13
- "csstype": "^3.1.2",
14
- "events-light": "^1.0.5",
15
- "listener-tracker": "^2.0.0",
16
- "minimatch": "^3.0.4",
17
- "raptor-util": "^3.2.0",
18
- "resolve-from": "^5.0.0",
19
- "self-closing-tags": "^1.0.1",
20
- "warp10": "^2.0.1"
21
- },
22
- "main": "index.js",
23
- "browser": {
24
- "./compiler.js": "./compiler-browser.marko",
25
- "./components.js": "./components-browser.marko",
26
- "./index.js": "./index-browser.marko"
27
- },
28
- "bin": {
29
- "markoc": "bin/markoc"
30
- },
31
- "homepage": "https://markojs.com/",
32
- "logo": {
33
- "url": "https://raw.githubusercontent.com/marko-js/branding/master/marko-logo-small.png"
34
- },
35
- "repository": {
36
- "type": "git",
37
- "url": "https://github.com/marko-js/marko.git"
38
- },
39
- "author": "Patrick Steele-Idem <pnidem@gmail.com>",
40
- "maintainers": [
41
- "Patrick Steele-Idem <pnidem@gmail.com>",
42
- "Michael Rawlings <ml.rawlings@gmail.com>",
43
- "Phillip Gates-Idem <phillip.idem@gmail.com>",
44
- "Austin Kelleher <a@alk.im>",
45
- "Dylan Piercey <pierceydylan@gmail.com>",
46
- "Martin Aberer"
47
- ],
48
5
  "keywords": [
49
6
  "front-end",
50
7
  "templating",
@@ -59,6 +16,32 @@
59
16
  "virtual",
60
17
  "virtual-dom"
61
18
  ],
19
+ "homepage": "https://markojs.com/",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/marko-js/marko.git"
23
+ },
24
+ "license": "MIT",
25
+ "author": "Patrick Steele-Idem <pnidem@gmail.com>",
26
+ "maintainers": [
27
+ "Patrick Steele-Idem <pnidem@gmail.com>",
28
+ "Michael Rawlings <ml.rawlings@gmail.com>",
29
+ "Phillip Gates-Idem <phillip.idem@gmail.com>",
30
+ "Austin Kelleher <a@alk.im>",
31
+ "Dylan Piercey <pierceydylan@gmail.com>",
32
+ "Martin Aberer"
33
+ ],
34
+ "main": "index.js",
35
+ "browser": {
36
+ "./compiler.js": "./compiler-browser.marko",
37
+ "./components.js": "./components-browser.marko",
38
+ "./legacy-components.js": "./legacy-components-browser.marko",
39
+ "./index.js": "./index-browser.marko"
40
+ },
41
+ "types": "index.d.ts",
42
+ "bin": {
43
+ "markoc": "bin/markoc"
44
+ },
62
45
  "files": [
63
46
  "bin",
64
47
  "dist",
@@ -68,6 +51,8 @@
68
51
  "compiler.js",
69
52
  "components-browser.marko",
70
53
  "components.js",
54
+ "legacy-components-browser.marko",
55
+ "legacy-components.js",
71
56
  "env.js",
72
57
  "index.d.ts",
73
58
  "index-browser.marko",
@@ -75,5 +60,26 @@
75
60
  "node-require.js",
76
61
  "tags-html.d.ts"
77
62
  ],
78
- "types": "index.d.ts"
63
+ "scripts": {
64
+ "build": "babel ./src --out-dir ./dist --delete-dir-on-start --copy-files --config-file ../../babel.config.js --env-name=production"
65
+ },
66
+ "dependencies": {
67
+ "@marko/compiler": "^5.32.0",
68
+ "@marko/translator-default": "^5.30.1",
69
+ "app-module-path": "^2.2.0",
70
+ "argly": "^1.2.0",
71
+ "browser-refresh-client": "1.1.4",
72
+ "complain": "^1.6.0",
73
+ "csstype": "^3.1.2",
74
+ "events-light": "^1.0.5",
75
+ "listener-tracker": "^2.0.0",
76
+ "minimatch": "^3.0.4",
77
+ "raptor-util": "^3.2.0",
78
+ "resolve-from": "^5.0.0",
79
+ "self-closing-tags": "^1.0.1",
80
+ "warp10": "^2.0.1"
81
+ },
82
+ "logo": {
83
+ "url": "https://raw.githubusercontent.com/marko-js/branding/master/marko-logo-small.png"
84
+ }
79
85
  }
@@ -34,7 +34,7 @@ if (g.__MARKO_CONFIG) {
34
34
  * You can also access this metadata via `compile(...).meta`.
35
35
  * This API is sticking around for compatibility purposes.
36
36
  */
37
- meta: true
37
+ meta: true,
38
38
  };
39
39
 
40
40
  if (process.env.MARKO_CONFIG) {
@@ -26,12 +26,12 @@ var defaultOptionsExportDefinition = {
26
26
  return globalConfig;
27
27
  },
28
28
  enumerable: true,
29
- configurable: false
29
+ configurable: false,
30
30
  };
31
31
 
32
32
  Object.defineProperties(exports, {
33
33
  defaultOptions: defaultOptionsExportDefinition,
34
- config: defaultOptionsExportDefinition
34
+ config: defaultOptionsExportDefinition,
35
35
  });
36
36
 
37
37
  function configure(newConfig) {
@@ -66,8 +66,8 @@ function _compile(src, filename, userConfig, callback) {
66
66
 
67
67
  if (callback) {
68
68
  compiler.compile(src, filename, options).then(
69
- result => callback(null, resultCompat(result, options)),
70
- error => callback(error)
69
+ (result) => callback(null, resultCompat(result, options)),
70
+ (error) => callback(error)
71
71
  );
72
72
  } else {
73
73
  return resultCompat(compiler.compileSync(src, filename, options), options);
@@ -96,7 +96,7 @@ function compileForBrowser(src, filename, options, callback) {
96
96
  {
97
97
  output: "dom",
98
98
  meta: false,
99
- sourceOnly: false
99
+ sourceOnly: false,
100
100
  },
101
101
  options
102
102
  );
@@ -16,7 +16,7 @@ module.exports = function __flushHereAndAfter__(input, out) {
16
16
  const asyncOut = out.beginAsync({ last: true });
17
17
  const nextWriter = out.writer;
18
18
 
19
- out.on("___toString", writer => {
19
+ out.on("___toString", (writer) => {
20
20
  if (writer instanceof BufferedWriter) {
21
21
  if (flushed) {
22
22
  const detachedOut = out.createOut();
@@ -114,7 +114,7 @@ AsyncValue.prototype = {
114
114
  // notify callbacks
115
115
  notifyCallbacks(this, null, value);
116
116
  }
117
- }
117
+ },
118
118
  };
119
119
 
120
120
  module.exports = AsyncValue;
@@ -102,7 +102,7 @@ module.exports = function awaitTag(input, out) {
102
102
  var awaitInfo = {
103
103
  name: name,
104
104
  clientReorder: clientReorder,
105
- dataProvider: provider
105
+ dataProvider: provider,
106
106
  };
107
107
 
108
108
  if (clientReorder) {
@@ -112,7 +112,7 @@ module.exports = function awaitTag(input, out) {
112
112
  out.global.___clientReorderContext ||
113
113
  (out.global.___clientReorderContext = {
114
114
  instances: [],
115
- nextId: 0
115
+ nextId: 0,
116
116
  });
117
117
 
118
118
  var id = (awaitInfo.id = input.name || clientReorderContext.nextId++);
@@ -159,7 +159,7 @@ module.exports = function awaitTag(input, out) {
159
159
  out.flush(); // Flush everything up to this await instance
160
160
  asyncOut = awaitInfo.out = out.beginAsync({
161
161
  timeout: 0, // We will use our code for controlling timeout
162
- name: name
162
+ name: name,
163
163
  });
164
164
  }
165
165
 
@@ -220,7 +220,11 @@ function renderContents(err, data, input, out) {
220
220
  if (err) {
221
221
  if (input.catch) {
222
222
  if (errorRenderer) {
223
- errorRenderer(out, err);
223
+ try {
224
+ errorRenderer(out, err);
225
+ } catch (err2) {
226
+ out.error(err2);
227
+ }
224
228
  }
225
229
  } else {
226
230
  out.error(err);
@@ -27,7 +27,7 @@ module.exports = function (input, out) {
27
27
  var asyncOut = out.beginAsync({
28
28
  last: true,
29
29
  timeout: -1,
30
- name: "await-reorderer"
30
+ name: "await-reorderer",
31
31
  });
32
32
 
33
33
  out.onLast(function (next) {
@@ -8,10 +8,10 @@ if ("MARKO_DEBUG") {
8
8
  browserRefreshClient
9
9
  .enableSpecialReload(
10
10
  `${extensions
11
- .map(ext => `*${ext}`)
11
+ .map((ext) => `*${ext}`)
12
12
  .join(" ")} marko.json marko-tag.json`
13
13
  )
14
- .onFileModified(path => {
14
+ .onFileModified((path) => {
15
15
  hotReload.handleFileModified(path);
16
16
  });
17
17
  }
@@ -7,7 +7,7 @@ const requiredCompilerOptions = { modules: "cjs" };
7
7
  const defaultCompilerOptions = {
8
8
  // eslint-disable-next-line no-constant-condition
9
9
  sourceMaps: "MARKO_DEBUG" ? "inline" : false,
10
- meta: true
10
+ meta: true,
11
11
  };
12
12
  const MARKO_EXTENSIONS = Symbol("MARKO_EXTENSIONS");
13
13
 
@@ -80,7 +80,7 @@ function install(options) {
80
80
  requireExtensions[MARKO_EXTENSIONS] ||
81
81
  (requireExtensions[MARKO_EXTENSIONS] = []);
82
82
 
83
- extensions.forEach(extension => {
83
+ extensions.forEach((extension) => {
84
84
  extension = normalizeExtension(extension);
85
85
  requireExtensions[extension] = markoRequireExtension;
86
86
  requireExtensions[MARKO_EXTENSIONS].push(extension);
@@ -4,6 +4,7 @@ const ComponentDef = require("../../../runtime/components/ComponentDef");
4
4
 
5
5
  var FLAG_WILL_RERENDER_IN_BROWSER = 1;
6
6
  // var FLAG_HAS_RENDER_BODY = 2;
7
+ var FLAG_OLD_HYDRATE_NO_CREATE = 8;
7
8
 
8
9
  module.exports = function beginComponent(
9
10
  componentsContext,
@@ -11,15 +12,20 @@ module.exports = function beginComponent(
11
12
  key,
12
13
  ownerComponentDef,
13
14
  isSplitComponent,
14
- isImplicitComponent
15
+ isImplicitComponent,
16
+ existingComponentDef
15
17
  ) {
16
18
  var componentId = component.id;
17
19
 
18
- var componentDef = (componentsContext.___componentDef = new ComponentDef(
19
- component,
20
- componentId,
21
- componentsContext
22
- ));
20
+ // existingComponentDef is only here to allow binding a conditional
21
+ // widget. It should be removed when the legacy compat layer is removed.
22
+ var componentDef =
23
+ existingComponentDef ||
24
+ (componentsContext.___componentDef = new ComponentDef(
25
+ component,
26
+ componentId,
27
+ componentsContext
28
+ ));
23
29
 
24
30
  var ownerIsRenderBoundary =
25
31
  ownerComponentDef && ownerComponentDef.___renderBoundary;
@@ -54,6 +60,10 @@ module.exports = function beginComponent(
54
60
  componentsContext.___isPreserved = false;
55
61
  }
56
62
 
63
+ if (out.global.oldHydrateNoCreate === true) {
64
+ componentDef.___flags |= FLAG_OLD_HYDRATE_NO_CREATE;
65
+ }
66
+
57
67
  if ((ownerIsRenderBoundary || ownerWillRerender) && key != null) {
58
68
  out.w(
59
69
  "<!--" +