@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
|
|
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
|
|
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;
|
package/lib/loader/solid.cjs
CHANGED
|
@@ -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
|
|
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
|
+
"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.
|
|
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",
|
package/typings/global.d.ts
CHANGED
|
@@ -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` 参数指定了私钥和证书文件的位置。
|