@moneko/core 3.27.2 → 3.27.3

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";module.exports=function(e,t){return(t||(t={}),"string"!=typeof(e=e&&e.__esModule?e.default:e))?e:(/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]/.test(e)||t.needQuotes)?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e};
1
+ "use strict";module.exports=function(a,e){if(e||(e={}),"Buffer"===a.type){let e=Buffer.from(a.data);return`data:${function(a){let e=a.toString("hex",0,8).toLowerCase();for(let[a,i]of Object.entries({"89504e47":"image/png",ffd8ffe0:"image/jpeg",ffd8ffe1:"image/jpeg",ffd8ffe2:"image/jpeg",ffd8ffe3:"image/jpeg",ffd8ffe8:"image/jpeg",47494638:"image/gif","49492a00":"image/tiff","4d4d002a":"image/tiff",52494646:"image/webp",52494646:"image/bmp",494433:"audio/mpeg",fff1:"audio/aac","4f676753":"audio/ogg",52494646:"audio/wav","664c6143":"audio/flac","1a45dfa3":"audio/x-matroska","00000018":"video/mp4","1a45dfa3":"video/webm",66747970:"video/quicktime",52494646:"video/avi","000001ba":"video/mpeg","000001b3":"video/mpeg","464c5601":"video/x-flv",25504446:"application/pdf",d0cf11e0:"application/msword","504b0304":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",52617221:"application/vnd.rar","7f454c46":"application/x-executable","3c3f786d":"application/xml","68746d6c":"text/html",efbbbf:"text/plain","1f8b08":"application/gzip","425a68":"application/x-bzip2","5a4d":"application/x-7z-compressed",52617221:"application/vnd.rar","00010000":"font/ttf","4f54544f":"font/otf","774f4646":"font/woff","774f4632":"font/woff2",74746366:"font/collection","1a45dfa3":"video/x-matroska","4d546864":"audio/midi",52494646:"application/x-ms-asf","504b0304":"application/zip",75737461:"application/x-tar","3c3f786d":"application/xml",232120:"text/x-shellscript","7061636b":"application/x-java-applet"}))if(e.startsWith(a))return i;return"unknown"}(e)};base64,${e.toString("base64url")}`}return"string"!=typeof(a=a&&a.__esModule?a.default:a)?a:(/^['"].*['"]$/.test(a)&&(a=a.slice(1,-1)),e.hash&&(a+=e.hash),/["'() \t\n]/.test(a)||e.needQuotes)?'"'.concat(a.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):a};
@@ -2,3 +2,4 @@ type Url = {
2
2
  __esModule?: boolean;
3
3
  default: string;
4
4
  };
5
+ declare function getMimeType(buffer: Buffer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.27.2",
3
+ "version": "3.27.3",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
package/lib/loader/a.cjs DELETED
@@ -1 +0,0 @@
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,13 +0,0 @@
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);