@moneko/core 3.55.2-beta.0 → 3.55.2-beta.1

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return s}});const e=require("node:path"),t=require("node:worker_threads");function s(s){let r,o=this.getOptions();if(r="annotation"===o.compilationMode?s.includes("use memo")||s.includes("use forget"):s.includes("react")||this.resourcePath.endsWith(".tsx")||this.resourcePath.endsWith(".jsx"),this.resourcePath.endsWith(".d.ts")||!r)return s;this.cacheable&&this.cacheable();let i=this.async(),n=new t.Worker((0,e.join)(__dirname,"../worker/react-compiler.mjs"));n.postMessage({sourceCode:s,resourcePath:this.resourcePath,options:o}),n.once("message",e=>{i(...e),n.terminate()})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return s}});const e=require("node:path"),t=new(require("node:worker_threads")).Worker((0,e.join)(__dirname,"../worker/react-compiler.mjs"));function s(e){let s,r=this.async(),o=this.resourcePath,i=this.getOptions();this.cacheable&&this.cacheable(),this._compiler?.hooks.done.tap("react-compiler-loader",()=>{t.terminate()}),s="annotation"===i.compilationMode?e.includes("use memo")||e.includes("use forget"):e.includes("react")||this.resourcePath.endsWith(".tsx")||this.resourcePath.endsWith(".jsx"),this.resourcePath.endsWith(".d.ts")||!s?r(null,e):(t.postMessage({sourceCode:e,resourcePath:o,options:i}),t.once("message",e=>{o===e[0]&&r(e[1],e[2],e[3])}))}t.setMaxListeners(0);
@@ -23,4 +23,4 @@ export interface ReactCompilerOption extends PluginOptions {
23
23
  */
24
24
  compilationMode: 'annotation' | 'infer' | 'syntax' | 'all';
25
25
  }
26
- export default function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string): string | undefined;
26
+ export default function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string): void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=exports,t={get custom(){return s},get default(){return c}};for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,r).get});const n=require("@moneko/convert/solid");async function o(e,t){this.cacheable&&this.cacheable();let r=this.async(),o=this.getOptions();(0,n.transformSolidJs)(e,{...o,filename:this.resourcePath,inputSourceMap:t}).then(n=>{null===n?r(Error(`Failed to transform "${this.resourcePath}"`),e):r(null,n.code??e,n.map||t)}).catch(n=>{r(n,e,t)})}function s(e,t){return o.bind(this,e,t)}const c=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=exports,t={get custom(){return i},get default(){return a}};for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,r).get});const s=require("node:path"),o=new(require("node:worker_threads")).Worker((0,s.join)(__dirname,"../worker/solid.mjs"));async function n(e,t){this.cacheable&&this.cacheable(),this._compiler?.hooks.done.tap("solid-loader",()=>{o.terminate()});let r=this.async(),s=this.getOptions(),n=this.resourcePath;o.postMessage({...s,sourceCode:e,filename:n,inputSourceMap:t}),o.on("message",e=>{n===e[0]&&r(e[1],e[2],e[3])})}function i(e,t){return n.bind(this,e,t)}o.setMaxListeners(0);const a=n;
@@ -1 +1 @@
1
- import{fileURLToPath as t}from"node:url";import e from"webpack";import{Worker as s}from"worker_threads";class o extends e.WebpackError{constructor(t){super(`[ESLint] ${t}`),this.name="ESLintError",this.stack=""}}export class ESLintPlugin{constructor(e={files:[]}){this.name="ESLintPlugin",this.options=e,this.worker=new s(t(new URL("../worker/eslint.mjs",import.meta.url)))}apply(t){t.hooks.thisCompilation.tap(this.name,e=>{let s=t.modifiedFiles||new Set;e.hooks.finishModules.tap(this.name,t=>{let o=this.options;if(this.options?.lintDirtyModulesOnly){let e=[];for(let o of t){let t=o.resource;s.has(t)&&e.push(t)}o.files=e}this.worker.postMessage({options:o}),this.worker.once("message",t=>{this.report(e,t)})})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,e){e?.length&&t&&(e[0]?.length&&t.warnings.push(new o(e[0])),e[1]?.length&&t.errors.push(new o(e[1])))}}
1
+ import{fileURLToPath as t}from"node:url";import{Worker as e}from"node:worker_threads";import s from"webpack";class o extends s.WebpackError{constructor(t){super(`[ESLint] ${t}`),this.name="ESLintError",this.stack=""}}export class ESLintPlugin{constructor(s={files:[]}){this.name="ESLintPlugin",this.options=s,this.worker=new e(t(new URL("../worker/eslint.mjs",import.meta.url))),this.worker.setMaxListeners(0)}apply(t){t.hooks.thisCompilation.tap(this.name,e=>{let s=t.modifiedFiles||new Set;e.hooks.finishModules.tap(this.name,t=>{let o=this.options;if(this.options?.lintDirtyModulesOnly){let e=[];for(let o of t){let t=o.resource;s.has(t)&&e.push(t)}o.files=e}this.worker.postMessage({options:o}),this.worker.once("message",t=>{this.report(e,t)})})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,e){e?.length&&t&&(e[0]?.length&&t.warnings.push(new o(e[0])),e[1]?.length&&t.errors.push(new o(e[1])))}}
@@ -1 +1 @@
1
- import{join as e,parse as t,resolve as o}from"node:path";import{fileURLToPath as s}from"node:url";import{loadFile as i}from"@moneko/utils";import r from"webpack";import{Worker as a}from"worker_threads";import n from"../utils/create-types.mjs";let m="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(e){this.name="ModuleFederationExposesDeclarationPlugin",this.assetName="module-federation.d.ts",this.dts="",this.option=e,this.worker=new a(s(new URL("../worker/dts.mjs",import.meta.url))),this.worker.postMessage({options:{compilerOptions:{outFile:this.assetName},include:Object.values(e.exposes)}}),this.worker.once("message",e=>{this.dts=e,this.worker.terminate()})}apply(s){let{exposes:a}=this.option,p=Object.keys(a).map(e=>{let t=e.replace(/\.tsx?$/i,"");return{key:e,name:t,path:o(`types/${this.option.name}/${t}.d.ts`),originPath:a[e]}});s.hooks.thisCompilation.tap({name:m,stage:s.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},o=>{o.hooks.processAssets.tapPromise(m,async()=>{let s=p.map(async o=>{if(null!==await i(o.originPath)){let s=t(o.originPath);return`${n(e(this.option.name,o.name),`export * from '${t(s.dir).name}/${s.name}'`)}`}return""}),a=await Promise.all(s);a.unshift(this.dts),o.emitAsset("module-federation.d.ts",new r.sources.RawSource(a.join("\n")),{javascriptModule:!1})})})}}
1
+ import{join as e,parse as t,resolve as o}from"node:path";import{fileURLToPath as s}from"node:url";import{Worker as i}from"node:worker_threads";import{loadFile as r}from"@moneko/utils";import a from"webpack";import n from"../utils/create-types.mjs";let m="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(e){this.name="ModuleFederationExposesDeclarationPlugin",this.assetName="module-federation.d.ts",this.dts="",this.option=e,this.worker=new i(s(new URL("../worker/dts.mjs",import.meta.url))),this.worker.setMaxListeners(0),this.worker.postMessage({options:{compilerOptions:{outFile:this.assetName},include:Object.values(e.exposes)}}),this.worker.once("message",e=>{this.dts=e,this.worker.terminate()})}apply(s){let{exposes:i}=this.option,p=Object.keys(i).map(e=>{let t=e.replace(/\.tsx?$/i,"");return{key:e,name:t,path:o(`types/${this.option.name}/${t}.d.ts`),originPath:i[e]}});s.hooks.thisCompilation.tap({name:m,stage:s.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},o=>{o.hooks.processAssets.tapPromise(m,async()=>{let s=p.map(async o=>{if(null!==await r(o.originPath)){let s=t(o.originPath);return`${n(e(this.option.name,o.name),`export * from '${t(s.dir).name}/${s.name}'`)}`}return""}),i=await Promise.all(s);i.unshift(this.dts),o.emitAsset("module-federation.d.ts",new a.sources.RawSource(i.join("\n")),{javascriptModule:!1})})})}}
@@ -1 +1 @@
1
- import{fileURLToPath as t}from"node:url";import r from"webpack";import{Worker as e}from"worker_threads";class s extends r.WebpackError{constructor(t){super(`[Stylelint] ${t}`),this.name="StylelintError",this.stack=""}}export class StylelintPlugin{constructor(r={files:[]}){this.name="StylelintPlugin",this.options=r,this.worker=new e(t(new URL("../worker/stylelint.mjs",import.meta.url)))}apply(t){t.hooks.thisCompilation.tap(this.name,t=>{this.worker.postMessage({options:this.options}),this.worker.once("message",r=>{this.report(r,t)})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,r){t?.length&&r&&(t[0]?.length&&r.warnings.push(new s(t[0])),t[1]?.length&&r.errors.push(new s(t[1])))}}
1
+ import{fileURLToPath as t}from"node:url";import{Worker as e}from"node:worker_threads";import r from"webpack";class s extends r.WebpackError{constructor(t){super(`[Stylelint] ${t}`),this.name="StylelintError",this.stack=""}}export class StylelintPlugin{constructor(r={files:[]}){this.name="StylelintPlugin",this.options=r,this.worker=new e(t(new URL("../worker/stylelint.mjs",import.meta.url))),this.worker.setMaxListeners(0)}apply(t){t.hooks.thisCompilation.tap(this.name,t=>{this.worker.postMessage({options:this.options}),this.worker.once("message",e=>{this.report(e,t)})}),t.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()})}report(t,e){t?.length&&e&&(t[0]?.length&&e.warnings.push(new s(t[0])),t[1]?.length&&e.errors.push(new s(t[1])))}}
@@ -1 +1 @@
1
- import{parentPort as r}from"worker_threads";import{compileDts as s}from"../utils/compile-dts.mjs";if(!r)throw Error("This file must be run as a worker");r.on("message",async({options:e})=>{let o=s(e);r.postMessage(o)});
1
+ import{parentPort as s}from"node:worker_threads";import{compileDts as e}from"../utils/compile-dts.mjs";if(!s)throw Error("This file must be run as a worker");s?.setMaxListeners(0),s.on("message",async({options:r})=>{let o=e(r);s.postMessage(o)});
@@ -1 +1 @@
1
- let e,t;import{relative as a}from"node:path";import{ESLint as r}from"@moneko/eslint";import{parentPort as o}from"worker_threads";import i from"../commom/paths.mjs";if(!o)throw Error("This file must be run as a worker");let s=null;o.on("message",async({options:c})=>{s&&clearTimeout(s),s=setTimeout(async()=>{s&&(clearTimeout(s),s=null);try{e||(e=new r({cache:c.cache,cacheLocation:c.cacheLocation,cacheStrategy:c.cacheStrategy,fix:c.fix}),t=await e.loadFormatter("stylish"));let s=c.files.map(e=>(c.lintDirtyModulesOnly?a(i.programPath,e):e).replace(/\\/g,"/")),l=await e.lintFiles(s),m=[],n=[];c.fix&&await r.outputFixes(l),l.forEach(e=>{e.errorCount?n.push(e):e.warningCount&&m.push(e)});let h=await Promise.all([t.format(m),t.format(n)]);o.postMessage(h.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch(e){o.postMessage(e)}},2)}),o.on("close",()=>{s&&clearTimeout(s)});
1
+ let e,t;import{relative as a}from"node:path";import{parentPort as r}from"node:worker_threads";import{ESLint as o}from"@moneko/eslint";import i from"../commom/paths.mjs";if(!r)throw Error("This file must be run as a worker");let s=null;r?.setMaxListeners(0),r.on("message",async({options:c})=>{s&&clearTimeout(s),s=setTimeout(async()=>{s&&(clearTimeout(s),s=null);try{e||(e=new o({cache:c.cache,cacheLocation:c.cacheLocation,cacheStrategy:c.cacheStrategy,fix:c.fix}),t=await e.loadFormatter("stylish"));let s=c.files.map(e=>(c.lintDirtyModulesOnly?a(i.programPath,e):e).replace(/\\/g,"/")),l=await e.lintFiles(s),m=[],n=[];c.fix&&await o.outputFixes(l),l.forEach(e=>{e.errorCount?n.push(e):e.warningCount&&m.push(e)});let h=await Promise.all([t.format(m),t.format(n)]);r.postMessage(h.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch(e){r.postMessage(e)}},2)}),r.on("close",()=>{s&&clearTimeout(s)});
@@ -1 +1 @@
1
- import{parentPort as e}from"node:worker_threads";import{runBabelPluginReactCompiler as o}from"@moneko/eslint/react-compiler";e?.on("message",({sourceCode:r,resourcePath:t,options:m})=>{let s=o(r,t,"typescript",m);e?.postMessage([null,s.code??r,s.map??void 0])});
1
+ import{parentPort as e}from"node:worker_threads";import{runBabelPluginReactCompiler as o}from"@moneko/eslint/react-compiler";e?.setMaxListeners(0),e?.on("message",({sourceCode:r,resourcePath:s,options:t})=>{let m=o(r,s,"typescript",t);e?.postMessage([s,null,m.code??r,m.map??void 0])});
@@ -1 +1 @@
1
- import{parentPort as e}from"node:worker_threads";import{transformSolidJs as o}from"@moneko/convert/solid";e?.on("message",({sourceCode:s,filename:r,inputSourceMap:t,...a})=>{o(s,{...a,filename:r?.endsWith("sx")?r:`${r}x`,inputSourceMap:t}).then(o=>{null===o?e?.postMessage([Error(`Failed to transform "${r}"`),s,t]):e?.postMessage([null,o.code??s,o.map??t])}).catch(o=>{e?.postMessage([o,s,t])})});
1
+ import{parentPort as e}from"node:worker_threads";import{transformSolidJs as o}from"@moneko/convert/solid";e?.setMaxListeners(0),e?.on("message",({sourceCode:s,filename:r,inputSourceMap:t,...a})=>{o(s,{...a,filename:r,inputSourceMap:t}).then(o=>{null===o?e?.postMessage([r,Error(`Failed to transform "${r}"`),s,t]):e?.postMessage([r,null,o.code??s,o.map??t])}).catch(o=>{e?.postMessage([r,o,s,t])})});
@@ -1 +1 @@
1
- import{stylelint as e}from"@moneko/stylelint";import{parentPort as r}from"worker_threads";if(!r)throw Error("This file must be run as a worker");let t=null,a=await e.formatters.string;r.on("message",async({options:i})=>{t&&clearTimeout(t),t=setTimeout(async()=>{t&&(clearTimeout(t),t=null);try{let t=await e.lint({cache:i.cache,cacheLocation:i.cacheLocation,fix:i.fix,files:i.files.map(e=>e.replace(/\\/g,"/")),quietDeprecationWarnings:i.quietDeprecationWarnings,quiet:i.quiet});delete t.output;let n=[],s=[];t.results.forEach(e=>{if(!e.ignored&&(e.errored||e.parseErrors.length||e.invalidOptionWarnings.length||e.deprecations.length)){let r=[],t=[];e.warnings.forEach(e=>{"error"===e.severity?r.push(e):"warning"===e.severity&&t.push(e)}),r.length>0&&n.push({...e,warnings:r}),t.length>0&&s.push({...e,warnings:t})}});let o=[a(s,t),a(n,t)];r.postMessage(o.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch(e){r.postMessage(e)}},4)}),r.on("close",()=>{t&&clearTimeout(t)});
1
+ import{parentPort as e}from"node:worker_threads";import{stylelint as r}from"@moneko/stylelint";if(!e)throw Error("This file must be run as a worker");let t=null,a=await r.formatters.string;e?.setMaxListeners(0),e.on("message",async({options:i})=>{t&&clearTimeout(t),t=setTimeout(async()=>{t&&(clearTimeout(t),t=null);try{let t=await r.lint({cache:i.cache,cacheLocation:i.cacheLocation,fix:i.fix,files:i.files.map(e=>e.replace(/\\/g,"/")),quietDeprecationWarnings:i.quietDeprecationWarnings,quiet:i.quiet});delete t.output;let n=[],s=[];t.results.forEach(e=>{if(!e.ignored&&(e.errored||e.parseErrors.length||e.invalidOptionWarnings.length||e.deprecations.length)){let r=[],t=[];e.warnings.forEach(e=>{"error"===e.severity?r.push(e):"warning"===e.severity&&t.push(e)}),r.length>0&&n.push({...e,warnings:r}),t.length>0&&s.push({...e,warnings:t})}});let o=[a(s,t),a(n,t)];e.postMessage(o.map(e=>e.replace(/[^\r\n]*(\r?\n)*$/,"")))}catch(r){e.postMessage(r)}},4)}),e.on("close",()=>{t&&clearTimeout(t)});
@@ -1 +1 @@
1
- import{minify as r}from"@swc/core";import{parentPort as e}from"worker_threads";if(!e)throw Error("This file must be run as a worker");e.on("message",async({buffer:o,options:s})=>{let{code:t}=await r(Buffer.from(o).toString().replace(/\r\n/g,"\n"),s);e.postMessage(t)});
1
+ import{parentPort as r}from"node:worker_threads";import{minify as e}from"@swc/core";if(!r)throw Error("This file must be run as a worker");r?.setMaxListeners(0),r.on("message",async({buffer:o,options:s})=>{let{code:t}=await e(Buffer.from(o).toString().replace(/\r\n/g,"\n"),s);r.postMessage(t)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.55.2-beta.0",
3
+ "version": "3.55.2-beta.1",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",