@moneko/core 3.27.0 → 3.27.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.
package/lib/loader/a.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const t=require("@swc/core"),i=require("stylis"),a=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e};function r(e,t){let a=!1;return"Identifier"===e.tag.type&&t.includes(e.tag?.value)&&(e.template.quasis.forEach(e=>{let t=(0,i.serialize)((0,i.compile)(e.raw),(0,i.middleware)([i.stringify]));e.raw=t,e.cooked=t}),a=!0),a}function l(e,t){let i=!1;return e.properties.forEach(e=>{"KeyValueProperty"===e.type&&"TaggedTemplateExpression"===e.value.type&&"Identifier"===e.value.tag.type&&t.includes(e.value.tag.value)&&r(e.value,t)&&(i=!0)}),i}async function o(e){let i=this.async(),{moduleName:o="@moneko/css",allowFuncs:n=["css","injectGlobal"]}=this.getOptions()||{};this.cacheable&&this.cacheable();try{let a=!1,s=await (0,t.parse)(e,{syntax:"ecmascript"}),p=[];if(s.body.forEach(e=>{!function e(t){"ImportDeclaration"===t.type&&t.source.value===o&&t.specifiers.forEach(e=>{"ImportSpecifier"===e.type&&(e.imported&&n.includes(e.imported.value)?p.push(e.local.value):n.includes(e.local.value)&&p.push(e.local.value))}),"ObjectExpression"===t.type&&l(t,p)&&(a=!0),"TaggedTemplateExpression"===t.type&&r(t,p)&&(a=!0),"VariableDeclaration"===t.type&&t.declarations.forEach(e=>{let t;t=!1,"VariableDeclarator"===e.type&&("Identifier"===e.id.type&&e.init?.type==="Identifier"&&p.includes(e.init.value)&&p.push(e.id.value),e.init?.type==="TaggedTemplateExpression"?r(e.init,p)&&(t=!0):e.init?.type==="ObjectExpression"&&l(e.init,p)&&(t=!0)),t&&(a=!0)}),"ExpressionStatement"===t.type&&e(t.expression),"ExportDeclaration"===t.type&&e(t.declaration),"ExportDefaultExpression"===t.type&&e(t.expression),"ReturnStatement"===t.type&&t.argument&&e(t.argument),"FunctionDeclaration"===t.type&&t.body&&t.body.stmts.forEach(t=>{e(t)})}(e)}),a){let e=await (0,t.print)(s);i(null,e?.code||void 0,e?.map||void 0)}else i(null,e,void 0)}catch(e){i(e),(0,a.default)(e)}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Expression, type ModuleItem, type ObjectExpression, parse, print, type TaggedTemplateExpression, type VariableDeclarator } from '@swc/core';
|
|
2
|
+
import { compile, middleware, serialize, stringify } from 'stylis';
|
|
3
|
+
import type { LoaderContext } from 'webpack';
|
|
4
|
+
import log from '../commom/log.mjs';
|
|
5
|
+
export interface CssInJsMinifyOption {
|
|
6
|
+
sourceMap?: boolean;
|
|
7
|
+
moduleName?: string;
|
|
8
|
+
allowFuncs?: string[];
|
|
9
|
+
}
|
|
10
|
+
declare function parseTaggedTemplateExpression(declaration: TaggedTemplateExpression, names: string[]);
|
|
11
|
+
declare function parseDeclaration(declaration: VariableDeclarator, names: string[]);
|
|
12
|
+
declare function parseObjectExpression(expression: ObjectExpression, names: string[]);
|
|
13
|
+
export default async function cssInJsMinifyLoader(this: LoaderContext<CssInJsMinifyOption>, sourceCode: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const t=require("@swc/core"),i=require("stylis"),a=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e};function r(e,t){let a=!1;return"Identifier"===e.tag.type&&t.includes(e.tag?.value)&&(e.template.quasis.forEach(e=>{let t=(0,i.serialize)((0,i.compile)(e.raw),(0,i.middleware)([i.stringify]));e.raw=t,e.cooked=t}),a=!0),a}function l(e,t){let i=!1;return e.properties.forEach(e=>{"KeyValueProperty"===e.type&&"TaggedTemplateExpression"===e.value.type&&"Identifier"===e.value.tag.type&&t.includes(e.value.tag.value)&&r(e.value,t)&&(i=!0)}),i}async function o(e){let i=this.async(),{moduleName:o="@moneko/css",allowFuncs:n=["css","injectGlobal"]}=this.getOptions()||{};this.cacheable&&this.cacheable();try{let a=!1,s=await (0,t.parse)(e,{syntax:"ecmascript"}),p=[];if(s.body.forEach(e=>{!function e(t){"ImportDeclaration"===t.type&&t.source.value===o&&t.specifiers.forEach(e=>{"ImportSpecifier"===e.type&&(e.imported&&n.includes(e.imported.value)?p.push(e.local.value):n.includes(e.local.value)&&p.push(e.local.value))}),"ObjectExpression"===t.type&&l(t,p)&&(a=!0),"TaggedTemplateExpression"===t.type&&r(t,p)&&(a=!0),"VariableDeclaration"===t.type&&t.declarations.forEach(e=>{let t;t=!1,"VariableDeclarator"===e.type&&("Identifier"===e.id.type&&e.init?.type==="Identifier"&&p.includes(e.init.value)&&p.push(e.id.value),e.init?.type==="TaggedTemplateExpression"?r(e.init,p)&&(t=!0):e.init?.type==="ObjectExpression"&&l(e.init,p)&&(t=!0)),t&&(a=!0)}),"ExpressionStatement"===t.type&&e(t.expression),"ExportDeclaration"===t.type&&e(t.declaration),"ExportDefaultExpression"===t.type&&e(t.expression),"ReturnStatement"===t.type&&t.argument&&e(t.argument),"FunctionDeclaration"===t.type&&t.body&&t.body.stmts.forEach(t=>{e(t)})}(e)}),a){let e=await (0,t.print)(s);i(null,e?.code||void 0,e?.map||void 0)}else i(null,e,void 0)}catch(e){i(e),(0,a.default)(e)}}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { type Expression, type ModuleItem, type ObjectExpression, parse, print, type TaggedTemplateExpression, type VariableDeclarator } from '@swc/core';
|
|
2
|
+
import { compile, middleware, serialize, stringify } from 'stylis';
|
|
3
3
|
import type { LoaderContext } from 'webpack';
|
|
4
4
|
import log from '../commom/log.mjs';
|
|
5
5
|
export interface CssInJsMinifyOption {
|
|
6
6
|
sourceMap?: boolean;
|
|
7
|
+
moduleName?: string;
|
|
8
|
+
allowFuncs?: string[];
|
|
7
9
|
}
|
|
10
|
+
declare function parseTaggedTemplateExpression(declaration: TaggedTemplateExpression, names: string[]);
|
|
11
|
+
declare function parseDeclaration(declaration: VariableDeclarator, names: string[]);
|
|
12
|
+
declare function parseObjectExpression(expression: ObjectExpression, names: string[]);
|
|
8
13
|
export default async function cssInJsMinifyLoader(this: LoaderContext<CssInJsMinifyOption>, sourceCode: string);
|
package/lib/module.config.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { join, sep } from 'node:path';
|
|
2
2
|
import { saveFileSync } from '@moneko/utils';
|
|
3
3
|
import type { ModuleOptions, PathData, RuleSetRule } from 'webpack';
|
|
4
|
-
import hasPkg from './commom/has-pkg.mjs';
|
|
5
4
|
import paths, { CUSTOMCONFIG } from './commom/paths.mjs';
|
|
6
5
|
import ReactiveObject from './commom/reactive-object.mjs';
|
|
7
6
|
import require from './commom/require.mjs';
|
package/lib/module.config.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
let e;import{join as o,sep as s}from"node:path";import{saveFileSync as t}from"@moneko/utils";import r
|
|
2
|
-
`)}:void 0},importLoaders:2}},
|
|
1
|
+
let e;import{join as o,sep as s}from"node:path";import{saveFileSync as t}from"@moneko/utils";import r,{CUSTOMCONFIG as a}from"./commom/paths.mjs";import m from"./commom/reactive-object.mjs";import n from"./commom/require.mjs";import i from"./commom/rule.mjs";import l from"./options/css-extract.mjs";import c from"./options/modify-vars.mjs";import d from"./options/reslove.mjs";import p from"./options/swcrc.mjs";import{getLightningCssTargets as u}from"./polyfills/targets.mjs";import{node_modules as f,resolveProgram as j,toCamelCase as h}from"./utils/index.mjs";import v from"./utils/svg-to-data-uri.mjs";import{comment as g,getCommentPath as x}from"./vm/docs.mjs";import y from"./vm/generate-doc.mjs";import{CONFIG as w}from"./config.mjs";import{FRAMEWORK as L,isDev as M,isLibrary as P}from"./process-env.mjs";let _={loader:o(r.corePath,"/loader/lightning-css/loader.cjs"),options:{sourceMap:!!w.sourceMap,targets:u(),rem:!!w.rem,esModule:!0,modules:{auto(e){if(e){if(e.endsWith(".css")&&!e.endsWith("module.css"))return!1;for(let o=0,s=I.length;o<s;o++)if(e.includes(I[o]))return i.css_module.test(e)}return i.node_modules_css_module.test(e)},localIdentName:"[name][hash]_[local]",namedExport:!0,exportLocalsConvention:"dashesOnly",exportOnlyLocals:!1,getJSON:w.cssModuleDefinition?function(e){Q.setData(`${e.resourcePath}.d.ts`,`${e.exports.map(({name:e,value:o})=>`export const ${h(e)}: '${o}';`).join("\n")}
|
|
2
|
+
`)}:void 0},importLoaders:2}},k={loader:d.lessLoader,options:{sourceMap:!!w.sourceMap,lessOptions:{modifyVars:c,javascriptEnabled:!0}}},C=new Map;function O(e){if(C.has(e))return C.get(e);try{let o;let t=n.resolve(e).split(s),r=t.lastIndexOf("node_modules");return o=-1!==r?t.slice(0,r).join(s):t.join(s),C.set(e,o),o}catch{let o=f(e);return C.set(e,o),o}}let I=[...w.cssModules,`@moneko/${L}`,"neko-ui"].map(O),b=["components","example","mock","site","src","server"].map(j);function W(e){return new Promise(o=>{o([...b,...w.rulesInclude?.[e]?.map(O)||[]])})}a&&b.push(j(a)),w.overrideResolve&&w.overrideResolve.override&&b.push(w.overrideResolve.override);let $=await Promise.all([W("css"),W("js"),W("media"),W("wasm"),W("font")]),R=$[0],B=$[1],S=$[2],z=$[3],D=$[4];d.sassLoader&&(e={loader:d.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let E=P&&M&&{test:i.tsdoc,include:w.alias["@pkg"],exclude:[/node_modules\/(?!(@app|@moneko)).+/,i.__tests__],enforce:"pre",loader:o(r.corePath,"/loader/ts-doc.cjs"),options:{comment:g,generateDoc:y,getCommentPath:x}},J=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let o=e.filename;return o&&o.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:i.wasm,type:"webassembly/async",include:z},{test:i.txt,type:"asset/source"},{test:i.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[name][ext]":"assets/images/[name][ext]",dataUrl:(e,o)=>o.filename.toLocaleLowerCase().endsWith(".svg")?v(e.toString()):e},include:S},{test:i.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:S},{test:i.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:D}],N=w.prefixJsLoader.filter(Boolean)||[];switch(L){case"react":w.reactCompiler&&N.unshift({loader:o(r.corePath,"/loader/react-compiler.cjs"),options:w.reactCompiler});break;case"solid":w.refresh=!1}let Q=new m({});Q.on("change",(e,o)=>{t(e,o)});export default(s=>{let t={loader:d.swcLoader,options:p(s)};return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:w.noParse,rules:[!1!==w.htmlPluginOption&&E,{oneOf:[...J,{test:i.js,use:[...N,t],include:B},{test:i.css,use:[l,_],include:R},e&&{test:i.scss,use:[l,_,e],include:R},{test:i.less,use:[l,_,k],include:R},{test:i.markdown,use:[...N,{loader:o(r.corePath,"/loader/mdx.cjs"),options:w.mdx}],exclude:[/node_modules\/(?!(@app|@moneko)).+/]}].filter(Boolean)},...w.moduleRules].filter(Boolean)}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.27.
|
|
3
|
+
"version": "3.27.1",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"author": "moneko",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/core": "7.26.0",
|
|
19
18
|
"@fastify/compress": "7.0.3",
|
|
20
19
|
"@fastify/http-proxy": "9.5.0",
|
|
21
20
|
"@fastify/middie": "8.3.3",
|
|
@@ -25,7 +24,7 @@
|
|
|
25
24
|
"@moneko/utils": "0.1.22",
|
|
26
25
|
"@swc/core": "1.6.13",
|
|
27
26
|
"browserslist": "4.24.3",
|
|
28
|
-
"chokidar": "4.0.
|
|
27
|
+
"chokidar": "4.0.3",
|
|
29
28
|
"core-js": "3.39.0",
|
|
30
29
|
"core-js-compat": "3.39.0",
|
|
31
30
|
"fastify": "4.29.0",
|
|
@@ -46,12 +45,14 @@
|
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@moneko/css": "1.1.5",
|
|
48
47
|
"@types/babel__core": "7.20.5",
|
|
48
|
+
"@types/stylis": "4.2.7",
|
|
49
49
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
50
50
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
51
|
-
"eslint-config-neko": "3.0.
|
|
51
|
+
"eslint-config-neko": "3.0.3",
|
|
52
52
|
"sass": "1.83.0",
|
|
53
53
|
"sass-loader": "16.0.4",
|
|
54
54
|
"solid-refresh": "0.7.5",
|
|
55
|
+
"stylis": "4.3.4",
|
|
55
56
|
"webpack-bundle-analyzer": "4.10.2"
|
|
56
57
|
},
|
|
57
58
|
"files": [
|