cavalion-blocks
Advanced tools
Comparing version 0.9.38 to 0.9.39
@@ -0,1 +1,8 @@ | ||
### 2024/07/07 - 0.9.39 | ||
* **Factory** | ||
* Implements thisRequire.toUrl | ||
* Finetunes vcl/Factory.unreq | ||
### 2024/05/20 - 0.9.38 | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "cavalion-blocks", | ||
"version": "0.9.38", | ||
"version": "0.9.39", | ||
"description": "`blocks-dot-js` `[].js`", | ||
@@ -5,0 +5,0 @@ "main": "README.js", |
@@ -112,11 +112,12 @@ define(function(require) { | ||
var args = js.copy_args(arguments); | ||
var args = js.copy_args(arguments), baseUri; | ||
sourceUri = sourceUri || uri; | ||
baseUri = sourceUri.split("!").pop(); | ||
/*- TODO clean up */ | ||
function thisRequire(modules, success, error) { | ||
if(modules instanceof Array) { | ||
modules = modules.map(module => normalize(sourceUri.split("!").pop(), module)); | ||
modules = modules.map(module => normalize(baseUri, module)); | ||
} else { | ||
modules = normalize(sourceUri.split("!").pop(), modules); | ||
modules = normalize(baseUri, modules); | ||
} | ||
@@ -130,2 +131,4 @@ // console.log(">>>", modules); | ||
} | ||
thisRequire.toUrl = (url) => normalize(baseUri, url); | ||
@@ -157,2 +160,3 @@ this._parentRequire = thisRequire; | ||
source.indexOf("\"use strict\";") !== 0) { | ||
this._source = source; | ||
if(source.indexOf("\"use ") === 0) { | ||
@@ -591,3 +595,3 @@ // TODO this should be the default | ||
}; | ||
// console.log(name, "assuming", source) | ||
instantiate(source); | ||
@@ -603,2 +607,3 @@ }); | ||
// + also: ".fallback" could be added (nice!y) to the uri | ||
// console.log(name, "fetch"); | ||
this.fetch(name).then(instantiate).catch(fallback); | ||
@@ -657,10 +662,17 @@ }, | ||
var factory; | ||
try { | ||
factory = require(String.format("vcl/Factory!%s", name)); | ||
} catch(e) { | ||
return; | ||
if(name instanceof Factory) { | ||
factory = name; | ||
} else { | ||
name = String.format("blocks/Factory!%s", name); | ||
if(window.require.s.contexts._.defined[name]) { | ||
factory = require(name); | ||
} else { | ||
console.warn("(can) the puck stop(s) here?", name) | ||
return; | ||
} | ||
} | ||
requirejs.undef(String.format("blocks/Factory!%s", factory._uri)); | ||
requirejs.undef(Factory.makeTextUri(factory._uri)); | ||
window.require.undef(js.sf("blocks/Factory!%s", factory._uri)); | ||
window.require.undef(Factory.makeTextUri(factory._uri)); | ||
@@ -667,0 +679,0 @@ console.info("blocks/Factory.unreq: " + name) |
"use strict"; | ||
console.log("prototypes/Button"); | ||
["vcl-ui:Button", {}, []]; |
@@ -12,2 +12,7 @@ // getStorageKey might solve the problem/challenge with a not being able to specify (specializer) the (automagically created) Hover<>-instance (since it would lead to many implicit bases when dealing with long uri paths) embedding the actual blocks component of interest | ||
let spec = this.getSpecializer(), uri = this.vars("uri"); | ||
let props = { | ||
parent: this, | ||
owner: this, | ||
zoom: this.vars("zoom") || 1 | ||
}; | ||
@@ -20,7 +25,8 @@ // if spec is number maybe not set uri? | ||
B.i([this.vars("storage-uri", uri || this.vars("storage-uri"))]).then(c => c.set({ | ||
parent: this, | ||
owner: this, | ||
zoom: this.vars("zoom") || 1 | ||
})); | ||
B.i([this.vars("storage-uri", uri || this.vars("storage-uri"))], { | ||
loaded() { | ||
// alert("loaded delayed"); | ||
} | ||
}) | ||
.then(c => c.set(props).loaded() ); | ||
@@ -27,0 +33,0 @@ return this.inherited(arguments); |
@@ -48,3 +48,2 @@ "use locale, js, blocks/Blocks"; | ||
} | ||
}, | ||
@@ -51,0 +50,0 @@ vars: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
96547
2444