@lipsjs/lips 0.5.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
@@ -2860,8 +2860,8 @@ class IRLips {
2860
2860
  return this;
2861
2861
  this.plugins.set(plugin.name, plugin);
2862
2862
  plugin.requires?.forEach((each) => this.use(each));
2863
- for (const [name, template] of Object.entries(plugin.components || {})) {
2864
- 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);
2865
2865
  if (held && held !== template)
2866
2866
  throw new Error(`[lips] <${name}> of plugin <${plugin.name}> is registered already, by something else`);
2867
2867
  this.register(name, template);
@@ -2869,6 +2869,15 @@ class IRLips {
2869
2869
  plugin.install?.(this, options);
2870
2870
  return this;
2871
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;
2872
2881
  unregister(name) {
2873
2882
  this.store.delete(name);
2874
2883
  return this;
@@ -6519,4 +6528,4 @@ export {
6519
6528
  untrack
6520
6529
  };
6521
6530
 
6522
- //# debugId=FAD62A6241A2D69364756E2164756E21
6531
+ //# debugId=6C2621E463E9E43B64756E2164756E21