@modern-js/module-tools 2.15.0 → 2.16.0-beta.0
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/compiled/postcss-custom-properties/index.js +1 -1
- package/compiled/postcss-custom-properties/package.json +1 -1
- package/dist/build.js +23 -66
- package/dist/build.js.map +1 -1
- package/dist/builder/build.js +114 -170
- package/dist/builder/build.js.map +1 -1
- package/dist/builder/clear.js +23 -65
- package/dist/builder/clear.js.map +1 -1
- package/dist/builder/copy.js +83 -164
- package/dist/builder/copy.js.map +1 -1
- package/dist/builder/dts/index.js +15 -28
- package/dist/builder/dts/index.js.map +1 -1
- package/dist/builder/dts/rollup.js +46 -120
- package/dist/builder/dts/rollup.js.map +1 -1
- package/dist/builder/dts/tsc.js +82 -141
- package/dist/builder/dts/tsc.js.map +1 -1
- package/dist/builder/index.js +34 -85
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/platform.js +40 -93
- package/dist/builder/platform.js.map +1 -1
- package/dist/cli.js +35 -84
- package/dist/cli.js.map +1 -1
- package/dist/command.js +56 -136
- package/dist/command.js.map +1 -1
- package/dist/config/defineConfig.js +13 -42
- package/dist/config/defineConfig.js.map +1 -1
- package/dist/config/legacySchema.js +96 -52
- package/dist/config/legacySchema.js.map +1 -1
- package/dist/config/normalize.js +73 -149
- package/dist/config/normalize.js.map +1 -1
- package/dist/config/schema.d.ts +36 -0
- package/dist/config/schema.js +118 -56
- package/dist/config/schema.js.map +1 -1
- package/dist/config/transformLegacyConfig.js +152 -203
- package/dist/config/transformLegacyConfig.js.map +1 -1
- package/dist/constants/build.js +15 -27
- package/dist/constants/build.js.map +1 -1
- package/dist/constants/buildPresets.js +71 -84
- package/dist/constants/buildPresets.js.map +1 -1
- package/dist/constants/colors.js +28 -30
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/dts.js +13 -28
- package/dist/constants/dts.js.map +1 -1
- package/dist/constants/file.js +27 -30
- package/dist/constants/file.js.map +1 -1
- package/dist/constants/legacyBuildPresets.js +33 -49
- package/dist/constants/legacyBuildPresets.js.map +1 -1
- package/dist/constants/log.js +15 -33
- package/dist/constants/log.js.map +1 -1
- package/dist/dev.js +45 -91
- package/dist/dev.js.map +1 -1
- package/dist/error.js +37 -54
- package/dist/error.js.map +1 -1
- package/dist/hooks/build.js +22 -35
- package/dist/hooks/build.js.map +1 -1
- package/dist/hooks/dev.js +15 -33
- package/dist/hooks/dev.js.map +1 -1
- package/dist/hooks/index.js +15 -42
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/misc.js +10 -28
- package/dist/hooks/misc.js.map +1 -1
- package/dist/index.js +21 -35
- package/dist/index.js.map +1 -1
- package/dist/locale/en.d.ts +7 -2
- package/dist/locale/en.js +25 -32
- package/dist/locale/en.js.map +1 -1
- package/dist/locale/index.d.ts +14 -4
- package/dist/locale/index.js +18 -31
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/zh.d.ts +7 -2
- package/dist/locale/zh.js +25 -32
- package/dist/locale/zh.js.map +1 -1
- package/dist/plugins.js +16 -39
- package/dist/plugins.js.map +1 -1
- package/dist/types/color.js +4 -15
- package/dist/types/color.js.map +1 -1
- package/dist/types/command.js +4 -15
- package/dist/types/command.js.map +1 -1
- package/dist/types/config/index.d.ts +6 -0
- package/dist/types/config/index.js +6 -17
- package/dist/types/config/index.js.map +1 -1
- package/dist/types/config/style.js +4 -15
- package/dist/types/config/style.js.map +1 -1
- package/dist/types/context.js +4 -15
- package/dist/types/context.js.map +1 -1
- package/dist/types/copy.js +4 -15
- package/dist/types/copy.js.map +1 -1
- package/dist/types/dts.js +4 -15
- package/dist/types/dts.js.map +1 -1
- package/dist/types/hooks.js +4 -15
- package/dist/types/hooks.js.map +1 -1
- package/dist/types/index.js +11 -22
- package/dist/types/index.js.map +1 -1
- package/dist/types/legacyConfig/index.js +4 -15
- package/dist/types/legacyConfig/index.js.map +1 -1
- package/dist/types/legacyConfig/output.js +4 -15
- package/dist/types/legacyConfig/output.js.map +1 -1
- package/dist/types/legacyConfig/source.js +4 -15
- package/dist/types/legacyConfig/source.js.map +1 -1
- package/dist/types/legacyConfig/tools.js +4 -15
- package/dist/types/legacyConfig/tools.js.map +1 -1
- package/dist/types/utils.js +4 -17
- package/dist/utils/builder.d.ts +20 -2
- package/dist/utils/builder.js +81 -68
- package/dist/utils/builder.js.map +1 -1
- package/dist/utils/common.js +10 -44
- package/dist/utils/common.js.map +1 -1
- package/dist/utils/config.js +108 -144
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/context.js +16 -59
- package/dist/utils/context.js.map +1 -1
- package/dist/utils/dts.js +69 -146
- package/dist/utils/dts.js.map +1 -1
- package/dist/utils/input.js +44 -87
- package/dist/utils/input.js.map +1 -1
- package/dist/utils/language.js +15 -60
- package/dist/utils/language.js.map +1 -1
- package/dist/utils/libuildPlugins.js +27 -67
- package/dist/utils/libuildPlugins.js.map +1 -1
- package/dist/utils/log.js +14 -61
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/onExit.js +14 -61
- package/dist/utils/onExit.js.map +1 -1
- package/dist/utils/path.js +13 -59
- package/dist/utils/path.js.map +1 -1
- package/dist/utils/print.js +57 -105
- package/dist/utils/print.js.map +1 -1
- package/dist/utils/style.js +54 -106
- package/dist/utils/style.js.map +1 -1
- package/dist/utils/tspathsTransform.js +44 -81
- package/dist/utils/tspathsTransform.js.map +1 -1
- package/package.json +11 -10
- package/scripts/debug-mode.js +23 -21
- package/dist/types/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={549:e=>{function webpackEmptyContext(e){var t=new Error("Cannot find module '"+e+"'");t.code="MODULE_NOT_FOUND";throw t}webpackEmptyContext.keys=()=>[];webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=549;e.exports=webpackEmptyContext},36:e=>{"use strict";e.exports=require("../postcss-value-parser")},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")},977:e=>{"use strict";e.exports=require("postcss")},310:e=>{"use strict";e.exports=require("url")},480:(e,t,r)=>{"use strict";var o=r(36),s=r(17),a=r(310),c=r(977),p=r(147);function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var f=n(o),b=n(s);function u(e){const t=e.selector?e:e.parent;return/(!\s*)?postcss-custom-properties:\s*off\b/i.test(t.toString())}function l(e,t){const r=new Map,o=new Map,s=new Map;e.nodes.slice().forEach((e=>{const s=m(e)?r:w(e)?o:null;s&&(e.nodes.slice().forEach((e=>{if(e.variable&&!u(e)){const{prop:r}=e;s.set(r,f.default(e.value)),t.preserve||e.remove()}})),t.preserve||!d(e)||u(e)||e.remove())}));for(const[e,t]of r.entries())s.set(e,t);for(const[e,t]of o.entries())s.set(e,t);return s}const _=/^html$/i,x=/^:root$/i,m=e=>"rule"===e.type&&e.selector.split(",").some((e=>_.test(e)))&&Object(e.nodes).length,w=e=>"rule"===e.type&&e.selector.split(",").some((e=>x.test(e)))&&Object(e.nodes).length,d=e=>0===Object(e.nodes).length;function v(e){const t=new Map;if("customProperties"in e)for(const[r,o]of Object.entries(e.customProperties))t.set(r,f.default(o.toString()));if("custom-properties"in e)for(const[r,o]of Object.entries(e["custom-properties"]))t.set(r,f.default(o.toString()));return t}async function y(e){let t;try{t=await(o=e,Promise.resolve().then((function(){return i(r(549)(o))})))}catch(o){t=await function(e){return Promise.resolve().then((function(){return i(r(549)(e))}))}(a.pathToFileURL(e).href)}var o;return v("default"in t?t.default:t)}async function h(e){const t=(await Promise.all(e.map((async e=>{if(e instanceof Promise?e=await e:e instanceof Function&&(e=await e()),"string"==typeof e){const t=b.default.resolve(e);return{type:b.default.extname(t).slice(1).toLowerCase(),from:t}}if("customProperties"in e&&Object(e.customProperties)===e.customProperties)return e;if("custom-properties"in e&&Object(e["custom-properties"])===e["custom-properties"])return e;if("from"in e){const t=b.default.resolve(e.from);let r=e.type;return r||(r=b.default.extname(t).slice(1).toLowerCase()),{type:r,from:t}}return Object.keys(e).length,null})))).filter((e=>!!e)),r=await Promise.all(t.map((async e=>{if("type"in e&&"from"in e){if("css"===e.type||"pcss"===e.type)return await async function(e){const t=await p.promises.readFile(e);return l(c.parse(t,{from:e.toString()}),{preserve:!0})}(e.from);if("js"===e.type||"cjs"===e.type)return await y(e.from);if("mjs"===e.type)return await y(e.from);if("json"===e.type)return await async function(e){return v(await g(e))}(e.from);throw new Error("Invalid source type: "+e.type)}return v(e)}))),o=new Map;return r.forEach((e=>{for(const[t,r]of e.entries())o.set(t,r)})),o}const g=async e=>JSON.parse((await p.promises.readFile(e)).toString());function j(e,t){return e.nodes&&e.nodes.length&&e.nodes.slice().forEach((r=>{if(O(r)){const[o,...s]=r.nodes.filter((e=>"div"!==e.type)),{value:a}=o,c=e.nodes.indexOf(r);if(t.has(a)){const r=t.get(a).nodes;!function(e,t,r){const o=new Map(t);o.delete(r),j(e,o)}({nodes:r},t,a),c>-1&&e.nodes.splice(c,1,...r)}else s.length&&(c>-1&&e.nodes.splice(c,1,...r.nodes.slice(r.nodes.indexOf(s[0]))),j(e,t))}else j(r,t)})),e.toString()}const k=/^var$/i,O=e=>"function"===e.type&&k.test(e.value)&&Object(e.nodes).length>0;var $=(e,t,r)=>{if(F(e)&&!function(e){const t=e.prev();return Boolean(u(e)||t&&"comment"===t.type&&/(!\s*)?postcss-custom-properties:\s*ignore\s+next\b/i.test(t.text))}(e)){const o=e.value;let s=j(f.default(o),t);const a=new Set;for(;C.test(s)&&!a.has(s);){a.add(s);s=j(f.default(s),t)}if(s!==o)if(r.preserve){const t=e.cloneBefore({value:s});S(t)&&(t.raws.value.value=t.value.replace(D,"$1"),t.raws.value.raw=t.raws.value.value+t.raws.value.raw.replace(D,"$2"))}else e.value=s,S(e)&&(e.raws.value.value=e.value.replace(D,"$1"),e.raws.value.raw=e.raws.value.value+e.raws.value.raw.replace(D,"$2"))}};const P=/^--[A-z][\w-]*$/,C=/(^|[^\w-])var\([\W\w]+\)/,F=e=>!P.test(e.prop)&&C.test(e.value),S=e=>"value"in Object(Object(e.raws).value)&&"raw"in e.raws.value&&D.test(e.raws.value.raw),D=/^([\W\w]+)(\s*\/\*[\W\w]+?\*\/)$/;async function E(e,t,r){"css"===t&&await async function(e,t){const r=`:root {\n${Object.keys(t).reduce(((e,r)=>(e.push(`\t${r}: ${t[r]};`),e)),[]).join("\n")}\n}\n`;await p.promises.writeFile(e,r)}(e,r),"scss"===t&&await async function(e,t){const r=`${Object.keys(t).reduce(((e,r)=>{const o=r.replace("--","$");return e.push(`${o}: ${t[r]};`),e}),[]).join("\n")}\n`;await p.promises.writeFile(e,r)}(e,r),"js"===t&&await async function(e,t){const r=`module.exports = {\n\tcustomProperties: {\n${Object.keys(t).reduce(((e,r)=>(e.push(`\t\t'${q(r)}': '${q(t[r])}'`),e)),[]).join(",\n")}\n\t}\n};\n`;await p.promises.writeFile(e,r)}(e,r),"json"===t&&await async function(e,t){const r=`${JSON.stringify({"custom-properties":t},null," ")}\n`;await p.promises.writeFile(e,r)}(e,r),"mjs"===t&&await async function(e,t){const r=`export const customProperties = {\n${Object.keys(t).reduce(((e,r)=>(e.push(`\t'${q(r)}': '${q(t[r])}'`),e)),[]).join(",\n")}\n};\n`;await p.promises.writeFile(e,r)}(e,r)}function M(e){const t={};for(const[r,o]of e.entries())t[r]=o.toString();return t}const q=e=>e.replace(/\\([\s\S])|(')/g,"\\$1$2").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),N=e=>{const t=!("preserve"in Object(e))||Boolean(e.preserve),r="overrideImportFromWithRoot"in Object(e)&&Boolean(e.overrideImportFromWithRoot),o="disableDeprecationNotice"in Object(e)&&Boolean(e.disableDeprecationNotice);let s=[];Array.isArray(null==e?void 0:e.importFrom)?s=e.importFrom:null!=e&&e.importFrom&&(s=[e.importFrom]);let a=[];Array.isArray(null==e?void 0:e.exportTo)?a=e.exportTo:null!=e&&e.exportTo&&(a=[e.exportTo]);const c=h(s),p=0===s.length&&0===a.length;return{postcssPlugin:"postcss-custom-properties",prepare(){let e=new Map;return p?{Once:r=>{e=l(r,{preserve:t})},Declaration:r=>{$(r,e,{preserve:t})},OnceExit:()=>{e.clear()}}:{Once:async o=>{const s=(await c).entries(),p=l(o,{preserve:t}).entries();if(r)for(const[t,r]of[...s,...p])e.set(t,r);else for(const[t,r]of[...p,...s])e.set(t,r);await function(e,t){return Promise.all(t.map((async t=>{if(t instanceof Function)return void await t(M(e));if("string"==typeof t){const r=b.default.resolve(t),o=b.default.extname(r).slice(1).toLowerCase();return void await E(r,o,M(e))}let r={};if(r="toJSON"in t?t.toJSON(M(e)):M(e),"to"in t){const e=b.default.resolve(t.to);let o=t.type;return o||(o=b.default.extname(e).slice(1).toLowerCase()),void await E(e,o,r)}"customProperties"in t?t.customProperties=r:"custom-properties"in t&&(t["custom-properties"]=r)})))}(e,a)},Declaration:r=>{$(r,e,{preserve:t})},OnceExit:(t,{result:r})=>{!o&&(s.length>0||a.length>0)&&t.warn(r,'"importFrom" and "exportTo" will be removed in a future version of postcss-custom-properties.\nWe are looking for insights and anecdotes on how these features are used so that we can design the best alternative.\nPlease let us know if our proposal will work for you.\nVisit the discussion on github for more details. https://github.com/csstools/postcss-plugins/discussions/192'),e.clear()}}}}};N.postcss=!0,e.exports=N}};var t={};function __nccwpck_require__(r){var o=t[r];if(o!==undefined){return o.exports}var s=t[r]={exports:{}};var a=true;try{e[r](s,s.exports,__nccwpck_require__);a=false}finally{if(a)delete t[r]}return s.exports}(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(480);module.exports=r})();
|
|
1
|
+
(()=>{"use strict";var e={36:e=>{e.exports=require("../postcss-value-parser")},203:(e,n,o)=>{var t=o(484),r=o(978);class LayerName{parts;constructor(e){this.parts=e}tokens(){return[...this.parts]}slice(e,n){const o=[];for(let e=0;e<this.parts.length;e++)this.parts[e][0]===t.TokenType.Ident&&o.push(e);const r=o.slice(e,n);return new LayerName(this.parts.slice(r[0],r[r.length-1]+1))}concat(e){const n=[t.TokenType.Delim,".",-1,-1,{value:"."}];return new LayerName([...this.parts.filter((e=>e[0]===t.TokenType.Ident||e[0]===t.TokenType.Delim)),n,...e.parts.filter((e=>e[0]===t.TokenType.Ident||e[0]===t.TokenType.Delim))])}segments(){return this.parts.filter((e=>e[0]===t.TokenType.Ident)).map((e=>e[4].value))}name(){return this.parts.filter((e=>e[0]===t.TokenType.Ident||e[0]===t.TokenType.Delim)).map((e=>e[1])).join("")}equal(e){const n=this.segments(),o=e.segments();if(n.length!==o.length)return!1;for(let e=0;e<n.length;e++){if(n[e]!==o[e])return!1}return!0}toString(){return t.stringify(...this.parts)}toJSON(){return{parts:this.parts,segments:this.segments(),name:this.name()}}}function parseFromTokens(e,n){const o=r.parseCommaSeparatedListOfComponentValues(e,{onParseError:null==n?void 0:n.onParseError}),s=(null==n?void 0:n.onParseError)??(()=>{}),i=["6.4.2. Layer Naming and Nesting","Layer name syntax","<layer-name> = <ident> [ '.' <ident> ]*"],a=e[0][2],c=e[e.length-1][3],u=[];for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<n.length;e++){const o=n[e];if(!r.isTokenNode(o)&&!r.isCommentNode(o)&&!r.isWhitespaceNode(o))return s(new t.ParseError(`Invalid cascade layer name. Invalid layer name part "${o.toString()}"`,a,c,i)),[]}const d=n.flatMap((e=>e.tokens()));let p=!1,l=!1,m=null;for(let e=0;e<d.length;e++){const n=d[e];if(n[0]!==t.TokenType.Comment&&n[0]!==t.TokenType.Whitespace&&n[0]!==t.TokenType.Ident&&(n[0]!==t.TokenType.Delim||"."!==n[4].value))return s(new t.ParseError(`Invalid cascade layer name. Invalid character "${n[1]}"`,a,c,i)),[];if(!p&&n[0]===t.TokenType.Delim)return s(new t.ParseError("Invalid cascade layer name. Layer names can not start with a dot.",a,c,i)),[];if(p){if(n[0]===t.TokenType.Whitespace){l=!0;continue}if(l&&n[0]===t.TokenType.Comment)continue;if(l)return s(new t.ParseError("Invalid cascade layer name. Encountered unexpected whitespace between layer name parts.",a,c,i)),[];if(m&&m[0]===t.TokenType.Ident&&n[0]===t.TokenType.Ident)return s(new t.ParseError("Invalid cascade layer name. Layer name parts must be separated by dots.",a,c,i)),[];if(m&&m[0]===t.TokenType.Delim&&n[0]===t.TokenType.Delim)return s(new t.ParseError("Invalid cascade layer name. Layer name parts must not be empty.",a,c,i)),[]}n[0]===t.TokenType.Ident&&(p=!0),n[0]!==t.TokenType.Ident&&n[0]!==t.TokenType.Delim||(m=n)}if(!m)return s(new t.ParseError("Invalid cascade layer name. Empty layer name.",a,c,i)),[];if(m[0]===t.TokenType.Delim)return s(new t.ParseError("Invalid cascade layer name. Layer name must not end with a dot.",a,c,i)),[];u.push(new LayerName(d))}return u}n.LayerName=LayerName,n.addLayerToModel=function addLayerToModel(e,n){return n.forEach((n=>{const o=n.segments();e:for(let t=0;t<o.length;t++){const o=n.slice(0,t+1),r=o.segments();let s=-1,i=0;for(let n=0;n<e.length;n++){const o=e[n].segments();let t=0;n:for(let e=0;e<o.length;e++){const n=o[e],s=r[e];if(s===n&&e+1===r.length)continue e;if(s!==n){if(s!==n)break n}else t++}t>=i&&(s=n,i=t)}-1===s?e.push(o):e.splice(s+1,0,o)}})),e},n.parse=function parse(e,n){const o=t.tokenizer({css:e},{onParseError:null==n?void 0:n.onParseError}),r=[];for(;!o.endOfFile();)r.push(o.nextToken());return r.push(o.nextToken()),parseFromTokens(r,n)},n.parseFromTokens=parseFromTokens},978:(e,n,o)=>{var t,r=o(484);function consumeComponentValue(e,n){const o=n[0];if(o[0]===r.TokenType.OpenParen||o[0]===r.TokenType.OpenCurly||o[0]===r.TokenType.OpenSquare){const o=consumeSimpleBlock(e,n);return{advance:o.advance,node:o.node}}if(o[0]===r.TokenType.Function){const o=consumeFunction(e,n);return{advance:o.advance,node:o.node}}if(o[0]===r.TokenType.Whitespace){const o=consumeWhitespace(e,n);return{advance:o.advance,node:o.node}}if(o[0]===r.TokenType.Comment){const o=consumeComment(e,n);return{advance:o.advance,node:o.node}}return{advance:1,node:new TokenNode(o)}}n.ComponentValueType=void 0,(t=n.ComponentValueType||(n.ComponentValueType={})).Function="function",t.SimpleBlock="simple-block",t.Whitespace="whitespace",t.Comment="comment",t.Token="token";class FunctionNode{type=n.ComponentValueType.Function;name;endToken;value;constructor(e,n,o){this.name=e,this.endToken=n,this.value=o}getName(){return this.name[4].value}normalize(){this.endToken[0]===r.TokenType.EOF&&(this.endToken=[r.TokenType.CloseParen,")",-1,-1,void 0])}tokens(){return this.endToken[0]===r.TokenType.EOF?[this.name,...this.value.flatMap((e=>e.tokens()))]:[this.name,...this.value.flatMap((e=>e.tokens())),this.endToken]}toString(){const e=this.value.map((e=>r.isToken(e)?r.stringify(e):e.toString())).join("");return r.stringify(this.name)+e+r.stringify(this.endToken)}indexOf(e){return this.value.indexOf(e)}at(e){if("number"==typeof e)return e<0&&(e=this.value.length+e),this.value[e]}walk(e){let n=!1;if(this.value.forEach(((o,t)=>{n||(!1!==e({node:o,parent:this},t)?"walk"in o&&!1===o.walk(e)&&(n=!0):n=!0)})),n)return!1}toJSON(){return{type:this.type,name:this.getName(),tokens:this.tokens(),value:this.value.map((e=>e.toJSON()))}}isFunctionNode(){return FunctionNode.isFunctionNode(this)}static isFunctionNode(e){return!!e&&(e instanceof FunctionNode&&e.type===n.ComponentValueType.Function)}}function consumeFunction(e,n){const o=[];let t=1;for(;;){const s=n[t];if(!s||s[0]===r.TokenType.EOF)return e.onParseError(new r.ParseError("Unexpected EOF while consuming a function.",n[0][2],n[n.length-1][3],["5.4.9. Consume a function","Unexpected EOF"])),{advance:n.length,node:new FunctionNode(n[0],s,o)};if(s[0]===r.TokenType.CloseParen)return{advance:t+1,node:new FunctionNode(n[0],s,o)};if(s[0]===r.TokenType.Comment||s[0]===r.TokenType.Whitespace){const r=consumeAllCommentsAndWhitespace(e,n.slice(t));t+=r.advance,o.push(...r.nodes);continue}const i=consumeComponentValue(e,n.slice(t));t+=i.advance,o.push(i.node)}}class SimpleBlockNode{type=n.ComponentValueType.SimpleBlock;startToken;endToken;value;constructor(e,n,o){this.startToken=e,this.endToken=n,this.value=o}normalize(){if(this.endToken[0]===r.TokenType.EOF){const e=r.mirrorVariant(this.startToken);e&&(this.endToken=e)}}tokens(){return this.endToken[0]===r.TokenType.EOF?[this.startToken,...this.value.flatMap((e=>e.tokens()))]:[this.startToken,...this.value.flatMap((e=>e.tokens())),this.endToken]}toString(){const e=this.value.map((e=>r.isToken(e)?r.stringify(e):e.toString())).join("");return r.stringify(this.startToken)+e+r.stringify(this.endToken)}indexOf(e){return this.value.indexOf(e)}at(e){if("number"==typeof e)return e<0&&(e=this.value.length+e),this.value[e]}walk(e){let n=!1;if(this.value.forEach(((o,t)=>{n||(!1!==e({node:o,parent:this},t)?"walk"in o&&!1===o.walk(e)&&(n=!0):n=!0)})),n)return!1}toJSON(){return{type:this.type,startToken:this.startToken,tokens:this.tokens(),value:this.value.map((e=>e.toJSON()))}}isSimpleBlockNode(){return SimpleBlockNode.isSimpleBlockNode(this)}static isSimpleBlockNode(e){return!!e&&(e instanceof SimpleBlockNode&&e.type===n.ComponentValueType.SimpleBlock)}}function consumeSimpleBlock(e,n){const o=r.mirrorVariantType(n[0][0]);if(!o)throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");const t=[];let s=1;for(;;){const i=n[s];if(!i||i[0]===r.TokenType.EOF)return e.onParseError(new r.ParseError("Unexpected EOF while consuming a simple block.",n[0][2],n[n.length-1][3],["5.4.8. Consume a simple block","Unexpected EOF"])),{advance:n.length,node:new SimpleBlockNode(n[0],i,t)};if(i[0]===o)return{advance:s+1,node:new SimpleBlockNode(n[0],i,t)};if(i[0]===r.TokenType.Comment||i[0]===r.TokenType.Whitespace){const o=consumeAllCommentsAndWhitespace(e,n.slice(s));s+=o.advance,t.push(...o.nodes);continue}const a=consumeComponentValue(e,n.slice(s));s+=a.advance,t.push(a.node)}}class WhitespaceNode{type=n.ComponentValueType.Whitespace;value;constructor(e){this.value=e}tokens(){return this.value}toString(){return r.stringify(...this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isWhitespaceNode(){return WhitespaceNode.isWhitespaceNode(this)}static isWhitespaceNode(e){return!!e&&(e instanceof WhitespaceNode&&e.type===n.ComponentValueType.Whitespace)}}function consumeWhitespace(e,n){let o=0;for(;;){if(n[o][0]!==r.TokenType.Whitespace)return{advance:o,node:new WhitespaceNode(n.slice(0,o))};o++}}class CommentNode{type=n.ComponentValueType.Comment;value;constructor(e){this.value=e}tokens(){return[this.value]}toString(){return r.stringify(this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isCommentNode(){return CommentNode.isCommentNode(this)}static isCommentNode(e){return!!e&&(e instanceof CommentNode&&e.type===n.ComponentValueType.Comment)}}function consumeComment(e,n){return{advance:1,node:new CommentNode(n[0])}}function consumeAllCommentsAndWhitespace(e,n){const o=[];let t=0;for(;;)if(n[t][0]!==r.TokenType.Whitespace){if(n[t][0]!==r.TokenType.Comment)return{advance:t,nodes:o};o.push(new CommentNode(n[t])),t++}else{const e=consumeWhitespace(0,n.slice(t));t+=e.advance,o.push(e.node)}}class TokenNode{type=n.ComponentValueType.Token;value;constructor(e){this.value=e}tokens(){return[this.value]}toString(){return r.stringify(this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isTokenNode(){return TokenNode.isTokenNode(this)}static isTokenNode(e){return!!e&&(e instanceof TokenNode&&e.type===n.ComponentValueType.Token)}}function isSimpleBlockNode(e){return SimpleBlockNode.isSimpleBlockNode(e)}function isFunctionNode(e){return FunctionNode.isFunctionNode(e)}n.CommentNode=CommentNode,n.FunctionNode=FunctionNode,n.SimpleBlockNode=SimpleBlockNode,n.TokenNode=TokenNode,n.WhitespaceNode=WhitespaceNode,n.consumeAllCommentsAndWhitespace=consumeAllCommentsAndWhitespace,n.consumeComment=consumeComment,n.consumeComponentValue=consumeComponentValue,n.consumeFunction=consumeFunction,n.consumeSimpleBlock=consumeSimpleBlock,n.consumeWhitespace=consumeWhitespace,n.gatherNodeAncestry=function gatherNodeAncestry(e){const n=new Map;return e.walk((e=>{Array.isArray(e.node)?e.node.forEach((o=>{n.set(o,e.parent)})):n.set(e.node,e.parent)})),n},n.isCommentNode=function isCommentNode(e){return CommentNode.isCommentNode(e)},n.isFunctionNode=isFunctionNode,n.isSimpleBlockNode=isSimpleBlockNode,n.isTokenNode=function isTokenNode(e){return TokenNode.isTokenNode(e)},n.isWhitespaceNode=function isWhitespaceNode(e){return WhitespaceNode.isWhitespaceNode(e)},n.parseCommaSeparatedListOfComponentValues=function parseCommaSeparatedListOfComponentValues(e,n){const o={onParseError:(null==n?void 0:n.onParseError)??(()=>{})},t=[...e];if(0===e.length)return[];t[t.length-1][0]!==r.TokenType.EOF&&t.push([r.TokenType.EOF,"",t[t.length-1][2],t[t.length-1][3],void 0]);const s=[];let i=[],a=0;for(;;){if(!t[a]||t[a][0]===r.TokenType.EOF)return i.length&&s.push(i),s;if(t[a][0]===r.TokenType.Comma){s.push(i),i=[],a++;continue}const n=consumeComponentValue(o,e.slice(a));i.push(n.node),a+=n.advance}},n.parseComponentValue=function parseComponentValue(e,n){const o={onParseError:(null==n?void 0:n.onParseError)??(()=>{})},t=[...e];t[t.length-1][0]!==r.TokenType.EOF&&t.push([r.TokenType.EOF,"",t[t.length-1][2],t[t.length-1][3],void 0]);const s=consumeComponentValue(o,t);if(t[Math.min(s.advance,t.length-1)][0]===r.TokenType.EOF)return s.node;o.onParseError(new r.ParseError("Expected EOF after parsing a component value.",e[0][2],e[e.length-1][3],["5.3.9. Parse a component value","Expected EOF"]))},n.parseListOfComponentValues=function parseListOfComponentValues(e,n){const o={onParseError:(null==n?void 0:n.onParseError)??(()=>{})},t=[...e];t[t.length-1][0]!==r.TokenType.EOF&&t.push([r.TokenType.EOF,"",t[t.length-1][2],t[t.length-1][3],void 0]);const s=[];let i=0;for(;;){if(!t[i]||t[i][0]===r.TokenType.EOF)return s;const e=consumeComponentValue(o,t.slice(i));s.push(e.node),i+=e.advance}},n.replaceComponentValues=function replaceComponentValues(e,n){for(let o=0;o<e.length;o++){const t=e[o];for(let e=0;e<t.length;e++){const o=t[e];{const r=n(o);if(r){t.splice(e,1,r);continue}}(isSimpleBlockNode(o)||isFunctionNode(o))&&o.walk(((e,o)=>{if("number"!=typeof o)return;const t=e.node,r=n(t);r&&e.parent.value.splice(o,1,r)}))}}return e},n.stringify=function stringify(e){return e.map((e=>e.map((e=>r.stringify(...e.tokens()))).join(""))).join(",")}},484:(e,n)=>{class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t}}class Reader{cursor;source="";codePointSource=[];length=0;representationStart=0;representationEnd=-1;constructor(e){this.cursor=0,this.source=e,this.length=e.length,this.codePointSource=new Array(this.length);for(let e=0;e<this.length;e++)this.codePointSource[e]=this.source.charCodeAt(e)}advanceCodePoint(e=1){this.cursor+=e,this.representationEnd=this.cursor-1}readCodePoint(e=1){const n=this.codePointSource[this.cursor];return void 0!==n&&(this.cursor+=e,this.representationEnd=this.cursor-1,n)}unreadCodePoint(e=1){this.cursor-=e,this.representationEnd=this.cursor-1}}var o,t,r;n.TokenType=void 0,(o=n.TokenType||(n.TokenType={})).Comment="comment",o.AtKeyword="at-keyword-token",o.BadString="bad-string-token",o.BadURL="bad-url-token",o.CDC="CDC-token",o.CDO="CDO-token",o.Colon="colon-token",o.Comma="comma-token",o.Delim="delim-token",o.Dimension="dimension-token",o.EOF="EOF-token",o.Function="function-token",o.Hash="hash-token",o.Ident="ident-token",o.Number="number-token",o.Percentage="percentage-token",o.Semicolon="semicolon-token",o.String="string-token",o.URL="url-token",o.Whitespace="whitespace-token",o.OpenParen="(-token",o.CloseParen=")-token",o.OpenSquare="[-token",o.CloseSquare="]-token",o.OpenCurly="{-token",o.CloseCurly="}-token",n.NumberType=void 0,(t=n.NumberType||(n.NumberType={})).Integer="integer",t.Number="number",function(e){e.Unrestricted="unrestricted",e.ID="id"}(r||(r={}));const s=Object.values(n.TokenType);const i=39,a=42,c=8,u=13,d=9,p=58,l=44,m=64,f=127,T=33,h=12,k=46,C=62,S=45,y=31,v=69,P=101,E=123,g=40,w=91,N=60,O=10,I=11,F=95,L=1114111,b=0,A=35,W=37,x=43,D=34,V=65533,U=92,R=125,B=41,q=93,_=59,M=14,H=47,$=32;function checkIfFourCodePointsWouldStartCDO(e,n){return n.codePointSource[n.cursor]===N&&n.codePointSource[n.cursor+1]===T&&n.codePointSource[n.cursor+2]===S&&n.codePointSource[n.cursor+3]===S}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return isDigitCodePoint(e)||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isNonASCIICodePoint(e){return e>=128}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCIICodePoint(e)||e===F}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===S}function isNewLine(e){return 10===e||13===e||12===e}function isWhitespace(e){return 32===e||10===e||9===e||13===e||12===e}function checkIfTwoCodePointsAreAValidEscape(e,n){return n.codePointSource[n.cursor]===U&&!isNewLine(n.codePointSource[n.cursor+1])}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.codePointSource[n.cursor]===S?n.codePointSource[n.cursor+1]===S||(!!isIdentStartCodePoint(n.codePointSource[n.cursor+1])||n.codePointSource[n.cursor+1]===U&&!isNewLine(n.codePointSource[n.cursor+2])):!!isIdentStartCodePoint(n.codePointSource[n.cursor])||checkIfTwoCodePointsAreAValidEscape(0,n)}function checkIfThreeCodePointsWouldStartANumber(e,n){return n.codePointSource[n.cursor]===x||n.codePointSource[n.cursor]===S?!!isDigitCodePoint(n.codePointSource[n.cursor+1])||n.codePointSource[n.cursor+1]===k&&isDigitCodePoint(n.codePointSource[n.cursor+2]):n.codePointSource[n.cursor]===k?isDigitCodePoint(n.codePointSource[n.cursor+1]):isDigitCodePoint(n.codePointSource[n.cursor])}function checkIfTwoCodePointsStartAComment(e,n){return n.codePointSource[n.cursor]===H&&n.codePointSource[n.cursor+1]===a}function checkIfThreeCodePointsWouldStartCDC(e,n){return n.codePointSource[n.cursor]===S&&n.codePointSource[n.cursor+1]===S&&n.codePointSource[n.cursor+2]===C}function consumeComment(e,o){for(o.advanceCodePoint(2);;){const n=o.readCodePoint();if(!1===n){e.onParseError(new ParseError("Unexpected EOF while consuming a comment.",o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"]));break}if(n===a&&(void 0!==o.codePointSource[o.cursor]&&o.codePointSource[o.cursor]===H)){o.advanceCodePoint();break}}return[n.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(e,n){const o=n.readCodePoint();if(!1===o)return e.onParseError(new ParseError("Unexpected EOF while consuming an escaped code point.",n.representationStart,n.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),V;if(isHexDigitCodePoint(o)){const e=[o];for(;void 0!==n.codePointSource[n.cursor]&&isHexDigitCodePoint(n.codePointSource[n.cursor])&&e.length<6;)e.push(n.codePointSource[n.cursor]),n.advanceCodePoint();isWhitespace(n.codePointSource[n.cursor])&&n.advanceCodePoint();const r=parseInt(String.fromCharCode(...e),16);return 0===r?V:(t=r)>=55296&&t<=57343||r>L?V:r}var t;return o}function consumeIdentSequence(e,n){const o=[];for(;;)if(isIdentCodePoint(n.codePointSource[n.cursor]))o.push(n.codePointSource[n.cursor]),n.advanceCodePoint();else{if(!checkIfTwoCodePointsAreAValidEscape(0,n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n))}}function consumeHashToken(e,o){if(o.advanceCodePoint(),void 0!==o.codePointSource[o.cursor]&&(isIdentCodePoint(o.codePointSource[o.cursor])||checkIfTwoCodePointsAreAValidEscape(0,o))){let t=r.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,o)&&(t=r.ID);const s=consumeIdentSequence(e,o);return[n.TokenType.Hash,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:String.fromCharCode(...s),type:t}]}return[n.TokenType.Delim,"#",o.representationStart,o.representationEnd,{value:"#"}]}function consumeNumber(e,o){let t=n.NumberType.Integer;for(o.codePointSource[o.cursor]!==x&&o.codePointSource[o.cursor]!==S||o.advanceCodePoint();isDigitCodePoint(o.codePointSource[o.cursor]);)o.advanceCodePoint();if(o.codePointSource[o.cursor]===k&&isDigitCodePoint(o.codePointSource[o.cursor+1]))for(o.advanceCodePoint(2),t=n.NumberType.Number;isDigitCodePoint(o.codePointSource[o.cursor]);)o.advanceCodePoint();if(o.codePointSource[o.cursor]===P||o.codePointSource[o.cursor]===v){if(isDigitCodePoint(o.codePointSource[o.cursor+1]))o.advanceCodePoint(2);else{if(o.codePointSource[o.cursor+1]!==S&&o.codePointSource[o.cursor+1]!==x||!isDigitCodePoint(o.codePointSource[o.cursor+2]))return t;o.advanceCodePoint(3)}for(t=n.NumberType.Number;isDigitCodePoint(o.codePointSource[o.cursor]);)o.advanceCodePoint()}return t}function consumeNumericToken(e,o){const t=consumeNumber(0,o),r=parseFloat(o.source.slice(o.representationStart,o.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,o)){const s=consumeIdentSequence(e,o);return[n.TokenType.Dimension,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:r,type:t,unit:String.fromCharCode(...s)}]}return o.codePointSource[o.cursor]===W?(o.advanceCodePoint(),[n.TokenType.Percentage,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:r}]):[n.TokenType.Number,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:r,type:t}]}function consumeWhiteSpace(e,o){for(;isWhitespace(o.codePointSource[o.cursor]);)o.advanceCodePoint();return[n.TokenType.Whitespace,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeStringToken(e,o){let t="";const r=o.readCodePoint();for(;;){const s=o.readCodePoint();if(!1===s)return e.onParseError(new ParseError("Unexpected EOF while consuming a string token.",o.representationStart,o.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"])),[n.TokenType.String,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isNewLine(s))return e.onParseError(new ParseError("Unexpected newline while consuming a string token.",o.representationStart,o.representationEnd,["4.3.5. Consume a string token","Unexpected newline"])),o.unreadCodePoint(),[n.TokenType.BadString,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];if(s===r)return[n.TokenType.String,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(s!==U)t+=String.fromCharCode(s);else{if(void 0===o.codePointSource[o.cursor])continue;if(isNewLine(o.codePointSource[o.cursor])){o.advanceCodePoint();continue}t+=String.fromCharCode(consumeEscapedCodePoint(e,o))}}}const j="u".charCodeAt(0),z="U".charCodeAt(0),J="r".charCodeAt(0),K="R".charCodeAt(0),Q="l".charCodeAt(0),G="L".charCodeAt(0);function checkIfCodePointsMatchURLIdent(e,n){return 3===n.length&&((n[0]===j||n[0]===z)&&((n[1]===J||n[1]===K)&&(n[2]===Q||n[2]===G)))}function consumeBadURL(e,n){for(;;){if(void 0===n.codePointSource[n.cursor])return;if(n.codePointSource[n.cursor]===B)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(0,n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint()}}function consumeUrlToken(e,o){consumeWhiteSpace(0,o);let t="";for(;;){if(void 0===o.codePointSource[o.cursor])return e.onParseError(new ParseError("Unexpected EOF while consuming a url token.",o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"])),[n.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(o.codePointSource[o.cursor]===B)return o.advanceCodePoint(),[n.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.codePointSource[o.cursor]))return consumeWhiteSpace(0,o),void 0===o.codePointSource[o.cursor]?(e.onParseError(new ParseError("Unexpected EOF while consuming a url token.",o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"])),[n.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):o.codePointSource[o.cursor]===B?(o.advanceCodePoint(),[n.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(e,o),[n.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]);if(o.codePointSource[o.cursor]===D||o.codePointSource[o.cursor]===i||o.codePointSource[o.cursor]===g||((r=o.codePointSource[o.cursor])===I||r===f||b<=r&&r<=c||M<=r&&r<=y))return consumeBadURL(e,o),e.onParseError(new ParseError("Unexpected character while consuming a url token.",o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"])),[n.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];if(o.codePointSource[o.cursor]===U){if(checkIfTwoCodePointsAreAValidEscape(0,o)){o.advanceCodePoint(),t+=String.fromCharCode(consumeEscapedCodePoint(e,o));continue}return consumeBadURL(e,o),e.onParseError(new ParseError("Invalid escape sequence while consuming a url token.",o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"])),[n.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}t+=String.fromCharCode(o.codePointSource[o.cursor]),o.advanceCodePoint()}var r}function consumeIdentLikeToken(e,o){const t=consumeIdentSequence(e,o);if(o.codePointSource[o.cursor]!==g)return[n.TokenType.Ident,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:String.fromCharCode(...t)}];if(checkIfCodePointsMatchURLIdent(0,t)){o.advanceCodePoint();let r=0;for(;;){const e=isWhitespace(o.codePointSource[o.cursor]),s=isWhitespace(o.codePointSource[o.cursor+1]);if(e&&s){r+=1,o.advanceCodePoint(1);continue}const a=e?o.codePointSource[o.cursor+1]:o.codePointSource[o.cursor];if(a===D||a===i)return r>0&&o.unreadCodePoint(r),[n.TokenType.Function,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:String.fromCharCode(...t)}];break}return consumeUrlToken(e,o)}return o.advanceCodePoint(),[n.TokenType.Function,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:String.fromCharCode(...t)}]}function tokenizer(e,o){const t=e.css.valueOf(),r=new Reader(t),s={onParseError:(null==o?void 0:o.onParseError)??(()=>{})};return{nextToken:function nextToken(){if(r.representationStart=r.cursor,r.representationEnd=-1,checkIfTwoCodePointsStartAComment(0,r))return consumeComment(s,r);const e=r.codePointSource[r.cursor];if(void 0===e)return[n.TokenType.EOF,"",-1,-1,void 0];if(isIdentStartCodePoint(e))return consumeIdentLikeToken(s,r);if(isDigitCodePoint(e))return consumeNumericToken(s,r);switch(e){case l:return r.advanceCodePoint(),[n.TokenType.Comma,",",r.representationStart,r.representationEnd,void 0];case p:return r.advanceCodePoint(),[n.TokenType.Colon,":",r.representationStart,r.representationEnd,void 0];case _:return r.advanceCodePoint(),[n.TokenType.Semicolon,";",r.representationStart,r.representationEnd,void 0];case g:return r.advanceCodePoint(),[n.TokenType.OpenParen,"(",r.representationStart,r.representationEnd,void 0];case B:return r.advanceCodePoint(),[n.TokenType.CloseParen,")",r.representationStart,r.representationEnd,void 0];case w:return r.advanceCodePoint(),[n.TokenType.OpenSquare,"[",r.representationStart,r.representationEnd,void 0];case q:return r.advanceCodePoint(),[n.TokenType.CloseSquare,"]",r.representationStart,r.representationEnd,void 0];case E:return r.advanceCodePoint(),[n.TokenType.OpenCurly,"{",r.representationStart,r.representationEnd,void 0];case R:return r.advanceCodePoint(),[n.TokenType.CloseCurly,"}",r.representationStart,r.representationEnd,void 0];case i:case D:return consumeStringToken(s,r);case A:return consumeHashToken(s,r);case x:case k:return checkIfThreeCodePointsWouldStartANumber(0,r)?consumeNumericToken(s,r):(r.advanceCodePoint(),[n.TokenType.Delim,r.source[r.representationStart],r.representationStart,r.representationEnd,{value:r.source[r.representationStart]}]);case O:case u:case h:case d:case $:return consumeWhiteSpace(0,r);case S:return checkIfThreeCodePointsWouldStartANumber(0,r)?consumeNumericToken(s,r):checkIfThreeCodePointsWouldStartCDC(0,r)?(r.advanceCodePoint(3),[n.TokenType.CDC,"--\x3e",r.representationStart,r.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,r)?consumeIdentLikeToken(s,r):(r.advanceCodePoint(),[n.TokenType.Delim,"-",r.representationStart,r.representationEnd,{value:"-"}]);case N:return checkIfFourCodePointsWouldStartCDO(0,r)?(r.advanceCodePoint(4),[n.TokenType.CDO,"\x3c!--",r.representationStart,r.representationEnd,void 0]):(r.advanceCodePoint(),[n.TokenType.Delim,"<",r.representationStart,r.representationEnd,{value:"<"}]);case m:if(r.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,r)){const e=consumeIdentSequence(s,r);return[n.TokenType.AtKeyword,r.source.slice(r.representationStart,r.representationEnd+1),r.representationStart,r.representationEnd,{value:String.fromCharCode(...e)}]}return[n.TokenType.Delim,"@",r.representationStart,r.representationEnd,{value:"@"}];case U:return checkIfTwoCodePointsAreAValidEscape(0,r)?consumeIdentLikeToken(s,r):(r.advanceCodePoint(),s.onParseError(new ParseError('Invalid escape sequence after "\\"',r.representationStart,r.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"])),[n.TokenType.Delim,"\\",r.representationStart,r.representationEnd,{value:"\\"}])}return r.advanceCodePoint(),[n.TokenType.Delim,r.source[r.representationStart],r.representationStart,r.representationEnd,{value:r.source[r.representationStart]}]},endOfFile:function endOfFile(){return void 0===r.codePointSource[r.cursor]}}}n.ParseError=ParseError,n.Reader=Reader,n.cloneTokens=function cloneTokens(e){return"undefined"!=typeof globalThis&&"structuredClone"in globalThis?structuredClone(e):JSON.parse(JSON.stringify(e))},n.isToken=function isToken(e){return!!Array.isArray(e)&&(!(e.length<4)&&(!!s.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},n.mirrorVariant=function mirrorVariant(e){switch(e[0]){case n.TokenType.OpenParen:return[n.TokenType.CloseParen,")",-1,-1,void 0];case n.TokenType.CloseParen:return[n.TokenType.OpenParen,"(",-1,-1,void 0];case n.TokenType.OpenCurly:return[n.TokenType.CloseCurly,"}",-1,-1,void 0];case n.TokenType.CloseCurly:return[n.TokenType.OpenCurly,"{",-1,-1,void 0];case n.TokenType.OpenSquare:return[n.TokenType.CloseSquare,"]",-1,-1,void 0];case n.TokenType.CloseSquare:return[n.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},n.mirrorVariantType=function mirrorVariantType(e){switch(e){case n.TokenType.OpenParen:return n.TokenType.CloseParen;case n.TokenType.CloseParen:return n.TokenType.OpenParen;case n.TokenType.OpenCurly:return n.TokenType.CloseCurly;case n.TokenType.CloseCurly:return n.TokenType.OpenCurly;case n.TokenType.OpenSquare:return n.TokenType.CloseSquare;case n.TokenType.CloseSquare:return n.TokenType.OpenSquare;default:return null}},n.mutateIdent=function mutateIdent(e,n){let o="";const t=new Array(n.length);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);let r=0;t[0]===S&&t[1]===S?(o="--",r=2):t[0]===S&&t[1]?(o="-",r=2,isIdentStartCodePoint(t[1])?o+=n[1]:o+=`\\${t[1].toString(16)} `):isIdentStartCodePoint(t[0])?(o=n[0],r=1):(o=`\\${t[0].toString(16)} `,r=1);for(let e=r;e<t.length;e++)isIdentCodePoint(t[e])?o+=n[e]:o+=`\\${t[e].toString(16)} `;e[1]=o,e[4].value=n},n.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},n.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];{for(;!o.endOfFile();){const e=o.nextToken();e&&t.push(e)}const e=o.nextToken();e&&t.push(e)}return t},n.tokenizer=tokenizer},292:(e,n,o)=>{var t=o(36),r=o(203);const s=r.parse("csstools-implicit-layer")[0];function collectCascadeLayerOrder(e){const n=new Map,o=new Map,t=[];e.walkAtRules((e=>{var i;if("layer"!==e.name.toLowerCase())return;{let n=e.parent;for(;n;){if("atrule"!==n.type||"layer"!==n.name.toLowerCase()){if(n===e.root())break;return}n=n.parent}}let a;if(e.nodes)a=normalizeLayerName(e.params,1);else{if(!e.params.trim())return;a=e.params}let c=r.parse(a);if(null!=(i=c)&&i.length){{let n=e.parent;for(;n&&"atrule"===n.type&&"layer"===n.name.toLowerCase();){const e=o.get(n);e?(c=c.map((n=>e.concat(n))),n=n.parent):n=n.parent}}if(r.addLayerToModel(t,c),e.nodes){const t=c[0].concat(s);n.set(e,t),o.set(e,c[0])}}}));for(const e of n.values())r.addLayerToModel(t,[e]);const i=new WeakMap;for(const[e,o]of n)i.set(e,t.findIndex((e=>o.equal(e))));return i}function cascadeLayerNumberForNode(e,n){return e.parent&&"atrule"===e.parent.type&&"layer"===e.parent.name.toLowerCase()?n.has(e.parent)?n.get(e.parent):-1:1/0}function normalizeLayerName(e,n){return e.trim()?e:"csstools-anon-layer--"+n++}const i=/(!\s*)?postcss-custom-properties:\s*off\b/i,a=new WeakMap;function isBlockIgnored(e){if(!e||!e.nodes)return!1;if(a.has(e))return a.get(e);const n=e.some((e=>isIgnoreComment(e,i)));return a.set(e,n),n}const c=/(!\s*)?postcss-custom-properties:\s*ignore\s+next\b/i;function isDeclarationIgnored(e){return!!e&&(!!isBlockIgnored(e.parent)||isIgnoreComment(e.prev(),c))}function isIgnoreComment(e,n){return!!e&&"comment"===e.type&&n.test(e.text)}const u=new Set(["layer"]);function isProcessableRule(e){if(!isHtmlRule(e)&&!isRootRule(e))return!1;let n=e.parent;for(;n;){if("atrule"===n.type&&!u.has(n.name.toLowerCase()))return!1;n=n.parent}return!0}const d=/^html$/i,p=/^:root$/i;function isHtmlRule(e){return e.selectors.some((e=>d.test(e)))&&e.nodes&&e.nodes.length}function isRootRule(e){return e.selectors.some((e=>p.test(e)))&&e.nodes&&e.nodes.length}const l=/^var$/i;function isVarFunction(e){return"function"===e.type&&l.test(e.value)&&Object(e.nodes).length>0}function removeCyclicReferences(e,n){const o=new Set;let t=n;for(;e.size>0;)try{toposort(Array.from(e.keys()),t);break}catch(n){if(!n._graphNode)throw n;e.delete(n._graphNode),o.add(n._graphNode),t=t.filter((e=>-1===e.indexOf(n._graphNode)))}return o}function toposort(e,n){let o=e.length;const t=new Array(o),r={};let s=o;const i=makeOutgoingEdges(n),a=makeNodesHash(e);for(;s--;)r[s]||visit(e[s],s,new Set);return t;function visit(e,n,s){if(s.has(e)){const n=new Error("Cyclic dependency"+JSON.stringify(e));throw n._graphNode=e,n}if(!a.has(e))return;if(r[n])return;r[n]=!0;let c=i.get(e)||new Set;if(c=Array.from(c),n=c.length){s.add(e);do{const e=c[--n];visit(e,a.get(e),s)}while(n);s.delete(e)}t[--o]=e}}function makeOutgoingEdges(e){const n=new Map;for(let o=0,t=e.length;o<t;o++){const t=e[o];n.has(t[0])||n.set(t[0],new Set),n.has(t[1])||n.set(t[1],new Set),n.get(t[0]).add(t[1])}return n}function makeNodesHash(e){const n=new Map;for(let o=0,t=e.length;o<t;o++)n.set(e[o],o);return n}function getCustomPropertiesFromRoot(e){const n=new Map,o=new Map,r=new Map,s=new Map,i=new Map,a=collectCascadeLayerOrder(e);e.walkRules((e=>{isProcessableRule(e)&&(isBlockIgnored(e)||(isHtmlRule(e)?e.each((e=>{if("decl"!==e.type)return;if(!e.variable||isDeclarationIgnored(e))return;if("initial"===e.value.toLowerCase().trim())return;const o=cascadeLayerNumberForNode(e,a),t=s.get(e.prop)??-1;o&&o>=t&&(s.set(e.prop,o),n.set(e.prop,e.value))})):isRootRule(e)&&e.each((e=>{if("decl"!==e.type)return;if(!e.variable||isDeclarationIgnored(e))return;if("initial"===e.value.toLowerCase().trim())return;const n=cascadeLayerNumberForNode(e,a),t=i.get(e.prop)??-1;n&&n>=t&&(i.set(e.prop,n),o.set(e.prop,e.value))}))))}));for(const[e,o]of n.entries())r.set(e,o);for(const[e,n]of o.entries())r.set(e,n);const c=[],u=new Map;for(const[e,n]of r.entries()){const o=t(n);t.walk(o.nodes,(n=>{if(isVarFunction(n)){const[o]=n.nodes.filter((e=>"word"===e.type));c.push([o.value,e])}})),u.set(e,t(n))}return removeCyclicReferences(u,c),u}function transformValueAST(e,n){if(e.nodes&&e.nodes.length){const o=new Map;e.nodes.forEach((n=>{o.set(n,e)})),t.walk(e.nodes,(e=>{"nodes"in e&&e.nodes.length&&e.nodes.forEach((n=>{o.set(n,e)}))})),t.walk(e.nodes,(e=>{if(!isVarFunction(e))return;const[r,...s]=e.nodes.filter((e=>"div"!==e.type)),{value:i}=r,a=o.get(e);if(!a)return;const c=a.nodes.indexOf(e);if(-1===c)return;let u=!1;s&&t.walk(s,(e=>{if(isVarFunction(e)){const[o]=e.nodes.filter((e=>"word"===e.type));if(n.has(o.value))return;return u=!0,!1}}));let d=[];if(n.has(i)){var p;d=(null==(p=n.get(i))?void 0:p.nodes)??[]}else{if(!s.length||u)return;d=e.nodes.slice(e.nodes.indexOf(s[0]))}d.length?(a.nodes.splice(c,1,...d),a.nodes.forEach((e=>o.set(e,a)))):(a.nodes.splice(c,1,{type:"comment",value:"",sourceIndex:e.sourceIndex,sourceEndIndex:e.sourceEndIndex}),a.nodes.forEach((e=>o.set(e,a))))}),!0)}return e.toString()}var transformProperties=(e,n,o)=>{if(isTransformableDecl(e)&&!isDeclarationIgnored(e)){const i=e.value;let a=transformValueAST(t(i),n);const c=new Set;for(;a.includes("--")&&a.toLowerCase().includes("var(")&&!c.has(a);){c.add(a);a=transformValueAST(t(a),n)}if(a!==i){if(parentHasExactFallback(e,a))return void(o.preserve||e.remove());if(o.preserve){var r;const n=e.cloneBefore({value:a});hasTrailingComment(n)&&null!=(r=n.raws)&&r.value&&(n.raws.value.value=n.value.replace(m,"$1"),n.raws.value.raw=n.raws.value.value+n.raws.value.raw.replace(m,"$2"))}else{var s;e.value=a,hasTrailingComment(e)&&null!=(s=e.raws)&&s.value&&(e.raws.value.value=e.value.replace(m,"$1"),e.raws.value.raw=e.raws.value.value+e.raws.value.raw.replace(m,"$2"))}}}};const isTransformableDecl=e=>!e.variable&&e.value.includes("--")&&e.value.toLowerCase().includes("var("),hasTrailingComment=e=>{var n,o;return"value"in Object(Object(e.raws).value)&&"raw"in((null==(n=e.raws)?void 0:n.value)??{})&&m.test((null==(o=e.raws.value)?void 0:o.raw)??"")},m=/^([\W\w]+)(\s*\/\*[\W\w]+?\*\/)$/;function parentHasExactFallback(e,n){if(!e||!e.parent)return!1;let o=!1;const t=e.parent.index(e);return e.parent.each(((r,s)=>r!==e&&(!(s>=t)&&void("decl"===r.type&&r.prop.toLowerCase()===e.prop.toLowerCase()&&r.value===n&&(o=!0))))),o}const creator=e=>{const n=!("preserve"in Object(e))||Boolean(null==e?void 0:e.preserve);if("importFrom"in Object(e))throw new Error('[postcss-custom-properties] "importFrom" is no longer supported');if("exportTo"in Object(e))throw new Error('[postcss-custom-properties] "exportTo" is no longer supported');return{postcssPlugin:"postcss-custom-properties",prepare:()=>{let e=new Map;return{Once:n=>{e=getCustomPropertiesFromRoot(n)},Declaration:o=>{let r=e;if(n&&o.parent){let n=!1;o.parent.each((s=>{o!==s&&"decl"===s.type&&s.variable&&!isDeclarationIgnored(s)&&(n||(r=new Map(e),n=!0),"initial"!==s.value.toLowerCase().trim()?r.set(s.prop,t(s.value)):r.delete(s.prop))}))}transformProperties(o,r,{preserve:n})}}}}};creator.postcss=!0,e.exports=creator}};var n={};function __nccwpck_require__(o){var t=n[o];if(t!==undefined){return t.exports}var r=n[o]={exports:{}};var s=true;try{e[o](r,r.exports,__nccwpck_require__);s=false}finally{if(s)delete n[o]}return r.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var o=__nccwpck_require__(292);module.exports=o})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"postcss-custom-properties","author":"Jonathan Neal <jonathantneal@hotmail.com>","version":"
|
|
1
|
+
{"name":"postcss-custom-properties","author":"Jonathan Neal <jonathantneal@hotmail.com>","version":"13.1.5","funding":{"type":"opencollective","url":"https://opencollective.com/csstools"},"license":"MIT","types":"index.d.ts"}
|
package/dist/build.js
CHANGED
|
@@ -1,77 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
var build_exports = {};
|
|
49
|
-
__export(build_exports, {
|
|
50
|
-
build: () => build
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
51
4
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
5
|
+
Object.defineProperty(exports, "build", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => build
|
|
8
|
+
});
|
|
9
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
10
|
+
const _utils = require("@modern-js/utils");
|
|
11
|
+
const debug = (0, _utils.createDebugger)("module-tools");
|
|
12
|
+
const build = async (api, options, context) => {
|
|
56
13
|
if (options.platform) {
|
|
57
|
-
const { buildPlatform } =
|
|
58
|
-
|
|
14
|
+
const { buildPlatform } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./builder/platform")));
|
|
15
|
+
await buildPlatform(options, api, context);
|
|
59
16
|
return;
|
|
60
17
|
}
|
|
61
18
|
const runner = api.useHookRunners();
|
|
62
|
-
const { normalizeBuildConfig } =
|
|
63
|
-
const resolvedBuildConfig =
|
|
19
|
+
const { normalizeBuildConfig } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./config/normalize")));
|
|
20
|
+
const resolvedBuildConfig = await normalizeBuildConfig(api, context, options);
|
|
64
21
|
debug("resolvedBuildConfig", resolvedBuildConfig);
|
|
65
|
-
|
|
22
|
+
await runner.beforeBuild({
|
|
66
23
|
config: resolvedBuildConfig,
|
|
67
24
|
cliOptions: options
|
|
68
25
|
});
|
|
69
|
-
const builder =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
26
|
+
const builder = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./builder")));
|
|
27
|
+
await builder.run({
|
|
28
|
+
cmdOptions: options,
|
|
29
|
+
resolvedBuildConfig,
|
|
30
|
+
context
|
|
31
|
+
}, api);
|
|
32
|
+
};
|
|
76
33
|
|
|
77
34
|
//# sourceMappingURL=build.js.map
|
package/dist/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;+BAMaA;;aAAAA;;;uBALkB;AAG/B,MAAMC,SAAQC,0BAAe;AAEtB,MAAMF,QAAQ,OACnBG,KACAC,SACAC,YACG;AACH,MAAID,QAAQE,UAAU;AACpB,UAAM,EAAEC,cAAa,IAAK,MAAM,iFAAO;AACvC,UAAMA,cAAcH,SAASD,KAAKE;AAClC;EACF;AAEA,QAAMG,SAASL,IAAIM,eAAc;AAEjC,QAAM,EAAEC,qBAAoB,IAAK,MAAM,iFAAO;AAC9C,QAAMC,sBAAsB,MAAMD,qBAAqBP,KAAKE,SAASD;AAErEH,QAAM,uBAAuBU;AAE7B,QAAMH,OAAOI,YAAY;IACvBC,QAAQF;IACRG,YAAYV;EACd;AACA,QAAMW,UAAU,MAAM,iFAAO;AAC7B,QAAMA,QAAQC,IAAI;IAAEC,YAAYb;IAASO;IAAqBN;EAAQ,GAAGF;AAC3E;","names":["build","debug","createDebugger","api","options","context","platform","buildPlatform","runner","useHookRunners","normalizeBuildConfig","resolvedBuildConfig","beforeBuild","config","cliOptions","builder","run","cmdOptions"],"sources":["../src/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/build.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport { createDebugger } from '@modern-js/utils';\nimport type { ModuleTools, ModuleContext, BuildCommandOptions } from './types';\n\nconst debug = createDebugger('module-tools');\n\nexport const build = async (\n api: PluginAPI<ModuleTools>,\n options: BuildCommandOptions,\n context: ModuleContext,\n) => {\n if (options.platform) {\n const { buildPlatform } = await import('./builder/platform');\n await buildPlatform(options, api, context);\n return;\n }\n\n const runner = api.useHookRunners();\n\n const { normalizeBuildConfig } = await import('./config/normalize');\n const resolvedBuildConfig = await normalizeBuildConfig(api, context, options);\n\n debug('resolvedBuildConfig', resolvedBuildConfig);\n\n await runner.beforeBuild({\n config: resolvedBuildConfig,\n cliOptions: options,\n });\n const builder = await import('./builder');\n await builder.run({ cmdOptions: options, resolvedBuildConfig, context }, api);\n};\n"]}
|
package/dist/builder/build.js
CHANGED
|
@@ -1,125 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
25
6
|
for (var name in all)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
return to;
|
|
35
|
-
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
38
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
39
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
40
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
41
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
42
|
-
mod
|
|
43
|
-
));
|
|
44
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
-
var __async = (__this, __arguments, generator) => {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
var fulfilled = (value) => {
|
|
48
|
-
try {
|
|
49
|
-
step(generator.next(value));
|
|
50
|
-
} catch (e) {
|
|
51
|
-
reject(e);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
var rejected = (value) => {
|
|
55
|
-
try {
|
|
56
|
-
step(generator.throw(value));
|
|
57
|
-
} catch (e) {
|
|
58
|
-
reject(e);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
62
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
var build_exports = {};
|
|
66
|
-
__export(build_exports, {
|
|
67
|
-
buildInJsProject: () => buildInJsProject,
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
runBuildTask: () => runBuildTask,
|
|
68
14
|
buildInTsProject: () => buildInTsProject,
|
|
69
|
-
|
|
15
|
+
buildInJsProject: () => buildInJsProject,
|
|
70
16
|
generatorDts: () => generatorDts,
|
|
71
|
-
|
|
17
|
+
buildLib: () => buildLib
|
|
72
18
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const runBuildTask = (options, api) =>
|
|
19
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
20
|
+
const _path = require("path");
|
|
21
|
+
const _logger = require("@modern-js/utils/logger");
|
|
22
|
+
const runBuildTask = async (options, api) => {
|
|
77
23
|
const { buildConfig, context, buildCmdOptions } = options;
|
|
78
24
|
const { appDirectory, isTsProject } = context;
|
|
79
|
-
const { copyTask } =
|
|
80
|
-
|
|
25
|
+
const { copyTask } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./copy")));
|
|
26
|
+
await copyTask(buildConfig, {
|
|
27
|
+
appDirectory,
|
|
28
|
+
watch: buildCmdOptions.watch
|
|
29
|
+
});
|
|
81
30
|
if (isTsProject) {
|
|
82
|
-
|
|
31
|
+
await buildInTsProject(options, api);
|
|
83
32
|
} else {
|
|
84
|
-
|
|
33
|
+
await buildInJsProject(options, api);
|
|
85
34
|
}
|
|
86
|
-
}
|
|
87
|
-
const buildInTsProject = (options, api) =>
|
|
88
|
-
var _a;
|
|
35
|
+
};
|
|
36
|
+
const buildInTsProject = async (options, api) => {
|
|
89
37
|
const { buildConfig, buildCmdOptions } = options;
|
|
90
38
|
const dts = buildCmdOptions.dts ? buildConfig.dts : false;
|
|
91
39
|
const skipBuildLib = buildConfig.dts ? buildConfig.dts.only : false;
|
|
92
|
-
|
|
40
|
+
var _buildCmdOptions_watch;
|
|
41
|
+
const watch = (_buildCmdOptions_watch = buildCmdOptions.watch) !== null && _buildCmdOptions_watch !== void 0 ? _buildCmdOptions_watch : false;
|
|
93
42
|
if (dts === false) {
|
|
94
|
-
!skipBuildLib &&
|
|
43
|
+
!skipBuildLib && await buildLib(buildConfig, api, {
|
|
44
|
+
watch
|
|
45
|
+
});
|
|
95
46
|
} else {
|
|
96
|
-
const tasks = dts.only ? [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
47
|
+
const tasks = dts.only ? [
|
|
48
|
+
generatorDts
|
|
49
|
+
] : [
|
|
50
|
+
buildLib,
|
|
51
|
+
generatorDts
|
|
52
|
+
];
|
|
53
|
+
const { default: pMap } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../../compiled/p-map")));
|
|
54
|
+
await pMap(tasks, async (task) => {
|
|
55
|
+
await task(buildConfig, api, {
|
|
56
|
+
watch,
|
|
57
|
+
dts
|
|
58
|
+
});
|
|
59
|
+
});
|
|
101
60
|
}
|
|
102
|
-
}
|
|
103
|
-
const buildInJsProject = (options, api) =>
|
|
104
|
-
var _a;
|
|
61
|
+
};
|
|
62
|
+
const buildInJsProject = async (options, api) => {
|
|
105
63
|
const { buildConfig, buildCmdOptions } = options;
|
|
106
64
|
const dts = buildCmdOptions.dts ? buildConfig.dts : false;
|
|
107
|
-
|
|
65
|
+
var _buildCmdOptions_watch;
|
|
66
|
+
const watch = (_buildCmdOptions_watch = buildCmdOptions.watch) !== null && _buildCmdOptions_watch !== void 0 ? _buildCmdOptions_watch : false;
|
|
108
67
|
if (dts !== false && dts.only) {
|
|
109
68
|
return;
|
|
110
69
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
70
|
+
await buildLib(buildConfig, api, {
|
|
71
|
+
watch
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const generatorDts = async (config, api, options) => {
|
|
75
|
+
const { runRollup, runTsc } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./dts")));
|
|
115
76
|
const { watch, dts } = options;
|
|
116
77
|
const { buildType, input, sourceDir, alias } = config;
|
|
117
78
|
const { appDirectory } = api.useAppContext();
|
|
118
79
|
const { tsconfigPath, distPath, abortOnError } = dts;
|
|
119
80
|
if (buildType === "bundle") {
|
|
120
|
-
const { getFinalExternals } =
|
|
121
|
-
const finalExternals =
|
|
122
|
-
|
|
81
|
+
const { getFinalExternals } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../utils/builder")));
|
|
82
|
+
const finalExternals = await getFinalExternals(config, {
|
|
83
|
+
appDirectory
|
|
84
|
+
});
|
|
85
|
+
await runRollup(api, {
|
|
123
86
|
distDir: distPath,
|
|
124
87
|
watch,
|
|
125
88
|
externals: finalExternals,
|
|
@@ -128,7 +91,7 @@ const generatorDts = (config, api, options) => __async(void 0, null, function* (
|
|
|
128
91
|
abortOnError
|
|
129
92
|
});
|
|
130
93
|
} else {
|
|
131
|
-
|
|
94
|
+
await runTsc(api, {
|
|
132
95
|
appDirectory,
|
|
133
96
|
alias,
|
|
134
97
|
distAbsPath: distPath,
|
|
@@ -138,70 +101,60 @@ const generatorDts = (config, api, options) => __async(void 0, null, function* (
|
|
|
138
101
|
abortOnError
|
|
139
102
|
});
|
|
140
103
|
}
|
|
141
|
-
}
|
|
142
|
-
const buildLib = (config, api, options) =>
|
|
143
|
-
var _a;
|
|
104
|
+
};
|
|
105
|
+
const buildLib = async (config, api, options) => {
|
|
144
106
|
const { watch } = options;
|
|
145
|
-
const {
|
|
146
|
-
target,
|
|
147
|
-
buildType,
|
|
148
|
-
sourceMap,
|
|
149
|
-
format,
|
|
150
|
-
outDir: distPath,
|
|
151
|
-
asset,
|
|
152
|
-
jsx,
|
|
153
|
-
input,
|
|
154
|
-
platform,
|
|
155
|
-
splitting,
|
|
156
|
-
minify,
|
|
157
|
-
sourceDir,
|
|
158
|
-
umdGlobals,
|
|
159
|
-
umdModuleName,
|
|
160
|
-
define,
|
|
161
|
-
alias,
|
|
162
|
-
style,
|
|
163
|
-
externals,
|
|
164
|
-
autoExternal,
|
|
165
|
-
dts,
|
|
166
|
-
metafile,
|
|
167
|
-
sideEffects,
|
|
168
|
-
redirect,
|
|
169
|
-
esbuildOptions
|
|
170
|
-
} = config;
|
|
107
|
+
const { target, buildType, sourceMap, format, outDir: distPath, asset, jsx, input, platform, splitting, minify, sourceDir, umdGlobals, umdModuleName, define, alias, style, externals, autoExternal, dts, metafile, sideEffects, redirect, esbuildOptions, externalHelpers, transformImport, sourceType, disableSwcTransform } = config;
|
|
171
108
|
const { appDirectory } = api.useAppContext();
|
|
172
|
-
const { slash } =
|
|
109
|
+
const { slash } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
|
|
173
110
|
const root = slash(appDirectory);
|
|
174
111
|
const outdir = slash(distPath);
|
|
175
112
|
const assetOutDir = asset.path ? slash(asset.path) : asset.path;
|
|
176
113
|
const { less, sass, postcss, inject, modules, autoModules } = style;
|
|
177
|
-
const {
|
|
178
|
-
const
|
|
179
|
-
|
|
114
|
+
const { umdPlugin, swcTransformPlugin, es5Plugin } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/libuild-plugin-swc")));
|
|
115
|
+
const { checkSwcHelpers, matchEs5PluginCondition, matchSwcTransformCondition } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../utils/builder")));
|
|
116
|
+
const { getProjectTsconfig } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./dts/tsc")));
|
|
117
|
+
const tsconfigPath = dts ? dts.tsconfigPath : (0, _path.join)(appDirectory, "./tsconfig.json");
|
|
118
|
+
const userTsconfig = await getProjectTsconfig(tsconfigPath);
|
|
119
|
+
const plugins = [];
|
|
120
|
+
if (matchSwcTransformCondition({
|
|
121
|
+
sourceType,
|
|
122
|
+
buildType,
|
|
123
|
+
format,
|
|
124
|
+
disableSwcTransform
|
|
125
|
+
})) {
|
|
126
|
+
var _userTsconfig_compilerOptions;
|
|
127
|
+
plugins.push(swcTransformPlugin({
|
|
128
|
+
pluginImport: transformImport,
|
|
129
|
+
externalHelpers: Boolean(externalHelpers),
|
|
130
|
+
emitDecoratorMetadata: userTsconfig === null || userTsconfig === void 0 ? void 0 : (_userTsconfig_compilerOptions = userTsconfig.compilerOptions) === null || _userTsconfig_compilerOptions === void 0 ? void 0 : _userTsconfig_compilerOptions.emitDecoratorMetadata
|
|
131
|
+
}));
|
|
132
|
+
} else if (matchEs5PluginCondition({
|
|
133
|
+
sourceType,
|
|
134
|
+
buildType,
|
|
135
|
+
format,
|
|
136
|
+
target,
|
|
137
|
+
disableSwcTransform
|
|
138
|
+
})) {
|
|
180
139
|
plugins.push(es5Plugin());
|
|
181
140
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const userTsconfig = yield getProjectTsconfig(tsconfigPath);
|
|
185
|
-
if ((_a = userTsconfig == null ? void 0 : userTsconfig.compilerOptions) == null ? void 0 : _a.emitDecoratorMetadata) {
|
|
186
|
-
plugins.push(
|
|
187
|
-
transformPlugin({
|
|
188
|
-
jsc: {
|
|
189
|
-
transform: {
|
|
190
|
-
legacyDecorator: true,
|
|
191
|
-
decoratorMetadata: true
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
})
|
|
195
|
-
);
|
|
141
|
+
if (format === "umd") {
|
|
142
|
+
plugins.push(umdPlugin(umdModuleName));
|
|
196
143
|
}
|
|
144
|
+
await checkSwcHelpers({
|
|
145
|
+
appDirectory,
|
|
146
|
+
externalHelpers
|
|
147
|
+
});
|
|
197
148
|
if (asset.svgr) {
|
|
198
|
-
const { svgrPlugin } =
|
|
149
|
+
const { svgrPlugin } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/libuild-plugin-svgr")));
|
|
199
150
|
const options2 = typeof asset.svgr === "boolean" ? {} : asset.svgr;
|
|
200
151
|
plugins.push(svgrPlugin(options2));
|
|
201
152
|
}
|
|
202
|
-
const { watchPlugin, externalPlugin } =
|
|
153
|
+
const { watchPlugin, externalPlugin } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../utils/libuildPlugins")));
|
|
203
154
|
plugins.push(watchPlugin(api, config));
|
|
204
|
-
plugins.push(externalPlugin(config, {
|
|
155
|
+
plugins.push(externalPlugin(config, {
|
|
156
|
+
appDirectory
|
|
157
|
+
}));
|
|
205
158
|
const buildConfig = {
|
|
206
159
|
root,
|
|
207
160
|
watch,
|
|
@@ -221,9 +174,10 @@ const buildLib = (config, api, options) => __async(void 0, null, function* () {
|
|
|
221
174
|
resolve: {
|
|
222
175
|
alias
|
|
223
176
|
},
|
|
224
|
-
asset:
|
|
177
|
+
asset: {
|
|
178
|
+
...asset,
|
|
225
179
|
outdir: assetOutDir
|
|
226
|
-
}
|
|
180
|
+
},
|
|
227
181
|
plugins,
|
|
228
182
|
jsx,
|
|
229
183
|
input,
|
|
@@ -243,39 +197,29 @@ const buildLib = (config, api, options) => __async(void 0, null, function* () {
|
|
|
243
197
|
esbuildOptions
|
|
244
198
|
};
|
|
245
199
|
try {
|
|
246
|
-
const { Libuilder } =
|
|
247
|
-
const { addOutputChunk } =
|
|
200
|
+
const { Libuilder } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/libuild")));
|
|
201
|
+
const { addOutputChunk } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../utils/print")));
|
|
248
202
|
const runner = api.useHookRunners();
|
|
249
|
-
const modifiedBuildConfig =
|
|
203
|
+
const modifiedBuildConfig = await runner.modifyLibuild(buildConfig, {
|
|
250
204
|
onLast: (c) => c
|
|
251
205
|
});
|
|
252
|
-
const builder =
|
|
253
|
-
|
|
206
|
+
const builder = await Libuilder.create(modifiedBuildConfig);
|
|
207
|
+
await builder.build();
|
|
254
208
|
addOutputChunk(builder.outputChunk, root, buildType === "bundle");
|
|
255
209
|
if (watch) {
|
|
256
|
-
const { watchSectionTitle } =
|
|
257
|
-
const { SectionTitleStatus } =
|
|
210
|
+
const { watchSectionTitle } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../utils/log")));
|
|
211
|
+
const { SectionTitleStatus } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../constants/log")));
|
|
258
212
|
const titleText = `[${buildType === "bundle" ? "Bundle" : "Bundleless"}: ${format}_${target}]`;
|
|
259
|
-
|
|
260
|
-
yield watchSectionTitle(titleText, SectionTitleStatus.Success)
|
|
261
|
-
);
|
|
213
|
+
_logger.logger.info(await watchSectionTitle(titleText, SectionTitleStatus.Success));
|
|
262
214
|
}
|
|
263
215
|
} catch (e) {
|
|
264
|
-
const { InternalBuildError } =
|
|
216
|
+
const { InternalBuildError } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../error")));
|
|
265
217
|
throw new InternalBuildError(e, {
|
|
266
218
|
target,
|
|
267
219
|
format,
|
|
268
220
|
buildType
|
|
269
221
|
});
|
|
270
222
|
}
|
|
271
|
-
}
|
|
272
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
273
|
-
0 && (module.exports = {
|
|
274
|
-
buildInJsProject,
|
|
275
|
-
buildInTsProject,
|
|
276
|
-
buildLib,
|
|
277
|
-
generatorDts,
|
|
278
|
-
runBuildTask
|
|
279
|
-
});
|
|
223
|
+
};
|
|
280
224
|
|
|
281
225
|
//# sourceMappingURL=build.js.map
|