@makoojs/cli 0.3.0 → 0.3.2

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/index.cjs CHANGED
@@ -68,7 +68,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
68
68
  `)}var Qs=e=>`{${Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>`${JSON.stringify(e)}:${$s(t)}`).join(`,`)}}`,$s=e=>typeof e==`function`?`(${e.toString()})`:Array.isArray(e)?`[${e.map(e=>$s(e)).join(`,`)}]`:e&&typeof e==`object`?Qs(e):JSON.stringify(e);function ec(e,t){let n=`makoo`,{hooks:r,...i}=t,a=e.map(e=>`create${e}Adapter()`);return{code:[`${n} = createMakoo({\n ${[`defaults: ${$s(i)}`,a.length>0?`adapters: [${a.join(`, `)}]`:null,r?`hooks: ${$s(r)}`:null].filter(Boolean).join(`,
69
69
  `)}\n});`,`const ${n}Tasks = [];`].join(`
70
70
  `),instanceName:n}}var tc=()=>[`const matchUrl = (url, match) => {`,` if (!match) return true;`,` const matches = (patterns) => {`,` if (!patterns) return false;`," const escape = (value) => value.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&');"," return patterns.some((pattern) => new RegExp(`^${pattern.split('*').map(escape).join('.*')}$`).test(url));",` };`,` const included = match.include ? matches(match.include) : true;`,` if (!included) return false;`,` if (match.exclude && matches(match.exclude)) return false;`,` return true;`,`};`].join(`
71
- `);function nc(e,t){let n=t.some(e=>e.componentMeta.match),r=t.map(t=>{let n=rc({alive:t.componentMeta.alive,scope:t.componentMeta.scope,timeout:t.componentMeta.timeout,hooks:t.componentMeta.hooks},t.componentMeta.on),r=`${e}Tasks.push(inject(${JSON.stringify(t.componentMeta.injectAt)}, ${t.componentName}, ${n}));`;return t.componentMeta.match?[`if (matchUrl(location.href, ${$s(t.componentMeta.match)})) {`,` ${r}`,`}`].join(`
71
+ `);function nc(e,t){let n=t.some(e=>e.componentMeta.match),r=t.map(t=>{let n=rc({alive:t.componentMeta.alive,scope:t.componentMeta.scope,timeout:t.componentMeta.timeout,hooks:t.componentMeta.hooks},t.componentMeta.on),r=`${e}Tasks.push(inject({${[`"id":${JSON.stringify(t.componentMeta.moduleId)}`,`"injectAt":${JSON.stringify(t.componentMeta.injectAt)}`,`"artifact":${t.componentName}`,`"options":${n}`].join(`,`)}}));`;return t.componentMeta.match?[`if (matchUrl(location.href, ${$s(t.componentMeta.match)})) {`,` ${r}`,`}`].join(`
72
72
  `):r});return{code:[n?tc():null,r.join(`
73
73
  `)].filter(Boolean).join(`
74
74
  `),instanceName:e}}function rc(e,t){let n=Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>`${JSON.stringify(e)}:${$s(t)}`);if(t){let e=t.activitySignal?`, { "activitySignal":${$s(t.activitySignal)} }`:``;n.push(`"on":listen(${JSON.stringify(t.listenAt)}, ${JSON.stringify(t.type)}, ${$s(t.callback)}${e})`)}return`{${n.join(`,`)}}`}function ic(e){return`${e}.start(${e}Tasks)`}function ac(e){let t=Zs(e.config.runtime.setup),n=Js(e.injections),r=Ws(e.injections),i=ec(e.frameworks,e.injectionDefaults),a=nc(i.instanceName,n.component),o=[t,n.code,Ys(),r.code].filter(Boolean).join(`
package/dist/index.js CHANGED
@@ -4984,7 +4984,12 @@ function gc(e, t) {
4984
4984
  scope: t.componentMeta.scope,
4985
4985
  timeout: t.componentMeta.timeout,
4986
4986
  hooks: t.componentMeta.hooks
4987
- }, t.componentMeta.on), r = `${e}Tasks.push(inject(${JSON.stringify(t.componentMeta.injectAt)}, ${t.componentName}, ${n}));`;
4987
+ }, t.componentMeta.on), r = `${e}Tasks.push(inject({${[
4988
+ `"id":${JSON.stringify(t.componentMeta.moduleId)}`,
4989
+ `"injectAt":${JSON.stringify(t.componentMeta.injectAt)}`,
4990
+ `"artifact":${t.componentName}`,
4991
+ `"options":${n}`
4992
+ ].join(",")}}));`;
4988
4993
  return t.componentMeta.match ? [
4989
4994
  `if (matchUrl(location.href, ${pc(t.componentMeta.match)})) {`,
4990
4995
  ` ${r}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makoojs/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "CLI and Vite integration for the Makoo userscript development framework",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -41,14 +41,15 @@
41
41
  "jiti": "^2.6.1",
42
42
  "picomatch": "^4.0.4",
43
43
  "vite-plugin-monkey": "^7.1.9",
44
- "zod": "^4.4.3",
45
- "@makoojs/core": "0.2.0"
44
+ "zod": "^4.4.3"
46
45
  },
47
46
  "devDependencies": {
48
47
  "@types/picomatch": "^4.0.3",
49
- "cac": "^7.0.0"
48
+ "cac": "^7.0.0",
49
+ "@makoojs/core": "0.2.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "vite": ">=7"
52
+ "vite": ">=7",
53
+ "@makoojs/core": "^0.2.1"
53
54
  }
54
55
  }