@moneko/core 3.55.3 → 3.55.4

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.
@@ -0,0 +1 @@
1
+ import{parse as e,print as t}from"@swc/core";import{compile as r}from"stylis";import n from"./log.mjs";function a(e){return{type:"iTemplateElement",span:{start:0,end:0,ctxt:0},tail:!1,cooked:e,raw:e}}function i(e,t){if("Identifier"===e.tag.type&&t.includes(e.tag.value)){let t=e.template,n=function e(t){return t.map(t=>{switch(t.type){case"import":case"decl":return t.value;case"comm":return"/"===t.props&&t.value.includes("@")?t.value:"";case"rule":return`${t.value.replace(/&\f/g,"&")}{${e(t.children)}}`;default:return`${t.value}{${e(t.children)}}`}}).join("")}(function e(t,r){for(let n=0;n<t.length;n++){let a=t[n],i=a.parent,l=a.children;i?!function(e){var t;return"rule"===e.type&&e.parent&&(t=e.parent,e.line===t.line&&e.column===t.column)}(a)&&i.children.push(a):r.push(a),Array.isArray(l)&&(a.children=[],e(l,r))}return r}(r(function(e){let t=e.quasis.map(e=>e.cooked);return t.reduce((e,r,n)=>(e.push(r),n!==t.length-1&&e.push(`xxx${n}:xxx`),e),[]).join("").trim()}(t)),[])),i=function(e,t){let r=function(e){let t,r=/xxx(\d+):xxx/gm,n=[];for(;null!==(t=r.exec(e));)n.push({value:t[0],p1:parseInt(t[1],10),index:t.index});return n}(e);if(0===r.length)return""===e?[]:[a(e)];let n=[],i=[],l=0;return r.forEach(({value:s,p1:p,index:o},u)=>{let c=e.substring(l,o);l=l+c.length+s.length,c||0!==u?n.push(a(c)):n.push(a("")),i.push(t[p]),u===r.length-1&&n.push(a(e.substring(o+s.length)))}),i.reduce((e,t,r)=>e.concat([t],n[r+1]),[n[0]]).filter(e=>""!==e.raw)}(n,t.expressions);if(n.length>1){let e=[],r=[];i.forEach((t,n)=>{"iTemplateElement"===t.type?e.push({...t,type:"TemplateElement",tail:n===i.length-1}):r.push(t)}),t.quasis=e,t.expressions=r}}}export async function cssInJsMinify(r,a){let{moduleName:l,allowFuncs:s}=a||{};try{let n=await e(r,{syntax:"ecmascript"}),a=[];return n.body.forEach(e=>{"ImportDeclaration"===e.type&&e.source.value===l&&e.specifiers.forEach(e=>{"ImportSpecifier"===e.type&&(e.imported&&s.includes(e.imported.value)?a.push(e.local.value):s.includes(e.local.value)&&a.push(e.local.value))})}),n.body.forEach(e=>{if("ExportDeclaration"===e.type||"ExpressionStatement"===e.type){let t="declaration"in e?e.declaration:e.expression;t&&"CallExpression"===t.type&&t.arguments.forEach(e=>{e.expression&&"TaggedTemplateExpression"===e.expression.type&&i(e.expression,a)}),t&&"VariableDeclaration"===t.type&&t.declarations.forEach(e=>{e.init?.type==="TaggedTemplateExpression"&&i(e.init,a)})}else"CallExpression"===e.type&&e.arguments.forEach(e=>{e.expression&&"TaggedTemplateExpression"===e.expression.type&&i(e.expression,a)})}),await t(n)}catch(e){return n(e),{code:r,map:void 0}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return l}});const e=require("@swc/core"),t=require("stylis");function r(e){return{type:"iTemplateElement",span:{start:0,end:0,ctxt:0},tail:!1,cooked:e,raw:e}}function n(e,n){if("Identifier"===e.tag.type&&n.includes(e.tag.value)){let n=e.template,l=function(e){let t=e.quasis.map(e=>e.cooked);return t.reduce((e,r,n)=>(e.push(r),n!==t.length-1&&e.push(`xxx${n}:xxx`),e),[]).join("").trim()}(n),a=function e(t){return t.map(t=>{switch(t.type){case"import":case"decl":return t.value;case"comm":return"/"===t.props&&t.value.includes("@")?t.value:"";case"rule":return`${t.value.replace(/&\f/g,"&")}{${e(t.children)}}`;default:return`${t.value}{${e(t.children)}}`}}).join("")}(function e(t,r){for(let n=0;n<t.length;n++){let l=t[n],a=l.parent,i=l.children;a?!function(e){var t;return"rule"===e.type&&e.parent&&(t=e.parent,e.line===t.line&&e.column===t.column)}(l)&&a.children.push(l):r.push(l),Array.isArray(i)&&(l.children=[],e(i,r))}return r}((0,t.compile)(l),[])),i=function(e,t){let n=function(e){let t,r=/xxx(\d+):xxx/gm,n=[];for(;null!==(t=r.exec(e));)n.push({value:t[0],p1:parseInt(t[1],10),index:t.index});return n}(e);if(0===n.length)return""===e?[]:[r(e)];let l=[],a=[],i=0;return n.forEach(({value:s,p1:p,index:u},c)=>{let o=e.substring(i,u);i=i+o.length+s.length,o||0!==c?l.push(r(o)):l.push(r("")),a.push(t[p]),c===n.length-1&&l.push(r(e.substring(u+s.length)))}),a.reduce((e,t,r)=>e.concat([t],l[r+1]),[l[0]]).filter(e=>""!==e.raw)}(a,n.expressions);if(a.length>1){let e=[],t=[];i.forEach((r,n)=>{"iTemplateElement"===r.type?e.push({...r,type:"TemplateElement",tail:n===i.length-1}):t.push(r)}),n.quasis=e,n.expressions=t}}}async function l(t){let r=this.async(),{moduleName:l,allowFuncs:a}=this.getOptions()||{};this.cacheable&&this.cacheable();try{let i=await (0,e.parse)(t,{syntax:"ecmascript"}),s=[];i.body.forEach(e=>{"ImportDeclaration"===e.type&&e.source.value===l&&e.specifiers.forEach(e=>{"ImportSpecifier"===e.type&&(e.imported&&a.includes(e.imported.value)?s.push(e.local.value):a.includes(e.local.value)&&s.push(e.local.value))})}),i.body.forEach(e=>{if("ExportDeclaration"===e.type||"ExpressionStatement"===e.type){let t="declaration"in e?e.declaration:e.expression;t&&"CallExpression"===t.type&&t.arguments.forEach(e=>{e.expression&&"TaggedTemplateExpression"===e.expression.type&&n(e.expression,s)}),t&&"VariableDeclaration"===t.type&&t.declarations.forEach(e=>{e.init?.type==="TaggedTemplateExpression"&&n(e.init,s)})}else"CallExpression"===e.type&&e.arguments.forEach(e=>{e.expression&&"TaggedTemplateExpression"===e.expression.type&&n(e.expression,s)})});let{code:p}=await (0,e.print)(i);r(null,p)}catch(e){r(e)}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t}});const e=require("node:path"),s=new(require("node:worker_threads")).Worker((0,e.join)(__dirname,"../worker/css-in-js-minify.mjs"));async function t(e){this.cacheable&&this.cacheable(),this._compiler?.options.mode!=="development"&&this._compiler?.hooks.done.tap("css-in-js-minify-loader",()=>{s.terminate()});let t=this.async(),i=this.getOptions(),o=this.resourcePath;s.postMessage({options:i,code:e,filename:o}),s.addListener("message",function e(i){o===i[0]&&(t(i[1],i[2]),s.removeListener("message",e))})}s.setMaxListeners(0);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=exports,t={get custom(){return i},get default(){return c}};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/react-compiler.mjs"));function n(e,t){let r=this.resourcePath,s=this.getOptions();if(r.endsWith(".d.ts")||r.endsWith(".json")||!("annotation"===s.compilationMode?e.includes("use memo")||e.includes("use forget"):e.includes("react")||r.endsWith(".tsx")||r.endsWith(".jsx")))return e;let n=this.async();this._compiler?.options.mode!=="development"&&this._compiler?.hooks.done.tap("react-compiler-loader",()=>{o.terminate()}),this.cacheable&&this.cacheable(),o.postMessage({sourceCode:e,filename:r,inputSourceMap:t,options:s}),o.on("message",e=>{r===e[0]&&n(e[1],e[2],e[3])})}function i(e,t){return n.bind(this,e,t)}o.setMaxListeners(0);const c=n;
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/react-compiler.mjs"));function n(e,t){let r=this.resourcePath,s=this.getOptions();if(r.endsWith(".d.ts")||r.endsWith(".json")||!("annotation"===s.compilationMode?e.includes("use memo")||e.includes("use forget"):e.includes("react")||r.endsWith(".tsx")||r.endsWith(".jsx")))return e;let n=this.async();this._compiler?.options.mode!=="development"&&this._compiler?.hooks.done.tap("react-compiler-loader",()=>{o.terminate()}),this.cacheable&&this.cacheable(),o.postMessage({sourceCode:e,filename:r,inputSourceMap:t,options:s}),o.addListener("message",function e(t){r===t[0]&&(n(t[1],t[2],t[3]),o.removeListener("message",e))})}function i(e,t){return n.bind(this,e,t)}o.setMaxListeners(0);const a=n;
@@ -1 +1 @@
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 o=require("node:path"),s=new(require("node:worker_threads")).Worker((0,o.join)(__dirname,"../worker/solid.mjs"));async function n(e,t){this.cacheable&&this.cacheable(),this._compiler?.options.mode!=="development"&&this._compiler?.hooks.done.tap("solid-loader",()=>{s.terminate()});let r=this.async(),o=this.getOptions(),n=this.resourcePath;s.postMessage({...o,sourceCode:e,filename:n,inputSourceMap:t}),s.on("message",e=>{n===e[0]&&r(e[1],e[2],e[3])})}function i(e,t){return n.bind(this,e,t)}s.setMaxListeners(0);const a=n;
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?.options.mode!=="development"&&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.addListener("message",function e(t){n===t[0]&&(r(t[1],t[2],t[3]),o.removeListener("message",e))})}function i(e,t){return n.bind(this,e,t)}o.setMaxListeners(0);const a=n;
@@ -0,0 +1 @@
1
+ import{parentPort as s}from"node:worker_threads";import{cssInJsMinify as e}from"../commom/css-in-js-minify.mjs";s?.setMaxListeners(0),s?.on("message",async({code:o,filename:m,options:r})=>{try{let t=await e(o,r);s?.postMessage([m,null,t?.code??o,t.map])}catch(e){s?.postMessage([m,e,o,void 0])}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.55.3",
3
+ "version": "3.55.4",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -141,7 +141,7 @@
141
141
  "@types/stylis": "4.2.7",
142
142
  "@types/webpack-bundle-analyzer": "4.7.0",
143
143
  "@types/webpack-hot-middleware": "2.25.10",
144
- "sass": "1.93.0",
144
+ "sass": "1.93.1",
145
145
  "sass-loader": "16.0.5",
146
146
  "solid-refresh": "0.7.5",
147
147
  "stylis": "4.3.6",
@@ -14,17 +14,6 @@ import type {
14
14
  SourceMapDevToolPlugin,
15
15
  } from 'webpack';
16
16
 
17
- import type {
18
- CssInJsMinifyOption,
19
- HtmlPluginOption,
20
- JsxDomExpressions,
21
- CompressionPluginOptions,
22
- OptimizationSplitChunksOptions,
23
- OverrideResolverOption,
24
- ProxyConfig,
25
- ReactCompilerOption,
26
- VirtualModulePluginOption,
27
- } from '../lib/index.mjs';
28
17
  import type { CopyPluginOption } from '../lib/plugin/copy.mjs';
29
18
  import type { DonePluginOption } from '../lib/plugin/done.mjs';
30
19
  import type { ManifestPluginOption } from '../lib/plugin/manifest.mjs';
@@ -32,7 +21,16 @@ import type { ManifestPluginOption } from '../lib/plugin/manifest.mjs';
32
21
  import type { BundleAnalyzerOption } from './bundle-analyzer.d.ts';
33
22
  import type { ESLintOption } from '../lib/plugin/eslint.mjs';
34
23
  import type { StylelintOption } from '../lib/plugin/stylelint.mjs';
35
- import type { SwcImportOnDemandTransform } from '../lib/commom/transfer-import-on-demand.mjs'
24
+ import type { SwcImportOnDemandTransform } from '../lib/commom/transfer-import-on-demand.mjs';
25
+ import type { CssInJsMinifyOption } from '../lib/commom/css-in-js-minify.mjs';
26
+ import type { ReactCompilerOption } from '../lib/loader/react-compiler.cjs';
27
+ import type { CompressionPluginOptions } from '../lib/plugin/compression.mjs';
28
+ import type { JsxDomExpressions } from '../lib/options/jsx-dom-expressions.mjs';
29
+ import type { ProxyConfig } from '../lib/dev/proxy.mjs';
30
+ import type { VirtualModulePluginOption } from '../lib/plugin/virtual-module.mjs';
31
+ import type { OverrideResolverOption } from '../lib/plugin/override-resolve.mjs';
32
+ import type { OptimizationSplitChunksOptions } from '../lib/options/split-chunk.mjs';
33
+ import type { HtmlPluginOption } from '../lib/plugin/html-plugin.mjs';
36
34
 
37
35
  export type { MiniCssExtractPluginOptions, SwcMinifyOptions, TerserMinifyOptions };
38
36
  export type MinifierType = 'swc' | 'terser';
@@ -237,6 +235,11 @@ export declare type ConfigType = {
237
235
  /**
238
236
  * 使用 HTTPS 服务器作为开发服务器
239
237
  * @description
238
+ * 如果你是macOS用户, 当启用 https 时, 第一次启动需要通过 `sudo ...` 启动提权以便安装证书;
239
+ * ```bash
240
+ * sudo npm start
241
+ * ```
242
+ * @description
240
243
  * 配置 HTTPS 开发服务器的密钥和证书路径。
241
244
  *
242
245
  * `key` 和 `cert` 参数指定了私钥和证书文件的位置。