@modern-js/builder 3.0.0 → 3.0.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.
@@ -30,33 +30,11 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  pluginPostcss: ()=>pluginPostcss
31
31
  });
32
32
  const external_node_module_namespaceObject = require("node:module");
33
- const external_node_url_namespaceObject = require("node:url");
34
33
  const utils_namespaceObject = require("@modern-js/utils");
34
+ const core_namespaceObject = require("@rsbuild/core");
35
35
  const getCssSupport_js_namespaceObject = require("../shared/getCssSupport.js");
36
36
  const postcss_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
37
37
  const importPostcssPlugin = (name)=>Promise.resolve(postcss_require(name));
38
- const userPostcssrcCache = new Map();
39
- const clonePostCSSConfig = (config)=>({
40
- ...config,
41
- plugins: config.plugins ? [
42
- ...config.plugins
43
- ] : void 0
44
- });
45
- async function loadUserPostcssrc(root) {
46
- const cached = userPostcssrcCache.get(root);
47
- if (cached) return clonePostCSSConfig(await cached);
48
- const compiledPath = postcss_require.resolve('../../compiled/postcss-load-config');
49
- const { default: postcssrc } = await import((0, external_node_url_namespaceObject.pathToFileURL)(compiledPath).href);
50
- const promise = postcssrc({}, root).catch((err)=>{
51
- if (err.message?.includes('No PostCSS Config found')) return {};
52
- throw err;
53
- });
54
- userPostcssrcCache.set(root, promise);
55
- return promise.then((config)=>{
56
- userPostcssrcCache.set(root, config);
57
- return clonePostCSSConfig(config);
58
- });
59
- }
60
38
  const pluginPostcss = (options = {})=>({
61
39
  name: 'builder:postcss-plugins',
62
40
  pre: [
@@ -92,17 +70,16 @@ const pluginPostcss = (options = {})=>({
92
70
  overrideBrowserslist: config.output.overrideBrowserslist
93
71
  }, autoprefixer)))
94
72
  ]).then((results)=>results.filter(Boolean));
95
- const userOptions = await loadUserPostcssrc(api.context.rootPath);
96
73
  return mergeEnvironmentConfig({
97
74
  tools: {
98
- postcss: {
99
- postcssOptions: {
100
- ...userOptions,
101
- plugins: [
102
- ...userOptions.plugins || [],
103
- ...plugins
104
- ]
75
+ postcss: (opts)=>{
76
+ if ('function' == typeof opts.postcssOptions) {
77
+ core_namespaceObject.logger.warn('unexpected function type postcssOptions, the default postcss plugins will not be applied.');
78
+ return opts;
105
79
  }
80
+ opts.postcssOptions ??= {};
81
+ opts.postcssOptions.plugins ??= [];
82
+ opts.postcssOptions.plugins.push(...plugins);
106
83
  }
107
84
  }
108
85
  }, config);
@@ -1,31 +1,9 @@
1
1
  import { createRequire } from "node:module";
2
- import { pathToFileURL } from "node:url";
3
2
  import { applyOptionsChain, isProd } from "@modern-js/utils";
3
+ import { logger } from "@rsbuild/core";
4
4
  import { getCssSupport } from "../shared/getCssSupport.mjs";
5
5
  const postcss_require = createRequire(import.meta.url);
6
6
  const importPostcssPlugin = (name)=>Promise.resolve(postcss_require(name));
7
- const userPostcssrcCache = new Map();
8
- const clonePostCSSConfig = (config)=>({
9
- ...config,
10
- plugins: config.plugins ? [
11
- ...config.plugins
12
- ] : void 0
13
- });
14
- async function loadUserPostcssrc(root) {
15
- const cached = userPostcssrcCache.get(root);
16
- if (cached) return clonePostCSSConfig(await cached);
17
- const compiledPath = postcss_require.resolve('../../compiled/postcss-load-config');
18
- const { default: postcssrc } = await import(pathToFileURL(compiledPath).href);
19
- const promise = postcssrc({}, root).catch((err)=>{
20
- if (err.message?.includes('No PostCSS Config found')) return {};
21
- throw err;
22
- });
23
- userPostcssrcCache.set(root, promise);
24
- return promise.then((config)=>{
25
- userPostcssrcCache.set(root, config);
26
- return clonePostCSSConfig(config);
27
- });
28
- }
29
7
  const pluginPostcss = (options = {})=>({
30
8
  name: 'builder:postcss-plugins',
31
9
  pre: [
@@ -61,17 +39,16 @@ const pluginPostcss = (options = {})=>({
61
39
  overrideBrowserslist: config.output.overrideBrowserslist
62
40
  }, autoprefixer)))
63
41
  ]).then((results)=>results.filter(Boolean));
64
- const userOptions = await loadUserPostcssrc(api.context.rootPath);
65
42
  return mergeEnvironmentConfig({
66
43
  tools: {
67
- postcss: {
68
- postcssOptions: {
69
- ...userOptions,
70
- plugins: [
71
- ...userOptions.plugins || [],
72
- ...plugins
73
- ]
44
+ postcss: (opts)=>{
45
+ if ('function' == typeof opts.postcssOptions) {
46
+ logger.warn('unexpected function type postcssOptions, the default postcss plugins will not be applied.');
47
+ return opts;
74
48
  }
49
+ opts.postcssOptions ??= {};
50
+ opts.postcssOptions.plugins ??= [];
51
+ opts.postcssOptions.plugins.push(...plugins);
75
52
  }
76
53
  }
77
54
  }, config);
@@ -1,32 +1,10 @@
1
1
  import "node:module";
2
2
  import { createRequire } from "node:module";
3
- import { pathToFileURL } from "node:url";
4
3
  import { applyOptionsChain, isProd } from "@modern-js/utils";
4
+ import { logger } from "@rsbuild/core";
5
5
  import { getCssSupport } from "../shared/getCssSupport.mjs";
6
6
  const postcss_require = createRequire(import.meta.url);
7
7
  const importPostcssPlugin = (name)=>Promise.resolve(postcss_require(name));
8
- const userPostcssrcCache = new Map();
9
- const clonePostCSSConfig = (config)=>({
10
- ...config,
11
- plugins: config.plugins ? [
12
- ...config.plugins
13
- ] : void 0
14
- });
15
- async function loadUserPostcssrc(root) {
16
- const cached = userPostcssrcCache.get(root);
17
- if (cached) return clonePostCSSConfig(await cached);
18
- const compiledPath = postcss_require.resolve('../../compiled/postcss-load-config');
19
- const { default: postcssrc } = await import(pathToFileURL(compiledPath).href);
20
- const promise = postcssrc({}, root).catch((err)=>{
21
- if (err.message?.includes('No PostCSS Config found')) return {};
22
- throw err;
23
- });
24
- userPostcssrcCache.set(root, promise);
25
- return promise.then((config)=>{
26
- userPostcssrcCache.set(root, config);
27
- return clonePostCSSConfig(config);
28
- });
29
- }
30
8
  const pluginPostcss = (options = {})=>({
31
9
  name: 'builder:postcss-plugins',
32
10
  pre: [
@@ -62,17 +40,16 @@ const pluginPostcss = (options = {})=>({
62
40
  overrideBrowserslist: config.output.overrideBrowserslist
63
41
  }, autoprefixer)))
64
42
  ]).then((results)=>results.filter(Boolean));
65
- const userOptions = await loadUserPostcssrc(api.context.rootPath);
66
43
  return mergeEnvironmentConfig({
67
44
  tools: {
68
- postcss: {
69
- postcssOptions: {
70
- ...userOptions,
71
- plugins: [
72
- ...userOptions.plugins || [],
73
- ...plugins
74
- ]
45
+ postcss: (opts)=>{
46
+ if ('function' == typeof opts.postcssOptions) {
47
+ logger.warn('unexpected function type postcssOptions, the default postcss plugins will not be applied.');
48
+ return opts;
75
49
  }
50
+ opts.postcssOptions ??= {};
51
+ opts.postcssOptions.plugins ??= [];
52
+ opts.postcssOptions.plugins.push(...plugins);
76
53
  }
77
54
  }
78
55
  }, config);
@@ -1,4 +1,4 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
1
+ import { type RsbuildPlugin } from '@rsbuild/core';
2
2
  import type { ToolsAutoprefixerConfig } from '../types';
3
3
  export interface PluginPostcssOptions {
4
4
  autoprefixer?: ToolsAutoprefixerConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/builder",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "A builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "dist"
27
27
  ],
28
28
  "dependencies": {
29
- "@rsbuild/core": "2.0.0-beta.1",
29
+ "@rsbuild/core": "2.0.0-beta.2",
30
30
  "@rsbuild/plugin-assets-retry": "1.5.1",
31
31
  "@rsbuild/plugin-check-syntax": "1.6.1",
32
32
  "@rsbuild/plugin-css-minimizer": "1.1.1",
@@ -56,9 +56,8 @@
56
56
  "postcss-page-break": "3.0.4",
57
57
  "rspack-manifest-plugin": "5.2.1",
58
58
  "ts-deepmerge": "7.0.3",
59
- "jiti": "^2.6.1",
60
- "@modern-js/flight-server-transform-plugin": "3.0.0",
61
- "@modern-js/utils": "3.0.0"
59
+ "@modern-js/flight-server-transform-plugin": "3.0.1",
60
+ "@modern-js/utils": "3.0.1"
62
61
  },
63
62
  "devDependencies": {
64
63
  "@rslib/core": "0.19.4",
@@ -68,7 +67,7 @@
68
67
  "terser": "^5.46.0",
69
68
  "typescript": "^5.3.0",
70
69
  "@modern-js/rslib": "2.68.10",
71
- "@modern-js/types": "3.0.0",
70
+ "@modern-js/types": "3.0.1",
72
71
  "@scripts/rstest-config": "2.66.0"
73
72
  },
74
73
  "publishConfig": {
@@ -1 +0,0 @@
1
- export = any;
@@ -1,14 +0,0 @@
1
- (()=>{var __webpack_modules__={920:(module,__unused_webpack_exports,__nccwpck_require__)=>{const path=__nccwpck_require__(928);const fs=__nccwpck_require__(896);const os=__nccwpck_require__(857);const url=__nccwpck_require__(16);const fsReadFileAsync=fs.promises.readFile;function getDefaultSearchPlaces(e,t){return["package.json",`.${e}rc.json`,`.${e}rc.js`,`.${e}rc.cjs`,...t?[]:[`.${e}rc.mjs`],`.config/${e}rc`,`.config/${e}rc.json`,`.config/${e}rc.js`,`.config/${e}rc.cjs`,...t?[]:[`.config/${e}rc.mjs`],`${e}.config.js`,`${e}.config.cjs`,...t?[]:[`${e}.config.mjs`]]}function parentDir(e){return path.dirname(e)||path.sep}const jsonLoader=(e,t)=>JSON.parse(t);const requireFunc=true?eval("require"):0;const defaultLoadersSync=Object.freeze({".js":requireFunc,".json":requireFunc,".cjs":requireFunc,noExt:jsonLoader});module.exports.defaultLoadersSync=defaultLoadersSync;const dynamicImport=async e=>{try{const t=url.pathToFileURL(e).href;const r=await import(t);return r.default}catch(t){try{return requireFunc(e)}catch(e){if(e.code==="ERR_REQUIRE_ESM"||e instanceof SyntaxError&&e.toString().includes("Cannot use import statement outside a module")){throw t}throw e}}};const defaultLoaders=Object.freeze({".js":dynamicImport,".mjs":dynamicImport,".cjs":dynamicImport,".json":jsonLoader,noExt:jsonLoader});module.exports.defaultLoaders=defaultLoaders;function getOptions(e,t,r){const n={stopDir:os.homedir(),searchPlaces:getDefaultSearchPlaces(e,r),ignoreEmptySearchPlaces:true,cache:true,transform:e=>e,packageProp:[e],...t,loaders:{...r?defaultLoadersSync:defaultLoaders,...t.loaders}};n.searchPlaces.forEach((e=>{const t=path.extname(e)||"noExt";const r=n.loaders[t];if(!r){throw new Error(`Missing loader for extension "${e}"`)}if(typeof r!=="function"){throw new Error(`Loader for extension "${e}" is not a function: Received ${typeof r}.`)}}));return n}function getPackageProp(e,t){if(typeof e==="string"&&e in t)return t[e];return(Array.isArray(e)?e:e.split(".")).reduce(((e,t)=>e===undefined?e:e[t]),t)||null}function validateFilePath(e){if(!e)throw new Error("load must pass a non-empty string")}function validateLoader(e,t){if(!e)throw new Error(`No loader specified for extension "${t}"`);if(typeof e!=="function")throw new Error("loader is not a function")}const makeEmplace=e=>(t,r,n)=>{if(e)t.set(r,n);return n};module.exports.lilconfig=function lilconfig(e,t){const{ignoreEmptySearchPlaces:r,loaders:n,packageProp:o,searchPlaces:a,stopDir:s,transform:c,cache:i}=getOptions(e,t??{},false);const f=new Map;const l=new Map;const u=makeEmplace(i);return{async search(e=process.cwd()){const t={config:null,filepath:""};const l=new Set;let u=e;e:while(true){if(i){const e=f.get(u);if(e!==undefined){for(const t of l)f.set(t,e);return e}l.add(u)}for(const e of a){const a=path.join(u,e);try{await fs.promises.access(a)}catch{continue}const s=String(await fsReadFileAsync(a));const c=path.extname(e)||"noExt";const i=n[c];if(e==="package.json"){const e=await i(a,s);const r=getPackageProp(o,e);if(r!=null){t.config=r;t.filepath=a;break e}continue}const f=s.trim()==="";if(f&&r)continue;if(f){t.isEmpty=true;t.config=undefined}else{validateLoader(i,c);t.config=await i(a,s)}t.filepath=a;break e}if(u===s||u===parentDir(u))break e;u=parentDir(u)}const p=t.filepath===""&&t.config===null?c(null):c(t);if(i){for(const e of l)f.set(e,p)}return p},async load(e){validateFilePath(e);const t=path.resolve(process.cwd(),e);if(i&&l.has(t)){return l.get(t)}const{base:a,ext:s}=path.parse(t);const f=s||"noExt";const p=n[f];validateLoader(p,f);const d=String(await fsReadFileAsync(t));if(a==="package.json"){const e=await p(t,d);return u(l,t,c({config:getPackageProp(o,e),filepath:t}))}const _={config:null,filepath:t};const g=d.trim()==="";if(g&&r)return u(l,t,c({config:undefined,filepath:t,isEmpty:true}));_.config=g?undefined:await p(t,d);return u(l,t,c(g?{..._,isEmpty:g,config:undefined}:_))},clearLoadCache(){if(i)l.clear()},clearSearchCache(){if(i)f.clear()},clearCaches(){if(i){l.clear();f.clear()}}}};module.exports.lilconfigSync=function lilconfigSync(e,t){const{ignoreEmptySearchPlaces:r,loaders:n,packageProp:o,searchPlaces:a,stopDir:s,transform:c,cache:i}=getOptions(e,t??{},true);const f=new Map;const l=new Map;const u=makeEmplace(i);return{search(e=process.cwd()){const t={config:null,filepath:""};const l=new Set;let u=e;e:while(true){if(i){const e=f.get(u);if(e!==undefined){for(const t of l)f.set(t,e);return e}l.add(u)}for(const e of a){const a=path.join(u,e);try{fs.accessSync(a)}catch{continue}const s=path.extname(e)||"noExt";const c=n[s];const i=String(fs.readFileSync(a));if(e==="package.json"){const e=c(a,i);const r=getPackageProp(o,e);if(r!=null){t.config=r;t.filepath=a;break e}continue}const f=i.trim()==="";if(f&&r)continue;if(f){t.isEmpty=true;t.config=undefined}else{validateLoader(c,s);t.config=c(a,i)}t.filepath=a;break e}if(u===s||u===parentDir(u))break e;u=parentDir(u)}const p=t.filepath===""&&t.config===null?c(null):c(t);if(i){for(const e of l)f.set(e,p)}return p},load(e){validateFilePath(e);const t=path.resolve(process.cwd(),e);if(i&&l.has(t)){return l.get(t)}const{base:a,ext:s}=path.parse(t);const f=s||"noExt";const p=n[f];validateLoader(p,f);const d=String(fs.readFileSync(t));if(a==="package.json"){const e=p(t,d);return c({config:getPackageProp(o,e),filepath:t})}const _={config:null,filepath:t};const g=d.trim()==="";if(g&&r)return u(l,t,c({filepath:t,config:undefined,isEmpty:true}));_.config=g?undefined:p(t,d);return u(l,t,c(g?{..._,isEmpty:g,config:undefined}:_))},clearLoadCache(){if(i)l.clear()},clearSearchCache(){if(i)f.clear()},clearCaches(){if(i){l.clear();f.clear()}}}}},109:(e,t,r)=>{const{resolve:n}=r(760);const o=r(920);const a=r(471);const s=r(697);const c=r(257);const interopRequireDefault=e=>e&&e.__esModule?e:{default:e};async function processResult(e,t){let r=t.filepath||"";let n=interopRequireDefault(t.config).default||{};if(typeof n==="function"){n=n(e)}else{n=Object.assign({},n,e)}if(!n.plugins){n.plugins=[]}let o={file:r,options:await a(n,r),plugins:await s(n,r)};delete n.plugins;return o}function createContext(e){e=Object.assign({cwd:process.cwd(),env:process.env.NODE_ENV},e);if(!e.env){process.env.NODE_ENV="development"}return e}async function loader(e){return c(e)}let i;async function yamlLoader(e,t){if(!i){try{i=await Promise.resolve().then(r.t.bind(r,160,23))}catch(e){throw new Error(`'yaml' is required for the YAML configuration files. Make sure it is installed\nError: ${e.message}`)}}return i.parse(t)}const withLoaders=(e={})=>{let t="postcss";return{...e,loaders:{...e.loaders,".cjs":loader,".cts":loader,".js":loader,".mjs":loader,".mts":loader,".ts":loader,".yaml":yamlLoader,".yml":yamlLoader},searchPlaces:[...e.searchPlaces||[],"package.json",`.${t}rc`,`.${t}rc.json`,`.${t}rc.yaml`,`.${t}rc.yml`,`.${t}rc.ts`,`.${t}rc.cts`,`.${t}rc.mts`,`.${t}rc.js`,`.${t}rc.cjs`,`.${t}rc.mjs`,`${t}.config.ts`,`${t}.config.cts`,`${t}.config.mts`,`${t}.config.js`,`${t}.config.cjs`,`${t}.config.mjs`]}};function rc(e,t,r){e=createContext(e);t=t?n(t):process.cwd();return o.lilconfig("postcss",withLoaders(r)).search(t).then((r=>{if(!r){throw new Error(`No PostCSS Config found in: ${t}`)}return processResult(e,r)}))}
2
- /**
3
- * Autoload Config for PostCSS
4
- *
5
- * @author Michael Ciniawsky @michael-ciniawsky <michael.ciniawsky@gmail.com>
6
- * @license MIT
7
- *
8
- * @module postcss-load-config
9
- * @version 2.1.0
10
- *
11
- * @requires comsiconfig
12
- * @requires ./options
13
- * @requires ./plugins
14
- */e.exports=rc},471:(e,t,r)=>{const n=r(257);async function options(e,t){if(e.parser&&typeof e.parser==="string"){try{e.parser=await n(e.parser,t)}catch(e){throw new Error(`Loading PostCSS Parser failed: ${e.message}\n\n(@${t})`)}}if(e.syntax&&typeof e.syntax==="string"){try{e.syntax=await n(e.syntax,t)}catch(e){throw new Error(`Loading PostCSS Syntax failed: ${e.message}\n\n(@${t})`)}}if(e.stringifier&&typeof e.stringifier==="string"){try{e.stringifier=await n(e.stringifier,t)}catch(e){throw new Error(`Loading PostCSS Stringifier failed: ${e.message}\n\n(@${t})`)}}return e}e.exports=options},697:(e,t,r)=>{const n=r(257);async function load(e,t,r){try{if(t===null||t===undefined||Object.keys(t).length===0){return await n(e,r)}else{return(await n(e,r))(t)}}catch(e){throw new Error(`Loading PostCSS Plugin failed: ${e.message}\n\n(@${r})`)}}async function plugins(e,t){let r=[];if(Array.isArray(e.plugins)){r=e.plugins.filter(Boolean)}else{r=Object.entries(e.plugins).filter((([,e])=>e!==false)).map((([e,r])=>load(e,r,t)));r=await Promise.all(r)}if(r.length&&r.length>0){r.forEach(((e,r)=>{if(e.default){e=e.default}if(e.postcss===true){e=e()}else if(e.postcss){e=e.postcss}if(!(typeof e==="object"&&Array.isArray(e.plugins)||typeof e==="object"&&e.postcssPlugin||typeof e==="function")){throw new TypeError(`Invalid PostCSS Plugin found at: plugins[${r}]\n\n(@${t})`)}}))}return r}e.exports=plugins},257:(e,t,r)=>{const{createRequire:n}=r(995);const{pathToFileURL:o}=r(136);const a=/\.[mc]?ts$/;let s;let c;let i=[];async function req(e,t=__filename){let r=n(t).resolve(e);try{return(await import(`${o(r)}?t=${Date.now()}`)).default}catch(e){if(!a.test(r)){throw e}}if(s===undefined){try{s=await import("tsx/cjs/api")}catch(e){i.push(e)}}if(s){let r=s.require(e,t);return r&&"__esModule"in r?r.default:r}if(c===undefined){try{c=(await import("jiti")).default}catch(e){i.push(e)}}if(c){return c(t,{interopDefault:true})(e)}throw new Error(`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${i.map((e=>e.message)).join("\n")}`)}e.exports=req},896:e=>{"use strict";e.exports=require("fs")},995:e=>{"use strict";e.exports=require("node:module")},760:e=>{"use strict";e.exports=require("node:path")},136:e=>{"use strict";e.exports=require("node:url")},857:e=>{"use strict";e.exports=require("os")},928:e=>{"use strict";e.exports=require("path")},16:e=>{"use strict";e.exports=require("url")},160:e=>{"use strict";e.exports=require("yaml")}};var __webpack_module_cache__={};function __nccwpck_require__(e){var t=__webpack_module_cache__[e];if(t!==undefined){return t.exports}var r=__webpack_module_cache__[e]={exports:{}};var n=true;try{__webpack_modules__[e](r,r.exports,__nccwpck_require__);n=false}finally{if(n)delete __webpack_module_cache__[e]}return r.exports}(()=>{var e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;var t;__nccwpck_require__.t=function(r,n){if(n&1)r=this(r);if(n&8)return r;if(typeof r==="object"&&r){if(n&4&&r.__esModule)return r;if(n&16&&typeof r.then==="function")return r}var o=Object.create(null);__nccwpck_require__.r(o);var a={};t=t||[null,e({}),e([]),e(e)];for(var s=n&2&&r;typeof s=="object"&&!~t.indexOf(s);s=e(s)){Object.getOwnPropertyNames(s).forEach((e=>a[e]=()=>r[e]))}a["default"]=()=>r;__nccwpck_require__.d(o,a);return o}})();(()=>{__nccwpck_require__.d=(e,t)=>{for(var r in t){if(__nccwpck_require__.o(t,r)&&!__nccwpck_require__.o(e,r)){Object.defineProperty(e,r,{enumerable:true,get:t[r]})}}}})();(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__=__nccwpck_require__(109);module.exports=__webpack_exports__})();
@@ -1,20 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright Michael Ciniawsky <michael.ciniawsky@gmail.com>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1 +0,0 @@
1
- {"name":"postcss-load-config","author":"Michael Ciniawky <michael.ciniawsky@gmail.com>","version":"6.0.1","funding":[{"type":"opencollective","url":"https://opencollective.com/postcss/"},{"type":"github","url":"https://github.com/sponsors/ai"}],"license":"MIT","types":"index.d.ts"}
@@ -1 +0,0 @@
1
- export = any;
@@ -1,608 +0,0 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- (()=>{
3
- var __webpack_modules__ = {
4
- 920: (module1, __unused_webpack_exports, __nccwpck_require__)=>{
5
- const path = __nccwpck_require__(928);
6
- const fs = __nccwpck_require__(896);
7
- const os = __nccwpck_require__(857);
8
- const url = __nccwpck_require__(16);
9
- const fsReadFileAsync = fs.promises.readFile;
10
- function getDefaultSearchPlaces(e, t) {
11
- return [
12
- "package.json",
13
- `.${e}rc.json`,
14
- `.${e}rc.js`,
15
- `.${e}rc.cjs`,
16
- ...t ? [] : [
17
- `.${e}rc.mjs`
18
- ],
19
- `.config/${e}rc`,
20
- `.config/${e}rc.json`,
21
- `.config/${e}rc.js`,
22
- `.config/${e}rc.cjs`,
23
- ...t ? [] : [
24
- `.config/${e}rc.mjs`
25
- ],
26
- `${e}.config.js`,
27
- `${e}.config.cjs`,
28
- ...t ? [] : [
29
- `${e}.config.mjs`
30
- ]
31
- ];
32
- }
33
- function parentDir(e) {
34
- return path.dirname(e) || path.sep;
35
- }
36
- const jsonLoader = (e, t)=>JSON.parse(t);
37
- const requireFunc = eval("require");
38
- const defaultLoadersSync = Object.freeze({
39
- ".js": requireFunc,
40
- ".json": requireFunc,
41
- ".cjs": requireFunc,
42
- noExt: jsonLoader
43
- });
44
- module1.exports.defaultLoadersSync = defaultLoadersSync;
45
- const dynamicImport = async (e)=>{
46
- try {
47
- const t = url.pathToFileURL(e).href;
48
- const r = await import(t);
49
- return r.default;
50
- } catch (t) {
51
- try {
52
- return requireFunc(e);
53
- } catch (e) {
54
- if ("ERR_REQUIRE_ESM" === e.code || e instanceof SyntaxError && e.toString().includes("Cannot use import statement outside a module")) throw t;
55
- throw e;
56
- }
57
- }
58
- };
59
- const defaultLoaders = Object.freeze({
60
- ".js": dynamicImport,
61
- ".mjs": dynamicImport,
62
- ".cjs": dynamicImport,
63
- ".json": jsonLoader,
64
- noExt: jsonLoader
65
- });
66
- module1.exports.defaultLoaders = defaultLoaders;
67
- function getOptions(e, t, r) {
68
- const n = {
69
- stopDir: os.homedir(),
70
- searchPlaces: getDefaultSearchPlaces(e, r),
71
- ignoreEmptySearchPlaces: true,
72
- cache: true,
73
- transform: (e)=>e,
74
- packageProp: [
75
- e
76
- ],
77
- ...t,
78
- loaders: {
79
- ...r ? defaultLoadersSync : defaultLoaders,
80
- ...t.loaders
81
- }
82
- };
83
- n.searchPlaces.forEach((e)=>{
84
- const t = path.extname(e) || "noExt";
85
- const r = n.loaders[t];
86
- if (!r) throw new Error(`Missing loader for extension "${e}"`);
87
- if ("function" != typeof r) throw new Error(`Loader for extension "${e}" is not a function: Received ${typeof r}.`);
88
- });
89
- return n;
90
- }
91
- function getPackageProp(e, t) {
92
- if ("string" == typeof e && e in t) return t[e];
93
- return (Array.isArray(e) ? e : e.split(".")).reduce((e, t)=>void 0 === e ? e : e[t], t) || null;
94
- }
95
- function validateFilePath(e) {
96
- if (!e) throw new Error("load must pass a non-empty string");
97
- }
98
- function validateLoader(e, t) {
99
- if (!e) throw new Error(`No loader specified for extension "${t}"`);
100
- if ("function" != typeof e) throw new Error("loader is not a function");
101
- }
102
- const makeEmplace = (e)=>(t, r, n)=>{
103
- if (e) t.set(r, n);
104
- return n;
105
- };
106
- module1.exports.lilconfig = function(e, t) {
107
- const { ignoreEmptySearchPlaces: r, loaders: n, packageProp: o, searchPlaces: a, stopDir: s, transform: c, cache: i } = getOptions(e, t ?? {}, false);
108
- const f = new Map;
109
- const l = new Map;
110
- const u = makeEmplace(i);
111
- return {
112
- async search (e = process.cwd()) {
113
- const t = {
114
- config: null,
115
- filepath: ""
116
- };
117
- const l = new Set;
118
- let u = e;
119
- e: while(true){
120
- if (i) {
121
- const e = f.get(u);
122
- if (void 0 !== e) {
123
- for (const t of l)f.set(t, e);
124
- return e;
125
- }
126
- l.add(u);
127
- }
128
- for (const e of a){
129
- const a = path.join(u, e);
130
- try {
131
- await fs.promises.access(a);
132
- } catch {
133
- continue;
134
- }
135
- const s = String(await fsReadFileAsync(a));
136
- const c = path.extname(e) || "noExt";
137
- const i = n[c];
138
- if ("package.json" === e) {
139
- const e = await i(a, s);
140
- const r = getPackageProp(o, e);
141
- if (null != r) {
142
- t.config = r;
143
- t.filepath = a;
144
- break e;
145
- }
146
- continue;
147
- }
148
- const f = "" === s.trim();
149
- if (!f || !r) {
150
- if (f) {
151
- t.isEmpty = true;
152
- t.config = void 0;
153
- } else {
154
- validateLoader(i, c);
155
- t.config = await i(a, s);
156
- }
157
- t.filepath = a;
158
- break e;
159
- }
160
- }
161
- if (u === s || u === parentDir(u)) break;
162
- u = parentDir(u);
163
- }
164
- const p = "" === t.filepath && null === t.config ? c(null) : c(t);
165
- if (i) for (const e of l)f.set(e, p);
166
- return p;
167
- },
168
- async load (e) {
169
- validateFilePath(e);
170
- const t = path.resolve(process.cwd(), e);
171
- if (i && l.has(t)) return l.get(t);
172
- const { base: a, ext: s } = path.parse(t);
173
- const f = s || "noExt";
174
- const p = n[f];
175
- validateLoader(p, f);
176
- const d = String(await fsReadFileAsync(t));
177
- if ("package.json" === a) {
178
- const e = await p(t, d);
179
- return u(l, t, c({
180
- config: getPackageProp(o, e),
181
- filepath: t
182
- }));
183
- }
184
- const _ = {
185
- config: null,
186
- filepath: t
187
- };
188
- const g = "" === d.trim();
189
- if (g && r) return u(l, t, c({
190
- config: void 0,
191
- filepath: t,
192
- isEmpty: true
193
- }));
194
- _.config = g ? void 0 : await p(t, d);
195
- return u(l, t, c(g ? {
196
- ..._,
197
- isEmpty: g,
198
- config: void 0
199
- } : _));
200
- },
201
- clearLoadCache () {
202
- if (i) l.clear();
203
- },
204
- clearSearchCache () {
205
- if (i) f.clear();
206
- },
207
- clearCaches () {
208
- if (i) {
209
- l.clear();
210
- f.clear();
211
- }
212
- }
213
- };
214
- };
215
- module1.exports.lilconfigSync = function(e, t) {
216
- const { ignoreEmptySearchPlaces: r, loaders: n, packageProp: o, searchPlaces: a, stopDir: s, transform: c, cache: i } = getOptions(e, t ?? {}, true);
217
- const f = new Map;
218
- const l = new Map;
219
- const u = makeEmplace(i);
220
- return {
221
- search (e = process.cwd()) {
222
- const t = {
223
- config: null,
224
- filepath: ""
225
- };
226
- const l = new Set;
227
- let u = e;
228
- e: while(true){
229
- if (i) {
230
- const e = f.get(u);
231
- if (void 0 !== e) {
232
- for (const t of l)f.set(t, e);
233
- return e;
234
- }
235
- l.add(u);
236
- }
237
- for (const e of a){
238
- const a = path.join(u, e);
239
- try {
240
- fs.accessSync(a);
241
- } catch {
242
- continue;
243
- }
244
- const s = path.extname(e) || "noExt";
245
- const c = n[s];
246
- const i = String(fs.readFileSync(a));
247
- if ("package.json" === e) {
248
- const e = c(a, i);
249
- const r = getPackageProp(o, e);
250
- if (null != r) {
251
- t.config = r;
252
- t.filepath = a;
253
- break e;
254
- }
255
- continue;
256
- }
257
- const f = "" === i.trim();
258
- if (!f || !r) {
259
- if (f) {
260
- t.isEmpty = true;
261
- t.config = void 0;
262
- } else {
263
- validateLoader(c, s);
264
- t.config = c(a, i);
265
- }
266
- t.filepath = a;
267
- break e;
268
- }
269
- }
270
- if (u === s || u === parentDir(u)) break;
271
- u = parentDir(u);
272
- }
273
- const p = "" === t.filepath && null === t.config ? c(null) : c(t);
274
- if (i) for (const e of l)f.set(e, p);
275
- return p;
276
- },
277
- load (e) {
278
- validateFilePath(e);
279
- const t = path.resolve(process.cwd(), e);
280
- if (i && l.has(t)) return l.get(t);
281
- const { base: a, ext: s } = path.parse(t);
282
- const f = s || "noExt";
283
- const p = n[f];
284
- validateLoader(p, f);
285
- const d = String(fs.readFileSync(t));
286
- if ("package.json" === a) {
287
- const e = p(t, d);
288
- return c({
289
- config: getPackageProp(o, e),
290
- filepath: t
291
- });
292
- }
293
- const _ = {
294
- config: null,
295
- filepath: t
296
- };
297
- const g = "" === d.trim();
298
- if (g && r) return u(l, t, c({
299
- filepath: t,
300
- config: void 0,
301
- isEmpty: true
302
- }));
303
- _.config = g ? void 0 : p(t, d);
304
- return u(l, t, c(g ? {
305
- ..._,
306
- isEmpty: g,
307
- config: void 0
308
- } : _));
309
- },
310
- clearLoadCache () {
311
- if (i) l.clear();
312
- },
313
- clearSearchCache () {
314
- if (i) f.clear();
315
- },
316
- clearCaches () {
317
- if (i) {
318
- l.clear();
319
- f.clear();
320
- }
321
- }
322
- };
323
- };
324
- },
325
- 109: (e, t, r)=>{
326
- const { resolve: n } = r(760);
327
- const o = r(920);
328
- const a = r(471);
329
- const s = r(697);
330
- const c = r(257);
331
- const interopRequireDefault = (e)=>e && e.__esModule ? e : {
332
- default: e
333
- };
334
- async function processResult(e, t) {
335
- let r = t.filepath || "";
336
- let n = interopRequireDefault(t.config).default || {};
337
- n = "function" == typeof n ? n(e) : Object.assign({}, n, e);
338
- if (!n.plugins) n.plugins = [];
339
- let o = {
340
- file: r,
341
- options: await a(n, r),
342
- plugins: await s(n, r)
343
- };
344
- delete n.plugins;
345
- return o;
346
- }
347
- function createContext(e) {
348
- e = Object.assign({
349
- cwd: process.cwd(),
350
- env: process.env.NODE_ENV
351
- }, e);
352
- if (!e.env) process.env.NODE_ENV = "development";
353
- return e;
354
- }
355
- async function loader(e) {
356
- return c(e);
357
- }
358
- let i;
359
- async function yamlLoader(e, t) {
360
- if (!i) try {
361
- i = await Promise.resolve().then(r.t.bind(r, 160, 23));
362
- } catch (e) {
363
- throw new Error(`'yaml' is required for the YAML configuration files. Make sure it is installed\nError: ${e.message}`);
364
- }
365
- return i.parse(t);
366
- }
367
- const withLoaders = (e = {})=>{
368
- let t = "postcss";
369
- return {
370
- ...e,
371
- loaders: {
372
- ...e.loaders,
373
- ".cjs": loader,
374
- ".cts": loader,
375
- ".js": loader,
376
- ".mjs": loader,
377
- ".mts": loader,
378
- ".ts": loader,
379
- ".yaml": yamlLoader,
380
- ".yml": yamlLoader
381
- },
382
- searchPlaces: [
383
- ...e.searchPlaces || [],
384
- "package.json",
385
- `.${t}rc`,
386
- `.${t}rc.json`,
387
- `.${t}rc.yaml`,
388
- `.${t}rc.yml`,
389
- `.${t}rc.ts`,
390
- `.${t}rc.cts`,
391
- `.${t}rc.mts`,
392
- `.${t}rc.js`,
393
- `.${t}rc.cjs`,
394
- `.${t}rc.mjs`,
395
- `${t}.config.ts`,
396
- `${t}.config.cts`,
397
- `${t}.config.mts`,
398
- `${t}.config.js`,
399
- `${t}.config.cjs`,
400
- `${t}.config.mjs`
401
- ]
402
- };
403
- };
404
- function rc(e, t, r) {
405
- e = createContext(e);
406
- t = t ? n(t) : process.cwd();
407
- return o.lilconfig("postcss", withLoaders(r)).search(t).then((r)=>{
408
- if (!r) throw new Error(`No PostCSS Config found in: ${t}`);
409
- return processResult(e, r);
410
- });
411
- }
412
- /**
413
- * Autoload Config for PostCSS
414
- *
415
- * @author Michael Ciniawsky @michael-ciniawsky <michael.ciniawsky@gmail.com>
416
- * @license MIT
417
- *
418
- * @module postcss-load-config
419
- * @version 2.1.0
420
- *
421
- * @requires comsiconfig
422
- * @requires ./options
423
- * @requires ./plugins
424
- */ e.exports = rc;
425
- },
426
- 471: (e, t, r)=>{
427
- const n = r(257);
428
- async function options(e, t) {
429
- if (e.parser && "string" == typeof e.parser) try {
430
- e.parser = await n(e.parser, t);
431
- } catch (e) {
432
- throw new Error(`Loading PostCSS Parser failed: ${e.message}\n\n(@${t})`);
433
- }
434
- if (e.syntax && "string" == typeof e.syntax) try {
435
- e.syntax = await n(e.syntax, t);
436
- } catch (e) {
437
- throw new Error(`Loading PostCSS Syntax failed: ${e.message}\n\n(@${t})`);
438
- }
439
- if (e.stringifier && "string" == typeof e.stringifier) try {
440
- e.stringifier = await n(e.stringifier, t);
441
- } catch (e) {
442
- throw new Error(`Loading PostCSS Stringifier failed: ${e.message}\n\n(@${t})`);
443
- }
444
- return e;
445
- }
446
- e.exports = options;
447
- },
448
- 697: (e, t, r)=>{
449
- const n = r(257);
450
- async function load(e, t, r) {
451
- try {
452
- if (null == t || 0 === Object.keys(t).length) return await n(e, r);
453
- return (await n(e, r))(t);
454
- } catch (e) {
455
- throw new Error(`Loading PostCSS Plugin failed: ${e.message}\n\n(@${r})`);
456
- }
457
- }
458
- async function plugins(e, t) {
459
- let r = [];
460
- if (Array.isArray(e.plugins)) r = e.plugins.filter(Boolean);
461
- else {
462
- r = Object.entries(e.plugins).filter(([, e])=>false !== e).map(([e, r])=>load(e, r, t));
463
- r = await Promise.all(r);
464
- }
465
- if (r.length && r.length > 0) r.forEach((e, r)=>{
466
- if (e.default) e = e.default;
467
- if (true === e.postcss) e = e();
468
- else if (e.postcss) e = e.postcss;
469
- if (!("object" == typeof e && Array.isArray(e.plugins) || "object" == typeof e && e.postcssPlugin || "function" == typeof e)) throw new TypeError(`Invalid PostCSS Plugin found at: plugins[${r}]\n\n(@${t})`);
470
- });
471
- return r;
472
- }
473
- e.exports = plugins;
474
- },
475
- 257: (e, t, r)=>{
476
- const { createRequire: n } = r(995);
477
- const { pathToFileURL: o } = r(136);
478
- const a = /\.[mc]?ts$/;
479
- let s;
480
- let c;
481
- let i = [];
482
- async function req(e, t = __filename) {
483
- let r = n(t).resolve(e);
484
- try {
485
- return (await import(`${o(r)}?t=${Date.now()}`)).default;
486
- } catch (e) {
487
- if (!a.test(r)) throw e;
488
- }
489
- if (void 0 === s) try {
490
- s = await import("tsx/cjs/api");
491
- } catch (e) {
492
- i.push(e);
493
- }
494
- if (s) {
495
- let r = s.require(e, t);
496
- return r && "__esModule" in r ? r.default : r;
497
- }
498
- if (void 0 === c) try {
499
- c = (await import("jiti")).default;
500
- } catch (e) {
501
- i.push(e);
502
- }
503
- if (c) return c(t, {
504
- interopDefault: true
505
- })(e);
506
- throw new Error(`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${i.map((e)=>e.message).join("\n")}`);
507
- }
508
- e.exports = req;
509
- },
510
- 896: (e)=>{
511
- "use strict";
512
- e.exports = require("fs");
513
- },
514
- 995: (e)=>{
515
- "use strict";
516
- e.exports = require("node:module");
517
- },
518
- 760: (e)=>{
519
- "use strict";
520
- e.exports = require("node:path");
521
- },
522
- 136: (e)=>{
523
- "use strict";
524
- e.exports = require("node:url");
525
- },
526
- 857: (e)=>{
527
- "use strict";
528
- e.exports = require("os");
529
- },
530
- 928: (e)=>{
531
- "use strict";
532
- e.exports = require("path");
533
- },
534
- 16: (e)=>{
535
- "use strict";
536
- e.exports = require("url");
537
- },
538
- 160: (e)=>{
539
- "use strict";
540
- e.exports = require("yaml");
541
- }
542
- };
543
- var __webpack_module_cache__ = {};
544
- function __nccwpck_require__(e) {
545
- var t = __webpack_module_cache__[e];
546
- if (void 0 !== t) return t.exports;
547
- var r = __webpack_module_cache__[e] = {
548
- exports: {}
549
- };
550
- var n = true;
551
- try {
552
- __webpack_modules__[e](r, r.exports, __nccwpck_require__);
553
- n = false;
554
- } finally{
555
- if (n) delete __webpack_module_cache__[e];
556
- }
557
- return r.exports;
558
- }
559
- (()=>{
560
- var e = Object.getPrototypeOf ? (e)=>Object.getPrototypeOf(e) : (e)=>e.__proto__;
561
- var t;
562
- __nccwpck_require__.t = function(r, n) {
563
- if (1 & n) r = this(r);
564
- if (8 & n) return r;
565
- if ("object" == typeof r && r) {
566
- if (4 & n && r.__esModule) return r;
567
- if (16 & n && "function" == typeof r.then) return r;
568
- }
569
- var o = Object.create(null);
570
- __nccwpck_require__.r(o);
571
- var a = {};
572
- t = t || [
573
- null,
574
- e({}),
575
- e([]),
576
- e(e)
577
- ];
578
- for(var s = 2 & n && r; "object" == typeof s && !~t.indexOf(s); s = e(s))Object.getOwnPropertyNames(s).forEach((e)=>a[e] = ()=>r[e]);
579
- a["default"] = ()=>r;
580
- __nccwpck_require__.d(o, a);
581
- return o;
582
- };
583
- })();
584
- (()=>{
585
- __nccwpck_require__.d = (e, t)=>{
586
- for(var r in t)if (__nccwpck_require__.o(t, r) && !__nccwpck_require__.o(e, r)) Object.defineProperty(e, r, {
587
- enumerable: true,
588
- get: t[r]
589
- });
590
- };
591
- })();
592
- (()=>{
593
- __nccwpck_require__.o = (e, t)=>Object.prototype.hasOwnProperty.call(e, t);
594
- })();
595
- (()=>{
596
- __nccwpck_require__.r = (e)=>{
597
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(e, Symbol.toStringTag, {
598
- value: "Module"
599
- });
600
- Object.defineProperty(e, "__esModule", {
601
- value: true
602
- });
603
- };
604
- })();
605
- if (void 0 !== __nccwpck_require__) __nccwpck_require__.ab = __dirname + "/";
606
- var __webpack_exports__ = __nccwpck_require__(109);
607
- module.exports = __webpack_exports__;
608
- })();
@@ -1,13 +0,0 @@
1
- /**
2
- * Autoload Config for PostCSS
3
- *
4
- * @author Michael Ciniawsky @michael-ciniawsky <michael.ciniawsky@gmail.com>
5
- * @license MIT
6
- *
7
- * @module postcss-load-config
8
- * @version 2.1.0
9
- *
10
- * @requires comsiconfig
11
- * @requires ./options
12
- * @requires ./plugins
13
- */
@@ -1,20 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright Michael Ciniawsky <michael.ciniawsky@gmail.com>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1 +0,0 @@
1
- {"name":"postcss-load-config","author":"Michael Ciniawky <michael.ciniawsky@gmail.com>","version":"6.0.1","funding":[{"type":"opencollective","url":"https://opencollective.com/postcss/"},{"type":"github","url":"https://github.com/sponsors/ai"}],"license":"MIT","types":"index.d.ts"}