@fluixi/template-parser 1.0.0-alpha.108 → 1.0.0-alpha.109

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/parser.cjs CHANGED
@@ -236,12 +236,18 @@ var CORE_DIRECTIVES = [
236
236
  {
237
237
  id: "load",
238
238
  match: (n) => n.startsWith("load:"),
239
- build: (raw) => ({
240
- kind: "LoadDirective",
241
- strategy: raw.name.slice("load:".length),
242
- modifier: raw.value && raw.value.kind === "static" ? raw.value.value : null,
243
- loc: raw.loc
244
- })
239
+ build: (raw) => {
240
+ if (raw.value && raw.value.kind !== "static") {
241
+ raw.report("invalid-binding", `'${raw.name}' needs a literal value, not an expression: the strategy is compile-time.`);
242
+ }
243
+ return {
244
+ kind: "LoadDirective",
245
+ strategy: raw.name.slice("load:".length),
246
+ modifier: raw.value && raw.value.kind === "static" ? raw.value.value : null,
247
+ ...raw.value && raw.value.kind !== "static" ? { dynamic: true } : {},
248
+ loc: raw.loc
249
+ };
250
+ }
245
251
  },
246
252
  // Custom directive: `use=${d}` or `use:tooltip[=${opts}]`.
247
253
  {