Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flecks/core

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flecks/core - npm Package Compare versions

Comparing version 3.2.1 to 4.0.0

build/test.webpack.config.js

1

build/class.js

@@ -0,1 +1,2 @@

// ...
module.exports = class {};

@@ -44,10 +44,12 @@ export const hooks = {

/**
* Invoked when a fleck is HMR'd
* Invoked when a module is HMR'd. Throw to abort hot reload and restart application.
* Must be synchronous.
*
* @param {string} path The path of the fleck
* @param {Module} updatedFleck The updated fleck module.
* @invoke
* @param {Module} updated The updated module.
* @invokeSequential
*/
'@flecks/core.hmr': (path, updatedFleck) => {
'@flecks/core.hmr': (path, updated) => {
if ('my-fleck' === path) {
updatedFleck.doSomething();
updated.doSomething();
}

@@ -105,2 +107,17 @@ },

/**
* Invoked when `flecks.yml` is hot reloaded. Throw to abort hot reload and restart application.
* Must be synchronous.
*
* @param {string} fleck The fleck whose config changed.
* @param {Object} config The new config.
*/
'@flecks/core.reload': (fleck, config, flecks) => {
if ('i-care-about' === fleck) {
if (flecks.get(`${fleck}.volatile`) !== config.volatile) {
throw new Error('Changes too volatile');
}
}
}
/**
* Invoked when the application is starting.

@@ -107,0 +124,0 @@ * @invoke SequentialAsync

87

build/flecks.js

@@ -59,3 +59,3 @@ // eslint-disable-next-line max-classes-per-file

exports.Flecks = class Flecks {
class Flecks {

@@ -78,11 +78,11 @@ config = {};

constructor({
bootstrappedConfig = {},
config = {},
flecks = {},
} = {}) {
const emptyConfigForAllFlecks = Object.fromEntries(
Object.keys(flecks).map((path) => [path, {}]),
);
this.config = {...emptyConfigForAllFlecks, ...config};
this.bootstrappedConfig = JSON.parse(JSON.stringify(bootstrappedConfig));
this.originalConfig = JSON.parse(JSON.stringify(config));
this.config = {};
const entries = Object.entries(flecks);
debugSilly('paths: %O', entries.map(([fleck]) => fleck));
this.constructor.debugSilly('paths: %O', entries.map(([fleck]) => fleck));
for (let i = 0; i < entries.length; i++) {

@@ -94,3 +94,3 @@ const [fleck, M] = entries[i];

this.configureFlecksDefaults();
debugSilly('config: %O', this.config);
this.constructor.debugSilly('config: %O', this.config);
}

@@ -106,4 +106,5 @@

this.config[fleck] = {
...this.bootstrappedConfig[fleck],
...this.invokeFleck('@flecks/core.config', fleck),
...this.config[fleck],
...this.originalConfig[fleck],
};

@@ -118,6 +119,15 @@ }

configureFlecksDefaults() {
const flecks = this.flecksImplementing('@flecks/core.config');
const flecks = Object.keys(this.flecks);
for (let i = 0; i < flecks.length; i++) {
this.configureFleckDefaults(flecks[i]);
}
// Make sure bootstrapped config gets propagated.
[].concat([this.bootstrappedConfig, this.originalConfig].map(Object.keys)).flat()
.forEach((path) => {
this.config[path] = {
...this.bootstrappedConfig[path],
...this.originalConfig[path],
...this.config[path],
};
});
}

@@ -143,2 +153,21 @@

/**
* Dealias a configuration object.
*
* @param {Object} config Configuration.
* @returns {Object}
*/
static dealiasedConfig(config) {
return Object.fromEntries(
Object.entries(config)
.map(([maybeAliasedPath, config]) => {
const index = maybeAliasedPath.indexOf(':');
return [
-1 === index ? maybeAliasedPath : maybeAliasedPath.slice(0, index),
config,
];
}),
);
}
/**
* Generate a decorator from a require context.

@@ -284,3 +313,3 @@ *

}
debug(
this.constructor.debug(
"Suspicious ordering specification for '%s': '%s' expected to run %s '%s'!",

@@ -294,3 +323,3 @@ ...explanation,

.filter((fleck) => this.fleckImplementation(fleck, hook));
debugSilly("cached hook expansion for '%s': %O", hook, expanded);
this.constructor.debugSilly("cached hook expansion for '%s': %O", hook, expanded);
return [...this.$$expandedFlecksCache[hook]];

@@ -376,3 +405,3 @@ }

.map(([path, {mixin}]) => [path, mixin]).filter(([, mixin]) => mixin);
debugSilly('mixins: %O', mixinDescription.map(([path]) => path));
this.debugSilly('mixins: %O', mixinDescription.map(([path]) => path));
const Flecks = compose(...mixinDescription.map(([, mixin]) => mixin))(this);

@@ -436,3 +465,3 @@ const instance = new Flecks(runtime);

};
debug("gathered '%s': %O", hook, Object.keys(gathered[exports.ByType]));
this.constructor.debug("gathered '%s': %O", hook, Object.keys(gathered[exports.ByType]));
return gathered;

@@ -472,3 +501,3 @@ }

/**
* Interpolate a string with flecks configurtaion values.
* Interpolate a string with flecks configuration values.
* @param {string} string

@@ -571,3 +600,3 @@ * @returns The interpolated string.

invokeFleck(hook, fleck, ...args) {
debugSilly('invokeFleck(%s, %s, ...)', hook, fleck);
this.constructor.debugSilly('invokeFleck(%s, %s, ...)', hook, fleck);
if (!this.hooks[hook]) {

@@ -752,3 +781,3 @@ return undefined;

makeMiddleware(hook) {
debugSilly('makeMiddleware(...): %s', hook);
this.constructor.debugSilly('makeMiddleware(...): %s', hook);
if (!this.hooks[hook]) {

@@ -762,3 +791,3 @@ return (...args) => args.pop()();

}
debugSilly('middleware: %O', flecks);
this.constructor.debugSilly('middleware: %O', flecks);
const instance = new Middleware(flecks.map((fleck) => this.invokeFleck(hook, fleck)));

@@ -834,3 +863,3 @@ return instance.dispatch.bind(instance);

refresh(fleck, M) {
debug('refreshing %s...', fleck);
this.constructor.debug('refreshing %s...', fleck);
// Remove old hook implementations.

@@ -867,3 +896,3 @@ this.unregisterFleckHooks(fleck);

raw = await this.invokeMergeAsync(hook);
debugSilly('%s implements %s.decorate', fleck, hook);
this.constructor.debugSilly('%s implements %s.decorate', fleck, hook);
}

@@ -873,8 +902,8 @@ // If only implementing, gather and decorate.

raw = await this.invokeFleck(hook, fleck);
debugSilly('%s implements %s', fleck, hook);
this.constructor.debugSilly('%s implements %s', fleck, hook);
}
if (raw) {
const decorated = await this.checkAndDecorateRawGathered(hook, raw, check);
debug('updating gathered %s from %s...', hook, fleck);
debugSilly('%O', decorated);
this.constructor.debug('updating gathered %s from %s...', hook, fleck);
this.constructor.debugSilly('%O', decorated);
const entries = Object.entries(decorated);

@@ -905,7 +934,7 @@ entries.forEach(([type, Class]) => {

registerFleckHooks(fleck, M) {
debugSilly('registering %s...', fleck);
this.constructor.debugSilly('registering %s...', fleck);
this.flecks[fleck] = M;
if (M.hooks) {
const hooks = Object.keys(M.hooks);
debugSilly("hooks for '%s': %O", fleck, hooks);
this.constructor.debugSilly("hooks for '%s': %O", fleck, hooks);
for (let j = 0; j < hooks.length; j++) {

@@ -943,5 +972,9 @@ const hook = hooks[j];

};
}
exports.Flecks.get = get;
exports.Flecks.set = set;
Flecks.debug = debug;
Flecks.debugSilly = debugSilly;
Flecks.get = get;
Flecks.set = set;
exports.Flecks = Flecks;

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("debug"),require("lodash.get"),require("set-value")):"function"==typeof define&&define.amd?define("@flecks/core",["debug","lodash.get","set-value"],t):"object"==typeof exports?exports["@flecks/core"]=t(require("debug"),require("lodash.get"),require("set-value")):e["@flecks/core"]=t(e.debug,e["lodash.get"],e["set-value"])}(global,((e,t,s)=>(()=>{var n={305:e=>{e.exports=class{}},269:e=>{e.exports=function(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...s)=>e(t(...s))))}},157:(e,t,s)=>{const n=s(999),{VSCODE_INSPECTOR_OPTIONS:r}=process.env;e.exports=e=>{{if(r){const{formatArgs:e}=n;n.formatArgs=function(t){const{useColors:s}=this;t[0].match(/%[oO]/)&&(this.useColors=!1),e.call(this,t),this.useColors=s},n.formatters.o=void 0,n.formatters.O=void 0}const e="web"===process.env.FLECKS_CORE_BUILD_TARGET?"debug":"error";n.log=console[e].bind(console)}return n(e)}},817:e=>{e.exports=class{arcs=new Map;addDependency(e,t){this.ensureTail(e),this.ensureTail(t).add(e)}detectCycles(){const e=[],t=new Set,s=new Set,n=r=>{if(!t.has(r)){t.add(r),s.add(r);const o=this.neighbors(r);for(let i=o.next();!0!==i.done;i=o.next()){const{value:o}=i;t.has(o)?s.has(o)&&e.push([r,o]):n(o)}}s.delete(r)},{tails:r}=this;for(let e=r.next();!0!==e.done;e=r.next())n(e.value);return e}ensureTail(e){return this.arcs.has(e)||this.arcs.set(e,new Set),this.arcs.get(e)}neighbors(e){return this.arcs.get(e).values()}sort(){const e=new Set,t=new Map,s=(n,r)=>{e.add(n);const o=this.neighbors(n);for(let t=o.next();!0!==t.done;t=o.next()){const{value:n}=t;e.has(n)||(r=s(n,r))}return t.set(n,r),r-1};let n=this.arcs.size-1;const{tails:r}=this;for(let t=r.next();!0!==t.done;t=r.next()){const{value:r}=t;e.has(r)||(n=s(r,n))}return Array.from(t.entries()).sort((([,e],[,t])=>e-t)).map((([e])=>e))}removeDependency(e,t){this.arcs.has(t)&&this.arcs.get(t).delete(e)}get tails(){return this.arcs.keys()}}},848:e=>{e.exports=function(e){return class extends e{constructor(...e){super(...e),this.$$events=Object.create(null)}addListener(e,t,s){return this.on(e,t,s)}emit(e,...t){const s=this.$$events[e];s&&s.length>0&&this.emitToListeners(s,t)}emitToListeners(e,t){for(let s=0;s<e.length;++s){const{once:n,type:r,fn:o,bound:i,that:c}=e[s];n&&this.offSingleEvent(r,o),0===t.length?i():1===t.length?i(t[0]):2===t.length?i(t[0],t[1]):3===t.length?i(t[0],t[1],t[2]):4===t.length?i(t[0],t[1],t[2],t[3]):5===t.length?i(t[0],t[1],t[2],t[3],t[4]):o.apply(c,t)}}off(e,t){const s=Array.isArray(e)?e:[e];for(let e=0;e<s.length;e++)this.offSingleEvent(s[e],t);return this}offSingleEvent(e,t){"function"==typeof t?e in this.$$events&&(this.$$events[e]=this.$$events[e].filter((e=>e.fn!==t))):e in this.$$events&&(this.$$events[e]=[])}on(e,t,s=void 0){return this.$$on(e,t,s,!1),this}$$on(e,t,s,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++)this.onSingleEvent(r[e],t,s,n)}once(e,t,s=void 0){return this.$$on(e,t,s,!0),this}onSingleEvent(e,t,s,n){if("function"!=typeof t)throw new TypeError("EventEmitter::onSingleEvent() requires function listener");const r=((e,t,s,n)=>({fn:e,that:t,type:s,once:n,bound:t?e.bind(t):e}))(t,s,e,n);e in this.$$events||(this.$$events[e]=[]),this.$$events[e].push(r)}removeListener(...e){return this.off(...e)}}}},278:(e,t,s)=>{const{basename:n,dirname:r,extname:o,join:i}=s(17),c=s(46),h=s(697),a=s(269),l=s(157),f=s(817),d=s(736),u=l("@flecks/core/flecks"),k=u.extend("silly"),p=Symbol.for("@flecks/core.hookPriority");t.So=Symbol.for("@flecks/core.byId"),t.Rn=Symbol.for("@flecks/core.byType");const g=e=>e.substring(0,1).toUpperCase()+e.substring(1),m=e=>e.split(/[_-]/).map(g).join(""),y=(e,t,s,n,r)=>class extends e{static get[s](){return t}static get[r](){return n}};t.MH=class{config={};$$expandedFlecksCache={};flecks={};$$gathered={};hooks={};constructor({config:e={},flecks:t={}}={}){const s=Object.fromEntries(Object.keys(t).map((e=>[e,{}])));this.config={...s,...e};const n=Object.entries(t);k("paths: %O",n.map((([e])=>e)));for(let e=0;e<n.length;e++){const[t,s]=n[e];this.registerFleckHooks(t,s),this.invoke("@flecks/core.registered",t,s)}this.configureFlecksDefaults(),k("config: %O",this.config)}configureFleckDefaults(e){this.config[e]={...this.invokeFleck("@flecks/core.config",e),...this.config[e]}}configureFlecksDefaults(){const e=this.flecksImplementing("@flecks/core.config");for(let t=0;t<e.length;t++)this.configureFleckDefaults(e[t])}static dasherizePath(e){const t=r(e).split("/");return"."===t[0]&&t.shift(),"index"===t[t.length-1]&&t.pop(),i(t.join("-"),n(e,o(e)))}static decorate(e,{transformer:t=m}={}){return(s,n)=>e.keys().reduce(((s,r)=>{const o=t(this.dasherizePath(r));if(!s[o])return s;const{default:i}=e(r);if("function"!=typeof i)throw new ReferenceError(`Flecks.decorate(): require(${r}).default is not a function (from: ${e.id})`);return{...s,[o]:i(s[o],n)}}),s)}async checkAndDecorateRawGathered(e,t,s){s(t,e);const n=await this.invokeComposedAsync(`${e}.decorate`,t);return s(n,`${e}.decorate`),n}destroy(){this.$$expandedFlecksCache={},this.config={},this.$$gathered={},this.hooks={},this.flecks={}}expandedFlecks(e){if(this.$$expandedFlecksCache[e])return[...this.$$expandedFlecksCache[e]];const t=this.lookupFlecks(e);let s=[];for(let e=0;e<t.length;++e){const n=t[e];s.push(n)}const n=s.findIndex((e=>"..."===e));if(-1!==n){if(-1!==s.slice(n+1).findIndex((e=>"..."===e)))throw new Error(`Illegal ordering specification: hook '${e}' has multiple ellipses.`);const t=s.slice(0,n),r=s.slice(n+1);s.splice(n,1);const o=[],i=this.flecksImplementing(e);for(let e=0;e<i.length;++e){const t=i[e];s.includes(t)||o.push(t)}const c=this.flecksHookGraph([...t,...o,...r],e),h=c.detectCycles();if(h.length>0)throw new Error(`Illegal ordering specification: hook '${e}' has positioning cycles: ${h.map((([e,t])=>`${e} <-> ${t}`)).join(", ")}`);s=[...t,...c.sort().filter((e=>!s.includes(e))),...r]}const r=this.flecksHookGraph(s,e);s.forEach(((e,t)=>{t<s.length-1&&r.addDependency(s[t+1],e)}));const o=r.detectCycles();return o.length>0&&o.forEach((([t,s])=>{const n=this.fleckImplementation(t,e),{before:r=[],after:o=[]}=n?.[p]||{},i=[e];r.includes(s)&&i.push(t,"before",s),o.includes(s)&&i.push(t,"after",s);const c=this.fleckImplementation(s,e),{before:h=[],after:a=[]}=c?.[p]||{};h.includes(t)&&i.push(s,"before",t),a.includes(t)&&i.push(s,"after",t),u("Suspicious ordering specification for '%s': '%s' expected to run %s '%s'!",...i)})),this.$$expandedFlecksCache[e]=s.filter((t=>this.fleckImplementation(t,e))),k("cached hook expansion for '%s': %O",e,s),[...this.$$expandedFlecksCache[e]]}fleck(e){return this.flecks[e]}fleckImplementation(e,t){if(!this.hooks[t])return;const s=this.hooks[t]?.find((({fleck:t})=>e===t));return s?s.fn:void 0}flecksImplementing(e){return this.hooks[e]?.map((({fleck:e})=>e))||[]}flecksHookGraph(e,t){const s=new f;return e.forEach((e=>{s.ensureTail(e);const n=this.fleckImplementation(e,t);n?.[p]&&(n[p].before&&n[p].before.forEach((t=>{s.addDependency(t,e)})),n[p].after&&n[p].after.forEach((t=>{s.addDependency(e,t)})))})),this.invoke("@flecks/core.priority",s,t),s}static async from(e){const{flecks:t}=e,s=Object.entries(t).map((([e,{mixin:t}])=>[e,t])).filter((([,e])=>e));k("mixins: %O",s.map((([e])=>e)));const n=new(a(...s.map((([,e])=>e)))(this))(e);return await n.gatherHooks(),await n.invokeSequentialAsync("@flecks/core.starting"),n}async gather(e,{idProperty:s="id",typeProperty:n="type",check:r=(()=>{})}={}){if(!e||"string"!=typeof e)throw new TypeError("Flecks.gather(): Expects parameter 1 (hook) to be string");const o=await this.invokeMergeAsync(e),i=await this.checkAndDecorateRawGathered(e,o,r);let c=1;const h={},a=Object.fromEntries(Object.entries(i).sort((([e],[t])=>e<t?-1:1)).map((([e,t])=>{const r=c++;return h[r]=y(t,r,s,e,n),[e,h[r]]}))),l={...h,...a,[t.So]:h,[t.Rn]:a};return this.$$gathered[e]={check:r,idProperty:s,typeProperty:n,gathered:l},u("gathered '%s': %O",e,Object.keys(l[t.Rn])),l}gathered(e){return this.$$gathered[e]?.gathered}async gatherHooks(){const e=await this.invokeAsync("@flecks/core.gathered");await Promise.all(Object.entries(e).map((([e,t])=>Promise.all(Object.entries(t).map((([t,s])=>this.gather(`${e}.${t}`,s)))))))}get(e,t){return c(this.config,e,t)}interpolate(e){return e.replace(/\[(.*?)\]/g,(e=>this.get(e)))}invoke(e,...t){return this.hooks[e]?this.flecksImplementing(e).reduce(((s,n)=>({...s,[n]:this.invokeFleck(e,n,...t)})),{}):{}}async invokeAsync(e,...t){return this.hooks[e]?this.flecksImplementing(e).reduce((async(s,n)=>({...await s,[n]:await this.invokeFleck(e,n,...t)})),{}):{}}invokeComposed(e,t,...s){return this.hooks[e]?this.expandedFlecks(e).reduce(((t,n)=>this.invokeFleck(e,n,t,...s)),t):t}async invokeComposedAsync(e,t,...s){return this.hooks[e]?this.expandedFlecks(e).reduce((async(t,n)=>this.invokeFleck(e,n,await t,...s)),t):t}invokeFlat(e,...t){return this.hooks[e]?this.hooks[e].map((({fleck:s})=>this.invokeFleck(e,s,...t))):[]}invokeFleck(e,t,...s){if(k("invokeFleck(%s, %s, ...)",e,t),!this.hooks[e])return;const n=this.hooks[e].find((({fleck:e})=>e===t));return n?n.fn(...s.concat(this)):void 0}static $$invokeMerge(e,t){return{...e,...t}}invokeMerge(e,...t){return this.invokeReduce(e,this.constructor.$$invokeMerge,{},...t)}async invokeMergeAsync(e,...t){return this.invokeReduceAsync(e,this.constructor.$$invokeMerge,{},...t)}static $$invokeMergeUnique(){const e={};return(t,s,n,r)=>{const o=Object.keys(s);for(let t=0;t<o.length;++t){const s=o[t];if(e[s])throw new ReferenceError(`Conflict in ${r}: '${e[s]}' implemented '${s}', followed by '${n}'`);e[s]=n}return{...t,...s}}}invokeMergeUnique(e,...t){return this.invokeReduce(e,this.constructor.$$invokeMergeUnique(),{},...t)}async invokeMergeUniqueAsync(e,...t){return this.invokeReduceAsync(e,this.constructor.$$invokeMergeUnique(),{},...t)}invokeReduce(e,t,s,...n){return this.hooks[e]?this.hooks[e].reduce(((s,{fleck:r})=>t(s,this.invokeFleck(e,r,...n),r,e)),s):s}async invokeReduceAsync(e,t,s,...n){return this.hooks[e]?this.hooks[e].reduce((async(s,{fleck:r})=>t(await s,await this.invokeFleck(e,r,...n),r,e)),s):s}invokeSequential(e,...t){if(!this.hooks[e])return[];const s=[],n=this.expandedFlecks(e);for(;n.length>0;){const r=n.shift();s.push(this.invokeFleck(e,r,...t))}return s}async invokeSequentialAsync(e,...t){if(!this.hooks[e])return[];const s=[],n=this.expandedFlecks(e);for(;n.length>0;){const r=n.shift();s.push(await this.invokeFleck(e,r,...t))}return s}lookupFlecks(e){const t=e.indexOf(".");return-1===t?["..."]:this.get([e.slice(0,t),e.slice(t+1)],["..."])}makeMiddleware(e){if(k("makeMiddleware(...): %s",e),!this.hooks[e])return(...e)=>e.pop()();const t=this.expandedFlecks(e);if(0===t.length)return(...e)=>e.pop()();k("middleware: %O",t);const s=new d(t.map((t=>this.invokeFleck(e,t))));return s.dispatch.bind(s)}static priority(e,t={}){const s={};return t.after&&(s.after=Array.isArray(t.after)?t.after:[t.after]),t.before&&(s.before=Array.isArray(t.before)?t.before:[t.before]),e[p]=s,e}static provide(e,{invoke:t=!0,transformer:s=m}={}){return n=>Object.fromEntries(e.keys().map((r=>{const{default:o}=e(r);if(t&&"function"!=typeof o)throw new ReferenceError(`Flecks.provide(): require(${r}).default is not a function (from: ${e.id})`);return[s(this.dasherizePath(r)),t?o(n):o]})))}refresh(e,t){u("refreshing %s...",e),this.unregisterFleckHooks(e),this.registerFleckHooks(e,t),this.configureFleckDefaults(e),this.refreshGathered(e)}async refreshGathered(e){await Promise.all(Object.entries(this.$$gathered).map((async([s,{check:n,idProperty:r,gathered:o,typeProperty:i}])=>{let c;if(this.fleckImplementation(e,`${s}.decorate`)?(c=await this.invokeMergeAsync(s),k("%s implements %s.decorate",e,s)):this.fleckImplementation(e,s)&&(c=await this.invokeFleck(s,e),k("%s implements %s",e,s)),c){const h=await this.checkAndDecorateRawGathered(s,c,n);u("updating gathered %s from %s...",s,e),k("%O",h),Object.entries(h).forEach((([e,n])=>{const{[e]:{[r]:c}}=o,h=y(n,c,r,e,i);o[e]=h,o[c]=h,o[t.So][c]=h,o[t.Rn][e]=h,this.invoke("@flecks/core.hmr.gathered.class",h,s)})),this.invoke("@flecks/core.hmr.gathered",o,s)}})))}registerFleckHooks(e,t){if(k("registering %s...",e),this.flecks[e]=t,t.hooks){const s=Object.keys(t.hooks);k("hooks for '%s': %O",e,s);for(let n=0;n<s.length;n++){const r=s[n];if(this.hooks[r]||(this.hooks[r]=[]),"function"!=typeof t.hooks[r])throw new TypeError(`Hook implementation must be a function! ('${e}' implementing '${r}')`);this.hooks[r].push({fleck:e,fn:t.hooks[r]})}}}unregisterFleckHooks(e){const t=Object.keys(this.hooks);for(let s=0;s<t.length;s++){const n=t[s];if(this.hooks[n]){const t=this.hooks[n].findIndex((({fleck:t})=>t===e));-1!==t&&this.hooks[n].splice(t,1)}}}},t.MH.get=c,t.MH.set=h},736:e=>{e.exports=class{constructor(e=[]){this.middleware=[];for(let t=0;t<e.length;++t)this.middleware.push(this.constructor.check(e[t]))}static check(e){if("function"!=typeof e){if(void 0!==e.then)throw new TypeError("middleware expected a function, looks like a promise");throw new TypeError("middleware expected a function")}return e}dispatch(...e){const t=e.pop(),s=this.middleware.concat(),n=r=>{if(s.length>0){const t=s.shift();if(e.length+2===t.length==!r)n(r);else try{t(...e.concat(r?[r]:[]).concat(n))}catch(r){n(r)}}else t&&setTimeout((()=>t(r)),0)};n()}promise(...e){return new Promise(((t,s)=>{this.dispatch(...e.concat((e=>{e?s(e):t()})))}))}use(e){this.middleware.push(this.constructor.check(e))}}},17:e=>{"use strict";e.exports=require("path")},999:t=>{"use strict";t.exports=e},46:e=>{"use strict";e.exports=t},697:e=>{"use strict";e.exports=s}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var s=r[e]={exports:{}};return n[e](s,s.exports,o),s.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var s in t)o.o(t,s)&&!o.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";o.r(i),o.d(i,{ById:()=>l.So,ByType:()=>l.Rn,Class:()=>t.a,D:()=>c.a,EventEmitter:()=>a.a,Flecks:()=>l.MH,compose:()=>n.a,hooks:()=>f});var e=o(305),t=o.n(e),s=o(269),n=o.n(s),r=o(157),c=o.n(r),h=o(848),a=o.n(h),l=o(278),f={"@flecks/web.config":async(e,t)=>({id:t.get("@flecks/core.id")})}})(),i})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("debug"),require("lodash.get"),require("set-value")):"function"==typeof define&&define.amd?define("@flecks/core",["debug","lodash.get","set-value"],t):"object"==typeof exports?exports["@flecks/core"]=t(require("debug"),require("lodash.get"),require("set-value")):e["@flecks/core"]=t(e.debug,e["lodash.get"],e["set-value"])}(global,((e,t,s)=>{return r={740:(e,t,s)=>{function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},r.apply(this,arguments)}var{join:o}=s(72),{FLECKS_CORE_ROOT:n=process.cwd()}=process.env;e.exports=r(r({Class:s(244),compose:s(596),D:s(816),EventEmitter:s(824)},s(664)),{},{hooks:{"@flecks/core.hmr":(e,t,s)=>{e===o(n,"build","flecks.yml")&&Object.entries(s.constructor.dealiasedConfig(t)).forEach((e=>{var[t,r]=e;if(JSON.stringify(s.originalConfig[t])!==JSON.stringify(r)){for(var o=s.flecksImplementing("@flecks/core.reload"),n=0;n<o.length;++n)try{s.invokeFleck("@flecks/core.reload",o[n],t,r)}catch(e){throw new Error("'".concat(t,"' aborted reload: ").concat(e.name,": ").concat(e.message))}s.originalConfig[t]=r,s.configureFleckDefaults(t)}}))},"@flecks/web.config":async(e,t)=>({id:t.get("@flecks/core.id")})}})},244:e=>{e.exports=class{}},596:e=>{e.exports=function(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...s)=>e(t(...s))))}},816:(e,t,s)=>{const r=s(856),{VSCODE_INSPECTOR_OPTIONS:o}=process.env;e.exports=e=>{{if(o){const{formatArgs:e}=r;r.formatArgs=function(t){const{useColors:s}=this;t[0].match(/%[oO]/)&&(this.useColors=!1),e.call(this,t),this.useColors=s},r.formatters.o=void 0,r.formatters.O=void 0}const e="web"===process.env.FLECKS_CORE_BUILD_TARGET?"debug":"error";r.log=console[e].bind(console)}return r(e)}},568:e=>{e.exports=class{arcs=new Map;addDependency(e,t){this.ensureTail(e),this.ensureTail(t).add(e)}detectCycles(){const e=[],t=new Set,s=new Set,r=o=>{if(!t.has(o)){t.add(o),s.add(o);const n=this.neighbors(o);for(let i=n.next();!0!==i.done;i=n.next()){const{value:n}=i;t.has(n)?s.has(n)&&e.push([o,n]):r(n)}}s.delete(o)},{tails:o}=this;for(let e=o.next();!0!==e.done;e=o.next())r(e.value);return e}ensureTail(e){return this.arcs.has(e)||this.arcs.set(e,new Set),this.arcs.get(e)}neighbors(e){return this.arcs.get(e).values()}sort(){const e=new Set,t=new Map,s=(r,o)=>{e.add(r);const n=this.neighbors(r);for(let t=n.next();!0!==t.done;t=n.next()){const{value:r}=t;e.has(r)||(o=s(r,o))}return t.set(r,o),o-1};let r=this.arcs.size-1;const{tails:o}=this;for(let t=o.next();!0!==t.done;t=o.next()){const{value:o}=t;e.has(o)||(r=s(o,r))}return Array.from(t.entries()).sort((([,e],[,t])=>e-t)).map((([e])=>e))}removeDependency(e,t){this.arcs.has(t)&&this.arcs.get(t).delete(e)}get tails(){return this.arcs.keys()}}},824:e=>{e.exports=function(e){return class extends e{constructor(...e){super(...e),this.$$events=Object.create(null)}addListener(e,t,s){return this.on(e,t,s)}emit(e,...t){const s=this.$$events[e];s&&s.length>0&&this.emitToListeners(s,t)}emitToListeners(e,t){for(let s=0;s<e.length;++s){const{once:r,type:o,fn:n,bound:i,that:c}=e[s];r&&this.offSingleEvent(o,n),0===t.length?i():1===t.length?i(t[0]):2===t.length?i(t[0],t[1]):3===t.length?i(t[0],t[1],t[2]):4===t.length?i(t[0],t[1],t[2],t[3]):5===t.length?i(t[0],t[1],t[2],t[3],t[4]):n.apply(c,t)}}off(e,t){const s=Array.isArray(e)?e:[e];for(let e=0;e<s.length;e++)this.offSingleEvent(s[e],t);return this}offSingleEvent(e,t){"function"==typeof t?e in this.$$events&&(this.$$events[e]=this.$$events[e].filter((e=>e.fn!==t))):e in this.$$events&&(this.$$events[e]=[])}on(e,t,s=void 0){return this.$$on(e,t,s,!1),this}$$on(e,t,s,r){const o=Array.isArray(e)?e:[e];for(let e=0;e<o.length;e++)this.onSingleEvent(o[e],t,s,r)}once(e,t,s=void 0){return this.$$on(e,t,s,!0),this}onSingleEvent(e,t,s,r){if("function"!=typeof t)throw new TypeError("EventEmitter::onSingleEvent() requires function listener");const o=((e,t,s,r)=>({fn:e,that:t,type:s,once:r,bound:t?e.bind(t):e}))(t,s,e,r);e in this.$$events||(this.$$events[e]=[]),this.$$events[e].push(o)}removeListener(...e){return this.off(...e)}}}},664:(e,t,s)=>{const{basename:r,dirname:o,extname:n,join:i}=s(72),c=s(376),h=s(672),a=s(596),l=s(816),f=s(568),u=s(108),d=l("@flecks/core/flecks"),k=d.extend("silly"),p=Symbol.for("@flecks/core.hookPriority");t.ById=Symbol.for("@flecks/core.byId"),t.ByType=Symbol.for("@flecks/core.byType");const g=e=>e.substring(0,1).toUpperCase()+e.substring(1),y=e=>e.split(/[_-]/).map(g).join(""),m=(e,t,s,r,o)=>class extends e{static get[s](){return t}static get[o](){return r}};class v{config={};$$expandedFlecksCache={};flecks={};$$gathered={};hooks={};constructor({bootstrappedConfig:e={},config:t={},flecks:s={}}={}){this.bootstrappedConfig=JSON.parse(JSON.stringify(e)),this.originalConfig=JSON.parse(JSON.stringify(t)),this.config={};const r=Object.entries(s);this.constructor.debugSilly("paths: %O",r.map((([e])=>e)));for(let e=0;e<r.length;e++){const[t,s]=r[e];this.registerFleckHooks(t,s),this.invoke("@flecks/core.registered",t,s)}this.configureFlecksDefaults(),this.constructor.debugSilly("config: %O",this.config)}configureFleckDefaults(e){this.config[e]={...this.bootstrappedConfig[e],...this.invokeFleck("@flecks/core.config",e),...this.originalConfig[e]}}configureFlecksDefaults(){const e=Object.keys(this.flecks);for(let t=0;t<e.length;t++)this.configureFleckDefaults(e[t]);[].concat([this.bootstrappedConfig,this.originalConfig].map(Object.keys)).flat().forEach((e=>{this.config[e]={...this.bootstrappedConfig[e],...this.originalConfig[e],...this.config[e]}}))}static dasherizePath(e){const t=o(e).split("/");return"."===t[0]&&t.shift(),"index"===t[t.length-1]&&t.pop(),i(t.join("-"),r(e,n(e)))}static dealiasedConfig(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>{const s=e.indexOf(":");return[-1===s?e:e.slice(0,s),t]})))}static decorate(e,{transformer:t=y}={}){return(s,r)=>e.keys().reduce(((s,o)=>{const n=t(this.dasherizePath(o));if(!s[n])return s;const{default:i}=e(o);if("function"!=typeof i)throw new ReferenceError(`Flecks.decorate(): require(${o}).default is not a function (from: ${e.id})`);return{...s,[n]:i(s[n],r)}}),s)}async checkAndDecorateRawGathered(e,t,s){s(t,e);const r=await this.invokeComposedAsync(`${e}.decorate`,t);return s(r,`${e}.decorate`),r}destroy(){this.$$expandedFlecksCache={},this.config={},this.$$gathered={},this.hooks={},this.flecks={}}expandedFlecks(e){if(this.$$expandedFlecksCache[e])return[...this.$$expandedFlecksCache[e]];const t=this.lookupFlecks(e);let s=[];for(let e=0;e<t.length;++e){const r=t[e];s.push(r)}const r=s.findIndex((e=>"..."===e));if(-1!==r){if(-1!==s.slice(r+1).findIndex((e=>"..."===e)))throw new Error(`Illegal ordering specification: hook '${e}' has multiple ellipses.`);const t=s.slice(0,r),o=s.slice(r+1);s.splice(r,1);const n=[],i=this.flecksImplementing(e);for(let e=0;e<i.length;++e){const t=i[e];s.includes(t)||n.push(t)}const c=this.flecksHookGraph([...t,...n,...o],e),h=c.detectCycles();if(h.length>0)throw new Error(`Illegal ordering specification: hook '${e}' has positioning cycles: ${h.map((([e,t])=>`${e} <-> ${t}`)).join(", ")}`);s=[...t,...c.sort().filter((e=>!s.includes(e))),...o]}const o=this.flecksHookGraph(s,e);s.forEach(((e,t)=>{t<s.length-1&&o.addDependency(s[t+1],e)}));const n=o.detectCycles();return n.length>0&&n.forEach((([t,s])=>{const r=this.fleckImplementation(t,e),{before:o=[],after:n=[]}=r?.[p]||{},i=[e];o.includes(s)&&i.push(t,"before",s),n.includes(s)&&i.push(t,"after",s);const c=this.fleckImplementation(s,e),{before:h=[],after:a=[]}=c?.[p]||{};h.includes(t)&&i.push(s,"before",t),a.includes(t)&&i.push(s,"after",t),this.constructor.debug("Suspicious ordering specification for '%s': '%s' expected to run %s '%s'!",...i)})),this.$$expandedFlecksCache[e]=s.filter((t=>this.fleckImplementation(t,e))),this.constructor.debugSilly("cached hook expansion for '%s': %O",e,s),[...this.$$expandedFlecksCache[e]]}fleck(e){return this.flecks[e]}fleckImplementation(e,t){if(!this.hooks[t])return;const s=this.hooks[t]?.find((({fleck:t})=>e===t));return s?s.fn:void 0}flecksImplementing(e){return this.hooks[e]?.map((({fleck:e})=>e))||[]}flecksHookGraph(e,t){const s=new f;return e.forEach((e=>{s.ensureTail(e);const r=this.fleckImplementation(e,t);r?.[p]&&(r[p].before&&r[p].before.forEach((t=>{s.addDependency(t,e)})),r[p].after&&r[p].after.forEach((t=>{s.addDependency(e,t)})))})),this.invoke("@flecks/core.priority",s,t),s}static async from(e){const{flecks:t}=e,s=Object.entries(t).map((([e,{mixin:t}])=>[e,t])).filter((([,e])=>e));this.debugSilly("mixins: %O",s.map((([e])=>e)));const r=new(a(...s.map((([,e])=>e)))(this))(e);return await r.gatherHooks(),await r.invokeSequentialAsync("@flecks/core.starting"),r}async gather(e,{idProperty:s="id",typeProperty:r="type",check:o=(()=>{})}={}){if(!e||"string"!=typeof e)throw new TypeError("Flecks.gather(): Expects parameter 1 (hook) to be string");const n=await this.invokeMergeAsync(e),i=await this.checkAndDecorateRawGathered(e,n,o);let c=1;const h={},a=Object.fromEntries(Object.entries(i).sort((([e],[t])=>e<t?-1:1)).map((([e,t])=>{const o=c++;return h[o]=m(t,o,s,e,r),[e,h[o]]}))),l={...h,...a,[t.ById]:h,[t.ByType]:a};return this.$$gathered[e]={check:o,idProperty:s,typeProperty:r,gathered:l},this.constructor.debug("gathered '%s': %O",e,Object.keys(l[t.ByType])),l}gathered(e){return this.$$gathered[e]?.gathered}async gatherHooks(){const e=await this.invokeAsync("@flecks/core.gathered");await Promise.all(Object.entries(e).map((([e,t])=>Promise.all(Object.entries(t).map((([t,s])=>this.gather(`${e}.${t}`,s)))))))}get(e,t){return c(this.config,e,t)}interpolate(e){return e.replace(/\[(.*?)\]/g,(e=>this.get(e)))}invoke(e,...t){return this.hooks[e]?this.flecksImplementing(e).reduce(((s,r)=>({...s,[r]:this.invokeFleck(e,r,...t)})),{}):{}}async invokeAsync(e,...t){return this.hooks[e]?this.flecksImplementing(e).reduce((async(s,r)=>({...await s,[r]:await this.invokeFleck(e,r,...t)})),{}):{}}invokeComposed(e,t,...s){return this.hooks[e]?this.expandedFlecks(e).reduce(((t,r)=>this.invokeFleck(e,r,t,...s)),t):t}async invokeComposedAsync(e,t,...s){return this.hooks[e]?this.expandedFlecks(e).reduce((async(t,r)=>this.invokeFleck(e,r,await t,...s)),t):t}invokeFlat(e,...t){return this.hooks[e]?this.hooks[e].map((({fleck:s})=>this.invokeFleck(e,s,...t))):[]}invokeFleck(e,t,...s){if(this.constructor.debugSilly("invokeFleck(%s, %s, ...)",e,t),!this.hooks[e])return;const r=this.hooks[e].find((({fleck:e})=>e===t));return r?r.fn(...s.concat(this)):void 0}static $$invokeMerge(e,t){return{...e,...t}}invokeMerge(e,...t){return this.invokeReduce(e,this.constructor.$$invokeMerge,{},...t)}async invokeMergeAsync(e,...t){return this.invokeReduceAsync(e,this.constructor.$$invokeMerge,{},...t)}static $$invokeMergeUnique(){const e={};return(t,s,r,o)=>{const n=Object.keys(s);for(let t=0;t<n.length;++t){const s=n[t];if(e[s])throw new ReferenceError(`Conflict in ${o}: '${e[s]}' implemented '${s}', followed by '${r}'`);e[s]=r}return{...t,...s}}}invokeMergeUnique(e,...t){return this.invokeReduce(e,this.constructor.$$invokeMergeUnique(),{},...t)}async invokeMergeUniqueAsync(e,...t){return this.invokeReduceAsync(e,this.constructor.$$invokeMergeUnique(),{},...t)}invokeReduce(e,t,s,...r){return this.hooks[e]?this.hooks[e].reduce(((s,{fleck:o})=>t(s,this.invokeFleck(e,o,...r),o,e)),s):s}async invokeReduceAsync(e,t,s,...r){return this.hooks[e]?this.hooks[e].reduce((async(s,{fleck:o})=>t(await s,await this.invokeFleck(e,o,...r),o,e)),s):s}invokeSequential(e,...t){if(!this.hooks[e])return[];const s=[],r=this.expandedFlecks(e);for(;r.length>0;){const o=r.shift();s.push(this.invokeFleck(e,o,...t))}return s}async invokeSequentialAsync(e,...t){if(!this.hooks[e])return[];const s=[],r=this.expandedFlecks(e);for(;r.length>0;){const o=r.shift();s.push(await this.invokeFleck(e,o,...t))}return s}lookupFlecks(e){const t=e.indexOf(".");return-1===t?["..."]:this.get([e.slice(0,t),e.slice(t+1)],["..."])}makeMiddleware(e){if(this.constructor.debugSilly("makeMiddleware(...): %s",e),!this.hooks[e])return(...e)=>e.pop()();const t=this.expandedFlecks(e);if(0===t.length)return(...e)=>e.pop()();this.constructor.debugSilly("middleware: %O",t);const s=new u(t.map((t=>this.invokeFleck(e,t))));return s.dispatch.bind(s)}static priority(e,t={}){const s={};return t.after&&(s.after=Array.isArray(t.after)?t.after:[t.after]),t.before&&(s.before=Array.isArray(t.before)?t.before:[t.before]),e[p]=s,e}static provide(e,{invoke:t=!0,transformer:s=y}={}){return r=>Object.fromEntries(e.keys().map((o=>{const{default:n}=e(o);if(t&&"function"!=typeof n)throw new ReferenceError(`Flecks.provide(): require(${o}).default is not a function (from: ${e.id})`);return[s(this.dasherizePath(o)),t?n(r):n]})))}refresh(e,t){this.constructor.debug("refreshing %s...",e),this.unregisterFleckHooks(e),this.registerFleckHooks(e,t),this.configureFleckDefaults(e),this.refreshGathered(e)}async refreshGathered(e){await Promise.all(Object.entries(this.$$gathered).map((async([s,{check:r,idProperty:o,gathered:n,typeProperty:i}])=>{let c;if(this.fleckImplementation(e,`${s}.decorate`)?(c=await this.invokeMergeAsync(s),this.constructor.debugSilly("%s implements %s.decorate",e,s)):this.fleckImplementation(e,s)&&(c=await this.invokeFleck(s,e),this.constructor.debugSilly("%s implements %s",e,s)),c){const h=await this.checkAndDecorateRawGathered(s,c,r);this.constructor.debug("updating gathered %s from %s...",s,e),this.constructor.debugSilly("%O",h),Object.entries(h).forEach((([e,r])=>{const{[e]:{[o]:c}}=n,h=m(r,c,o,e,i);n[e]=h,n[c]=h,n[t.ById][c]=h,n[t.ByType][e]=h,this.invoke("@flecks/core.hmr.gathered.class",h,s)})),this.invoke("@flecks/core.hmr.gathered",n,s)}})))}registerFleckHooks(e,t){if(this.constructor.debugSilly("registering %s...",e),this.flecks[e]=t,t.hooks){const s=Object.keys(t.hooks);this.constructor.debugSilly("hooks for '%s': %O",e,s);for(let r=0;r<s.length;r++){const o=s[r];if(this.hooks[o]||(this.hooks[o]=[]),"function"!=typeof t.hooks[o])throw new TypeError(`Hook implementation must be a function! ('${e}' implementing '${o}')`);this.hooks[o].push({fleck:e,fn:t.hooks[o]})}}}unregisterFleckHooks(e){const t=Object.keys(this.hooks);for(let s=0;s<t.length;s++){const r=t[s];if(this.hooks[r]){const t=this.hooks[r].findIndex((({fleck:t})=>t===e));-1!==t&&this.hooks[r].splice(t,1)}}}}v.debug=d,v.debugSilly=k,v.get=c,v.set=h,t.Flecks=v},108:e=>{e.exports=class{constructor(e=[]){this.middleware=[];for(let t=0;t<e.length;++t)this.middleware.push(this.constructor.check(e[t]))}static check(e){if("function"!=typeof e){if(void 0!==e.then)throw new TypeError("middleware expected a function, looks like a promise");throw new TypeError("middleware expected a function")}return e}dispatch(...e){const t=e.pop(),s=this.middleware.concat(),r=o=>{if(s.length>0){const t=s.shift();if(e.length+2===t.length==!o)r(o);else try{t(...e.concat(o?[o]:[]).concat(r))}catch(o){r(o)}}else t&&setTimeout((()=>t(o)),0)};r()}promise(...e){return new Promise(((t,s)=>{this.dispatch(...e.concat((e=>{e?s(e):t()})))}))}use(e){this.middleware.push(this.constructor.check(e))}}},72:e=>{"use strict";e.exports=require("path")},856:t=>{"use strict";t.exports=e},376:e=>{"use strict";e.exports=t},672:e=>{"use strict";e.exports=s}},o={},function e(t){var s=o[t];if(void 0!==s)return s.exports;var n=o[t]={exports:{}};return r[t](n,n.exports,e),n.exports}(740);var r,o}));
//# sourceMappingURL=index.js.map
{
"name": "@flecks/core",
"version": "3.2.1",
"version": "4.0.0",
"author": "cha0s",

@@ -11,3 +11,4 @@ "license": "MIT",

"postversion": "npm run build",
"test": "npm run build -d && mocha --colors ./dist/test.js"
"test": "webpack --config ./build/test.webpack.config.js --mode production && mocha --colors --parallel ./dist/test/*.js ./dist/test/server/*.js",
"test:watch": "webpack watch --config ./build/test.webpack.config.js --mode development & mocha --colors --parallel --watch --watch-files ./dist/test/*.js ./dist/test/server/*.js"
},

@@ -50,3 +51,2 @@ "repository": {

"chai-as-promised": "7.1.1",
"clear-module": "^4.1.2",
"copy-webpack-plugin": "^11.0.0",

@@ -64,3 +64,3 @@ "eslint": "^8.56.0",

"mocha": "^10.2.0",
"rimraf": "^3.0.2",
"rimraf": "^5.0.5",
"source-map-loader": "4.0.1",

@@ -67,0 +67,0 @@ "webpack": "^5.89.0",

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("glob"),require("jsonparse"),require("debug")):"function"==typeof define&&define.amd?define("@flecks/core",["glob","jsonparse","debug"],r):"object"==typeof exports?exports["@flecks/core"]=r(require("glob"),require("jsonparse"),require("debug")):e["@flecks/core"]=r(e.glob,e.jsonparse,e.debug)}(global,((e,r,n)=>(()=>{var s={157:(e,r,n)=>{const s=n(999),{VSCODE_INSPECTOR_OPTIONS:t}=process.env;e.exports=e=>{{if(t){const{formatArgs:e}=s;s.formatArgs=function(r){const{useColors:n}=this;r[0].match(/%[oO]/)&&(this.useColors=!1),e.call(this,r),this.useColors=n},s.formatters.o=void 0,s.formatters.O=void 0}const e="web"===process.env.FLECKS_CORE_BUILD_TARGET?"debug":"error";s.log=console[e].bind(console)}return s(e)}},250:(e,r,n)=>{const s=n(558),{Transform:t}=n(781);r.n=class extends t{constructor(){super();const e=this;this.done=void 0,this.parser=new s,this.parser.onValue=function(r){0===this.stack.length&&(e.push(JSON.stringify(r)),e.done())}}_transform(e,r,n){this.done=n,this.parser.write(e)}},r.n.PrettyPrint=class extends t{constructor(e=2){super(),this.indent=e}async _transform(e,r,n){this.push(JSON.stringify(JSON.parse(e),null,this.indent)),n()}},r.v=(e,r={})=>new class extends t{constructor(){super(r)}_transform(r,n,s){e(r,n,s,this)}}},781:e=>{"use strict";e.exports=require("stream")},999:e=>{"use strict";e.exports=n},484:r=>{"use strict";r.exports=e},558:e=>{"use strict";e.exports=r}},t={};function o(e){var r=t[e];if(void 0!==r)return r.exports;var n=t[e]={exports:{}};return s[e](n,n.exports,o),n.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var n in r)o.o(r,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";o.r(a),o.d(a,{JsonStream:()=>r.n,add:()=>f,build:()=>b,glob:()=>e.glob,inferPackageManager:()=>d,install:()=>g,lockFile:()=>v,processCode:()=>u,spawnWith:()=>p,transform:()=>r.v});var e=o(484),r=o(250);const n=require("child_process");var s=o(157);function t(){return t=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},t.apply(this,arguments)}var c=o.n(s)()("@flecks/core/server"),i=c.extend("silly"),u=e=>new Promise(((r,n)=>{e.on("error",n),e.on("exit",(s=>{e.off("error",n),r(s)}))})),p=function(e,r){return void 0===r&&(r={}),c("spawning: '%s'",e.join(" ")),i("with options: %O",r),(0,n.spawn)(e[0],e.slice(1),t(t({stdio:"inherit"},r),{},{env:t(t({},process.env),r.env)}))},{npm_config_user_agent:l="npm"}=process.env,d=()=>l.split("/")[0],b=async e=>{var r,{cwd:n,packageManager:s=d()}=e;switch(s){case"bun":r=["bun","run","build"];break;case"npm":r=["npm","run","build"];break;case"pnpm":r=["pnpm","run","build"];break;case"yarn":r=["yarn","run","build"]}return r&&u(p(r,{cwd:n}))},f=async e=>{var r,{dev:n,packageManager:s=d(),packages:t}=e;switch(s){case"bun":r=["bun","add",...n?["--dev"]:[],...t];break;case"npm":r=["npm","install",...n?["--save-dev"]:[],...t];break;case"pnpm":r=["pnpm","add",...n?["--save-dev"]:[],...t];break;case"yarn":r=["yarn","add",...n?["--dev"]:[],...t]}return r&&u(p(r))},g=async e=>{var r,{cwd:n,packageManager:s=d()}=e;switch(s){case"bun":r=["bun","install"];break;case"npm":r=["npm","install"];break;case"pnpm":r=["pnpm","install"];break;case"yarn":r=["yarn","install"]}return r&&u(p(r,{cwd:n}))},v=function(e){switch(void 0===e&&(e=d()),e){case"bun":return"bun.lockb";case"npm":return"package-lock.json";case"pnpm":return"pnpm-lock.yaml";case"yarn":return"yarn.lock";default:return""}}})(),a})()));
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("debug"),require("glob"),require("jsonparse")):"function"==typeof define&&define.amd?define("@flecks/core",["debug","glob","jsonparse"],r):"object"==typeof exports?exports["@flecks/core"]=r(require("debug"),require("glob"),require("jsonparse")):e["@flecks/core"]=r(e.debug,e.glob,e.jsonparse)}(global,((__WEBPACK_EXTERNAL_MODULE__856__,__WEBPACK_EXTERNAL_MODULE__488__,__WEBPACK_EXTERNAL_MODULE__728__)=>(()=>{var __webpack_modules__={24:(e,r,n)=>{function s(){return s=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},s.apply(this,arguments)}e.exports=s(s(s({glob:n(488).glob},n(968)),n(484)),n(524))},484:(e,r,n)=>{var{processCode:s,spawnWith:t}=n(524),{npm_config_user_agent:a="npm"}=process.env;r.inferPackageManager=()=>a.split("/")[0],r.build=async e=>{var n,{cwd:a,packageManager:o=r.inferPackageManager()}=e;switch(o){case"bun":n=["bun","run","build"];break;case"npm":n=["npm","run","build"];break;case"pnpm":n=["pnpm","run","build"];break;case"yarn":n=["yarn","run","build"]}return n&&s(t(n,{cwd:a}))},r.add=async e=>{var n,{dev:a,packageManager:o=r.inferPackageManager(),packages:i}=e;switch(o){case"bun":n=["bun","add",...a?["--dev"]:[],...i];break;case"npm":n=["npm","install",...a?["--save-dev"]:[],...i];break;case"pnpm":n=["pnpm","add",...a?["--save-dev"]:[],...i];break;case"yarn":n=["yarn","add",...a?["--dev"]:[],...i]}return n&&s(t(n))},r.install=async e=>{var n,{cwd:a,packageManager:o=r.inferPackageManager()}=e;switch(o){case"bun":n=["bun","install"];break;case"npm":n=["npm","install"];break;case"pnpm":n=["pnpm","install"];break;case"yarn":n=["yarn","install"]}return n&&s(t(n,{cwd:a}))},r.lockFile=function(e){switch(void 0===e&&(e=r.inferPackageManager()),e){case"bun":return"bun.lockb";case"npm":return"package-lock.json";case"pnpm":return"pnpm-lock.yaml";case"yarn":return"yarn.lock";default:return""}}},524:(__unused_webpack_module,exports,__webpack_require__)=>{var _excluded=["useFork"];function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(e,r){if(null==e)return{};var n,s,t={},a=Object.keys(e);for(s=0;s<a.length;s++)n=a[s],r.indexOf(n)>=0||(t[n]=e[n]);return t}var{fork,spawn}=__webpack_require__(368),{access,constants:{X_OK},realpath}=__webpack_require__(392),{dirname,join,sep}=__webpack_require__(72),D=__webpack_require__(816),debug=D("@flecks/core/server"),debugSilly=debug.extend("silly"),{FLECKS_CORE_ROOT=process.cwd()}=process.env;exports.binaryPath=async function(binary,root){void 0===root&&(root=FLECKS_CORE_ROOT);for(var resolved=dirname(await realpath(eval("require").resolve(join(root,"package.json")))),parts=resolved.split(sep);parts.length>0;){var path=parts.concat(join("node_modules",".bin",binary)).join(sep);try{return await access(path,X_OK),path}catch(e){parts.pop()}}throw new Error("Binary '".concat(binary,"' not found! (root: ").concat(root,")"))},exports.processCode=e=>new Promise(((r,n)=>{e.on("error",n),e.on("exit",(s=>{e.off("error",n),r(s)}))}));var children=[];exports.spawnWith=function(e,r){void 0===r&&(r={});var{useFork:n}=r,s=_objectWithoutPropertiesLoose(r,_excluded);debug("%sing: '%s'",n?"fork":"spawn",e.join(" ")),debugSilly("with options: %O",s);var t=(n?fork:spawn)(e[0],e.slice(1),_extends(_extends({stdio:"inherit"},s),{},{env:_extends(_extends({},process.env),s.env)}));return children.push(t),t.on("exit",(()=>{children.splice(children.indexOf(t),1)})),t};var killed=!1;function handleTerminationEvent(e){process.on(e,(()=>{killed||(killed=!0,children.forEach((e=>{e.kill()})),"exit"!==e&&process.exit(1))}))}handleTerminationEvent("exit"),handleTerminationEvent("SIGINT"),handleTerminationEvent("SIGTERM")},816:(e,r,n)=>{const s=n(856),{VSCODE_INSPECTOR_OPTIONS:t}=process.env;e.exports=e=>{{if(t){const{formatArgs:e}=s;s.formatArgs=function(r){const{useColors:n}=this;r[0].match(/%[oO]/)&&(this.useColors=!1),e.call(this,r),this.useColors=n},s.formatters.o=void 0,s.formatters.O=void 0}const e="web"===process.env.FLECKS_CORE_BUILD_TARGET?"debug":"error";s.log=console[e].bind(console)}return s(e)}},968:(e,r,n)=>{const s=n(728),{Transform:t}=n(378);r.JsonStream=class extends t{constructor(){super();const e=this;this.done=void 0,this.parser=new s,this.parser.onValue=function(r){0===this.stack.length&&(e.push(JSON.stringify(r)),e.done())}}_transform(e,r,n){this.done=n,this.parser.write(e)}},r.JsonStream.PrettyPrint=class extends t{constructor(e=2){super(),this.indent=e}async _transform(e,r,n){this.push(JSON.stringify(JSON.parse(e),null,this.indent)),n()}},r.transform=(e,r={})=>new class extends t{constructor(){super(r)}_transform(r,n,s){e(r,n,s,this)}}},368:e=>{"use strict";e.exports=require("child_process")},392:e=>{"use strict";e.exports=require("fs/promises")},72:e=>{"use strict";e.exports=require("path")},378:e=>{"use strict";e.exports=require("stream")},856:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__856__},488:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__488__},728:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__728__}},__webpack_module_cache__={};function __webpack_require__(e){var r=__webpack_module_cache__[e];if(void 0!==r)return r.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}var __webpack_exports__=__webpack_require__(24);return __webpack_exports__})()));
//# sourceMappingURL=server.js.map

@@ -1,15 +0,41 @@

export {default as Class} from '../build/class';
export {default as compose} from '../build/compose';
export {default as D} from '../build/debug';
export {default as EventEmitter} from '../build/event-emitter';
export {
ById,
ByType,
Flecks,
} from '../build/flecks';
/* eslint-disable global-require */
export const hooks = {
'@flecks/web.config': async (req, flecks) => ({
id: flecks.get('@flecks/core.id'),
}),
const {join} = require('path');
const {
FLECKS_CORE_ROOT = process.cwd(),
} = process.env;
module.exports = {
Class: require('../build/class'),
compose: require('../build/compose'),
D: require('../build/debug'),
EventEmitter: require('../build/event-emitter'),
...require('../build/flecks'),
hooks: {
'@flecks/core.hmr': (path, config, flecks) => {
if (path !== join(FLECKS_CORE_ROOT, 'build', 'flecks.yml')) {
return;
}
Object.entries(flecks.constructor.dealiasedConfig(config))
.forEach(([fleck, value]) => {
if (JSON.stringify(flecks.originalConfig[fleck]) !== JSON.stringify(value)) {
const fleckList = flecks.flecksImplementing('@flecks/core.reload');
for (let i = 0; i < fleckList.length; ++i) {
try {
flecks.invokeFleck('@flecks/core.reload', fleckList[i], fleck, value);
}
catch (error) {
throw new Error(`'${fleck}' aborted reload: ${error.name}: ${error.message}`);
}
}
flecks.originalConfig[fleck] = value;
flecks.configureFleckDefaults(fleck);
}
});
},
'@flecks/web.config': async (req, flecks) => ({
id: flecks.get('@flecks/core.id'),
}),
},
};

@@ -1,5 +0,8 @@

export {glob} from 'glob';
/* eslint-disable global-require */
export * from '../../build/stream';
export * from './package-manager';
export * from './process';
module.exports = {
glob: require('glob').glob,
...require('../../build/stream'),
...require('./package-manager'),
...require('./process'),
};

@@ -1,2 +0,2 @@

import {processCode, spawnWith} from './process';
const {processCode, spawnWith} = require('./process');

@@ -8,6 +8,6 @@ /* eslint-disable camelcase */

export const inferPackageManager = () => npm_config_user_agent.split('/')[0];
exports.inferPackageManager = () => npm_config_user_agent.split('/')[0];
/* eslint-enable camelcase */
export const build = async ({cwd, packageManager = inferPackageManager()}) => {
exports.build = async ({cwd, packageManager = exports.inferPackageManager()}) => {
let args;

@@ -32,3 +32,3 @@ switch (packageManager) {

export const add = async ({dev, packageManager = inferPackageManager(), packages}) => {
exports.add = async ({dev, packageManager = exports.inferPackageManager(), packages}) => {
let args;

@@ -69,3 +69,3 @@ switch (packageManager) {

export const install = async ({cwd, packageManager = inferPackageManager()}) => {
exports.install = async ({cwd, packageManager = exports.inferPackageManager()}) => {
let args;

@@ -90,3 +90,3 @@ switch (packageManager) {

export const lockFile = (packageManager = inferPackageManager()) => {
exports.lockFile = (packageManager = exports.inferPackageManager()) => {
switch (packageManager) {

@@ -93,0 +93,0 @@ case 'bun':

@@ -1,4 +0,10 @@

import {spawn} from 'child_process';
const {fork, spawn} = require('child_process');
const {
access,
constants: {X_OK},
realpath,
} = require('fs/promises');
const {dirname, join, sep} = require('path');
import D from '../../build/debug';
const D = require('../../build/debug');

@@ -8,3 +14,25 @@ const debug = D('@flecks/core/server');

export const processCode = (child) => new Promise((resolve, reject) => {
const {
FLECKS_CORE_ROOT = process.cwd(),
} = process.env;
exports.binaryPath = async (binary, root = FLECKS_CORE_ROOT) => {
// eslint-disable-next-line no-eval
const resolved = dirname(await realpath(eval('require').resolve(join(root, 'package.json'))));
const parts = resolved.split(sep);
while (parts.length > 0) {
const path = parts.concat(join('node_modules', '.bin', binary)).join(sep);
try {
// eslint-disable-next-line no-await-in-loop
await access(path, X_OK);
return path;
}
catch (error) {
parts.pop();
}
}
throw new Error(`Binary '${binary}' not found! (root: ${root})`);
};
exports.processCode = (child) => new Promise((resolve, reject) => {
child.on('error', reject);

@@ -17,14 +45,43 @@ child.on('exit', (code) => {

export const spawnWith = (cmd, opts = {}) => {
debug("spawning: '%s'", cmd.join(' '));
debugSilly('with options: %O', opts);
const child = spawn(cmd[0], cmd.slice(1), {
const children = [];
exports.spawnWith = (cmd, opts = {}) => {
const {useFork, ...rest} = opts;
debug("%sing: '%s'", useFork ? 'fork' : 'spawn', cmd.join(' '));
debugSilly('with options: %O', rest);
const child = (useFork ? fork : spawn)(cmd[0], cmd.slice(1), {
stdio: 'inherit',
...opts,
...rest,
env: {
...process.env,
...opts.env,
...rest.env,
},
});
children.push(child);
child.on('exit', () => {
children.splice(children.indexOf(child), 1);
});
return child;
};
let killed = false;
function handleTerminationEvent(signal) {
// Clean up on exit.
process.on(signal, () => {
if (killed) {
return;
}
killed = true;
children.forEach((child) => {
child.kill();
});
if ('exit' !== signal) {
process.exit(1);
}
});
}
handleTerminationEvent('exit');
handleTerminationEvent('SIGINT');
handleTerminationEvent('SIGTERM');

@@ -5,13 +5,19 @@ import {expect} from 'chai';

const testOne = require('./packages/one');
const testTwo = require('./packages/two');
it('can gather', async () => {
const flecks = await Flecks.from({
flecks: {
'@flecks/core/one': testOne,
'@flecks/core/two': testTwo,
one: {
hooks: {
'one.gather': Flecks.provide(require.context('./gather/one', false)),
'one.gather.decorate': Flecks.decorate(require.context('./gather/one/decorators', false)),
},
},
two: {
hooks: {
'one.gather': Flecks.provide(require.context('./gather/two', false)),
},
},
},
});
const Gathered = await flecks.gather('@flecks/core/one/test-gather');
const Gathered = await flecks.gather('one.gather');
expect(Object.keys(Gathered[ByType]).length)

@@ -18,0 +24,0 @@ .to.equal(Object.keys(Gathered[ById]).length);

@@ -5,4 +5,2 @@ import {expect} from 'chai';

const testOne = require('./packages/one');
it('can create an empty instance', () => {

@@ -17,16 +15,1 @@ const flecks = new Flecks();

});
it('can gather config', async () => {
let flecks;
flecks = await Flecks.from({
flecks: {'@flecks/core/one': testOne},
});
expect(flecks.get(['@flecks/core/one']))
.to.contain({foo: 'bar'});
flecks = await Flecks.from({
config: {'@flecks/core/one': {foo: 'baz'}},
flecks: {'@flecks/core/one': testOne},
});
expect(flecks.get(['@flecks/core/one']))
.to.contain({foo: 'baz'});
});

@@ -10,36 +10,104 @@ import chai from 'chai';

const testOne = require('./packages/one');
const testTwo = require('./packages/two');
let flecks;
beforeEach(async () => {
flecks = await Flecks.from({
flecks: {
'@flecks/core/one': testOne,
'@flecks/core/two': testTwo,
const flecks = await Flecks.from({
config: {
one: {
'invoke-composed': ['one', 'three', 'two', 'four'],
'invoke-composed-async': ['one', 'three', 'two', 'four'],
'invoke-sequential': ['one', 'three', 'two', 'four'],
'invoke-sequential-async': ['one', 'three', 'two', 'four'],
middleware: ['one', 'three', 'two', 'four'],
},
});
},
flecks: {
one: {
hooks: {
'one.invoke': () => 1,
'one.invoke-async': async () => 1,
'one.invoke-composed': (v) => v + 1,
'one.invoke-composed-async': async (v) => v + 1,
'one.invoke-flat': () => 1,
'one.invoke-merge': () => ({foo: 1}),
'one.invoke-merge-async': async () => ({foo: 1}),
'one.invoke-merge-unique': () => ({foo: 1}),
'one.invoke-merge-unique-async': async () => ({foo: 1}),
'one.invoke-reduce': () => ({foo: 1}),
'one.invoke-reduce-async': async () => ({foo: 1}),
'one.invoke-sequential': () => 1,
'one.invoke-sequential-async': async () => 1,
'one.middleware': () => (foo, next) => {
foo.bar += 1;
next();
},
},
},
two: {
hooks: {
'one.invoke': () => 2,
'one.invoke-async': async () => 2,
'one.invoke-composed': (v) => v * 4,
'one.invoke-composed-async': async (v) => v * 4,
'one.invoke-flat': () => 2,
'one.invoke-merge': () => ({bar: 2}),
'one.invoke-merge-async': async () => ({bar: 2}),
'one.invoke-merge-unique': () => ({foo: 1}),
'one.invoke-merge-unique-async': async () => ({foo: 1}),
'one.invoke-reduce': () => ({foo: 2}),
'one.invoke-reduce-async': async () => ({foo: 2}),
'one.invoke-sequential': () => 2,
'one.invoke-sequential-async': async () => 2,
'one.middleware': () => (foo, next) => {
foo.bar *= 4;
next();
},
},
},
three: {
hooks: {
'one.invoke-composed': (v) => v - 2,
'one.invoke-composed-async': async (v) => v - 2,
'one.invoke-sequential': () => 3,
'one.invoke-sequential-async': async () => 3,
'one.middleware': () => (foo, next) => {
foo.bar -= 2;
next();
},
},
},
four: {
hooks: {
'one.invoke-composed': (v) => v / 2,
'one.invoke-composed-async': async (v) => v / 2,
'one.invoke-sequential': () => 4,
'one.invoke-sequential-async': async () => 4,
'one.middleware': () => (foo, next) => {
foo.bar /= 2;
next();
},
},
},
},
});
it('can invoke', () => {
expect(flecks.invoke('@flecks/core/test/invoke'))
.to.deep.equal({
'@flecks/core/one': 69,
'@flecks/core/two': 420,
});
expect(flecks.invoke('one.invoke'))
.to.deep.equal({one: 1, two: 2});
});
it('can invoke flat', () => {
expect(flecks.invokeFlat('one.invoke-flat'))
.to.deep.equal(Object.values(flecks.invoke('one.invoke')));
});
it('can invoke merge', () => {
expect(flecks.invokeMerge('@flecks/core/test/invoke-merge'))
.to.deep.equal({foo: 69, bar: 420});
expect(flecks.invokeMerge('one.invoke-merge'))
.to.deep.equal({foo: 1, bar: 2});
});
it('can invoke merge async', async () => {
expect(await flecks.invokeMergeAsync('@flecks/core/test/invoke-merge-async'))
.to.deep.equal({foo: 69, bar: 420});
expect(await flecks.invokeMergeAsync('one.invoke-merge-async'))
.to.deep.equal({foo: 1, bar: 2});
});
it('can enforce uniqueness', () => {
expect(() => flecks.invokeMergeUnique('@flecks/core/test/invoke-merge-unique'))
expect(() => flecks.invokeMergeUnique('one.invoke-merge-unique'))
.to.throw(ReferenceError);

@@ -49,4 +117,45 @@ });

it('can enforce uniqueness async', async () => {
expect(flecks.invokeMergeUniqueAsync('@flecks/core/test/invoke-merge-unique-async'))
expect(flecks.invokeMergeUniqueAsync('one.invoke-merge-unique-async'))
.to.be.rejectedWith(ReferenceError);
});
it('can invoke reduce', () => {
expect(flecks.invokeReduce('one.invoke-reduce', (r, v) => ({...r, ...v}), {}))
.to.deep.equal({foo: 2});
});
it('can invoke reduce async', async () => {
expect(await flecks.invokeReduceAsync('one.invoke-reduce-async', (r, v) => ({...r, ...v}), {}))
.to.deep.equal({foo: 2});
});
it('can invoke sequential', () => {
expect(flecks.invokeSequential('one.invoke-sequential'))
.to.deep.equal([1, 3, 2, 4]);
});
it('can invoke sequential async', async () => {
expect(await flecks.invokeSequentialAsync('one.invoke-sequential-async'))
.to.deep.equal([1, 3, 2, 4]);
});
it('can invoke composed', () => {
expect(flecks.invokeComposed('one.invoke-composed', 10))
.to.equal(18);
});
it('can invoke composed async', async () => {
expect(await flecks.invokeComposedAsync('one.invoke-composed-async', 10))
.to.equal(18);
});
it('can make middleware', async () => {
const foo = {bar: 10};
const mw = flecks.makeMiddleware('one.middleware');
await new Promise((resolve, reject) => {
mw(foo, (error) => {
error ? reject(error) : resolve();
});
});
expect(foo.bar).to.equal(18);
});

@@ -0,5 +1,6 @@

/* eslint-disable camelcase */
import {join} from 'path';
import {expect} from 'chai';
import clearModule from 'clear-module';

@@ -24,6 +25,2 @@ import resolve from '@flecks/core/build/resolve';

clear();
clearModule(join(root, 'blah'));
expect(__non_webpack_require__(join(root, 'blah')))
.to.equal(3);
clearModule(join(root, 'blah'));
});

@@ -38,12 +35,5 @@

}, []);
expect(__non_webpack_require__(join(root, 'blah')))
.to.equal(3);
expect(__non_webpack_require__(join(root, 'boo')))
.to.equal(2);
clear();
clearModule(join(root, 'blah'));
clearModule(join(root, 'boo'));
expect(__non_webpack_require__(join(root, 'boo')))
.to.equal(1);
clearModule(join(root, 'boo'));
});

@@ -58,8 +48,5 @@

}, []);
expect(__non_webpack_require__(join(root, 'boo')))
expect(__non_webpack_require__(join(root, 'moo')))
.to.be.undefined;
clear();
clearModule(join(root, 'boo'));
expect(__non_webpack_require__(join(root, 'boo')))
.to.equal(1);
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc