@lipsjs/lips 0.4.0 → 0.6.0

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/lips.js CHANGED
@@ -2185,6 +2185,7 @@ class IRRenderer {
2185
2185
  input,
2186
2186
  static: statics,
2187
2187
  context: benv.context,
2188
+ refs: {},
2188
2189
  setContext(arg, value) {
2189
2190
  const write = (k, v) => writeContext(benv.context, k, v, irr.options.expose?.setContext);
2190
2191
  typeof arg === "string" ? write(arg, value) : Object.entries(arg || {}).forEach(([k, v]) => write(k, v));
@@ -2385,6 +2386,7 @@ function renderIR(ir, setup = {}, options = {}) {
2385
2386
  state,
2386
2387
  input,
2387
2388
  static: statics,
2389
+ refs: {},
2388
2390
  ...options.expose || {},
2389
2391
  ...setup.expose || {}
2390
2392
  }), () => rootInst);
@@ -2858,8 +2860,8 @@ class IRLips {
2858
2860
  return this;
2859
2861
  this.plugins.set(plugin.name, plugin);
2860
2862
  plugin.requires?.forEach((each) => this.use(each));
2861
- for (const [name, template] of Object.entries(plugin.components || {})) {
2862
- const held = this.store.get(name);
2863
+ for (const [name, source] of Object.entries(plugin.components || {})) {
2864
+ const template = this.built(name, source), held = this.store.get(name);
2863
2865
  if (held && held !== template)
2864
2866
  throw new Error(`[lips] <${name}> of plugin <${plugin.name}> is registered already, by something else`);
2865
2867
  this.register(name, template);
@@ -2867,6 +2869,15 @@ class IRLips {
2867
2869
  plugin.install?.(this, options);
2868
2870
  return this;
2869
2871
  }
2872
+ built(name, source) {
2873
+ const made = !source.ir && this.config?.precompiled?.[name];
2874
+ if (!made)
2875
+ return source;
2876
+ let template = this.withIR.get(source);
2877
+ !template && this.withIR.set(source, template = { ...source, ...made });
2878
+ return template;
2879
+ }
2880
+ withIR = new WeakMap;
2870
2881
  unregister(name) {
2871
2882
  this.store.delete(name);
2872
2883
  return this;
@@ -6517,4 +6528,4 @@ export {
6517
6528
  untrack
6518
6529
  };
6519
6530
 
6520
- //# debugId=92A7D93D1578738164756E2164756E21
6531
+ //# debugId=6C2621E463E9E43B64756E2164756E21