@ms-cloudpack/bundler-rollup 0.4.4 → 0.4.5
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/README.md +0 -4
- package/lib/getRollupPlugins.d.ts.map +1 -1
- package/lib/getRollupPlugins.js +1 -2
- package/lib/getRollupPlugins.js.map +1 -1
- package/lib/plugins/postcss/index.d.ts +11 -0
- package/lib/plugins/postcss/index.d.ts.map +1 -0
- package/lib/plugins/postcss/index.js +727 -0
- package/lib/plugins/postcss/index.js.map +1 -0
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -21,7 +21,3 @@ async function start() {
|
|
|
21
21
|
|
|
22
22
|
start();
|
|
23
23
|
```
|
|
24
|
-
|
|
25
|
-
## Limitations
|
|
26
|
-
|
|
27
|
-
Due to [limitations of `rollup-plugin-postcss`](https://github.com/egoist/rollup-plugin-postcss/issues/184), if you want to use SCSS/SASS files, you must have `sass` or `node-sass` installed (or visible due to hoisting) in the CWD where Cloudpack is being run.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRollupPlugins.d.ts","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"getRollupPlugins.d.ts","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAchE,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG;IAC7C,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,oBAAoB,EAAE,OAAO,CAAC;CAC/B,GACA,MAAM,EAAE,CAkHV"}
|
package/lib/getRollupPlugins.js
CHANGED
|
@@ -7,7 +7,7 @@ import _swc from '@rollup/plugin-swc';
|
|
|
7
7
|
import _terser from '@rollup/plugin-terser';
|
|
8
8
|
import _commonjs from '@rollup/plugin-commonjs';
|
|
9
9
|
import _nodePolyfills from 'rollup-plugin-polyfill-node';
|
|
10
|
-
import
|
|
10
|
+
import postcss from './plugins/postcss/index.js';
|
|
11
11
|
import { normalizeRequireStatements } from './plugins/normalizeRequireStatements.js';
|
|
12
12
|
import { importAsString } from 'rollup-plugin-string-import';
|
|
13
13
|
import { isExternalPackage } from '@ms-cloudpack/path-utilities';
|
|
@@ -19,7 +19,6 @@ const replace = _replace;
|
|
|
19
19
|
const terser = _terser;
|
|
20
20
|
const commonjs = _commonjs;
|
|
21
21
|
const nodePolyfills = _nodePolyfills;
|
|
22
|
-
const postcss = _postcss;
|
|
23
22
|
const dynamicImportVariables = _dynamicImportVariables;
|
|
24
23
|
const swc = _swc;
|
|
25
24
|
export function getRollupPlugins(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRollupPlugins.js","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,IAAI,MAAM,yBAAyB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAEhD,OAAO,c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CAAC,MAAM,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { getSwcConfig } from '@ms-cloudpack/bundler-utilities';\nimport _dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';\nimport json from './plugins/json/index.js';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\nimport _replace from '@rollup/plugin-replace';\nimport _swc from '@rollup/plugin-swc';\nimport _terser from '@rollup/plugin-terser';\nimport _commonjs from '@rollup/plugin-commonjs';\nimport type { Plugin } from 'rollup';\nimport _nodePolyfills from 'rollup-plugin-polyfill-node';\nimport postcss from './plugins/postcss/index.js';\nimport { normalizeRequireStatements } from './plugins/normalizeRequireStatements.js';\nimport { importAsString } from 'rollup-plugin-string-import';\nimport type { BundleContext } from '@ms-cloudpack/common-types';\nimport { isExternalPackage } from '@ms-cloudpack/path-utilities';\n\n// Workaround for https://github.com/microsoft/TypeScript/issues/49189#issuecomment-1137756847\n// (https://arethetypeswrong.github.io/?p=%40rollup%2Fplugin-replace%405.0.2)\n// At runtime, we should always be using the ESM version of these packages, which use `export default`.\n// However, typescript interprets the types as CJS modules with a `default` property (which will fail at runtime).\nconst replace = _replace as unknown as typeof _replace.default;\nconst terser = _terser as unknown as typeof _terser.default;\nconst commonjs = _commonjs as unknown as typeof _commonjs.default;\nconst nodePolyfills = _nodePolyfills as unknown as typeof _nodePolyfills.default;\nconst dynamicImportVariables = _dynamicImportVariables as unknown as typeof _dynamicImportVariables.default;\nconst swc = _swc as unknown as typeof _swc.default;\n\nexport function getRollupPlugins(\n options: Pick<BundleContext, 'isTypescript'> & {\n isProduction: boolean | undefined;\n packagePath: string;\n dynamicImports: string[] | undefined;\n sourcemap: boolean | undefined;\n resolveWebExtensions: boolean;\n },\n): Plugin[] {\n const { isProduction, packagePath, isTypescript, dynamicImports = [], sourcemap, resolveWebExtensions } = options;\n\n const isExternal = isExternalPackage(packagePath);\n\n // Only get the SWC config and transform code from internal packages or if there are explicit\n // typescript entries. (This could theoretically miss .jsx files published with a package,\n // but that's unlikely and hasn't been encountered so far.)\n const swcConfigs = !isExternal || isTypescript ? getSwcConfig({ packagePath, sourcemap }) : undefined;\n\n return [\n // Used to replaces constants in the code.\n replace({\n values: {\n 'process.env.NODE_ENV': isProduction ? `\"production\"` : `\"development\"`,\n DEPRECATED_UNIT_TEST: 'true',\n },\n preventAssignment: true,\n }),\n\n normalizeRequireStatements(),\n\n postcss({\n // Use named exports in addition to the default export.\n namedExports: true,\n // Respect the `modules` option regardless of the file extension.\n // Otherwise only *.module.* will be passed through postcss-modules and exports won't work correctly.\n autoModules: false,\n // Options for `postcss-modules` plugin. Note that as of writing, rollup-plugin-postcss\n // uses version 4: https://github.com/madyankin/postcss-modules/tree/v4.3.1\n modules: {\n // Treat .css and .s[ac]ss files as global stylesheets unless they have the `.module` suffix\n globalModulePaths: [/(?<!\\.module)\\.(css|s[ac]ss)$/],\n // Export global classnames in addition to local ones\n exportGlobals: true,\n // Convert non-identifier-friendly class names to exported camelCase identifiers (like css-loader),\n // but keep the original names to use in the default export object too\n localsConvention: 'camelCase',\n },\n // don't load postcss config\n config: false,\n minimize: isProduction,\n sourceMap: sourcemap,\n // spammy, non-actionable warning (types have incorrect extra required props)\n use: { sass: { silenceDeprecations: ['legacy-js-api'] } },\n }),\n\n // Used to parse commonjs.\n commonjs({\n // Treat all dependencies as external esm modules (since we'll be bundling them.)\n esmExternals: true,\n\n // When __esModule is true, the default export is `exports.default`; otherwise it's `module.exports`.\n defaultIsModuleExports: true,\n\n // Convert `require('library')` to `import * as library from 'library'` always, because `import library from\n // 'library' risks runtime failure if the dependency is ESM that doesn't export a default.\n requireReturnsDefault: false,\n }),\n\n // Used to compile json files into javascript exports.\n json({\n extensions: ['.json', '.resjson'],\n }),\n\n // // Used to resolve node_modules.\n nodeResolve({\n preferBuiltins: false,\n browser: true,\n // TODO: Align with other bundlers https://github.com/microsoft/cloudpack/issues/2687\n extensions: [\n ...(resolveWebExtensions ? ['.web.js'] : []),\n '.js',\n '.json',\n ...(!isExternal && resolveWebExtensions ? ['.web.ts', '.web.tsx'] : []),\n ...(!isExternal ? ['.ts', '.tsx'] : []),\n ],\n }),\n\n // Used to browserify node globals (process, global, etc.)\n nodePolyfills(),\n\n swcConfigs &&\n swc({\n include: /\\.[cm]?tsx?$/,\n swc: swcConfigs.tsx,\n }),\n\n // Support .jsx\n swcConfigs &&\n swc({\n include: /\\.[cm]?jsx$/,\n swc: swcConfigs.jsx,\n }),\n\n // Only run this plugin on **/*.dynamic.* files (plus others as specified) to avoid an extra\n // parsing/processing step on all files.\n // Must be done AFTER the TS step because it can only handle JS syntax.\n dynamicImportVariables({\n include: [\n '**/*.dynamic.*',\n // Convert the dynamic imports options to globs starting with **\n // (the plugin seems to be matching against full paths)\n ...dynamicImports.map((d) => (d.startsWith('**/') ? d : d.replace(/^(\\.?\\/)?/, '**/'))),\n ],\n }),\n\n // Minify production builds as a last step.\n !!isProduction && terser(),\n\n importAsString({\n include: '**/*.glsl',\n }),\n ].filter((plugin): plugin is Plugin => !!plugin);\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { index as default };
|
|
2
|
+
declare function index(options?: {}): {
|
|
3
|
+
name: string;
|
|
4
|
+
transform(code: any, id: any): Promise<{
|
|
5
|
+
code: string;
|
|
6
|
+
map: any;
|
|
7
|
+
} | null>;
|
|
8
|
+
augmentChunkHash(): string | undefined;
|
|
9
|
+
generateBundle(options_: any, bundle: any): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/postcss/index.js"],"names":[],"mappings":";AA8nBA;;;;;;;;EAkNC"}
|
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
// Fork of rollup-plugin-postcss to fix https://github.com/egoist/rollup-plugin-postcss/issues/184.
|
|
2
|
+
// The plugin seems to no longer be maintained and no fork was found.
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
// rollup-plugin-postcss v3.0.0
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { createFilter } from '@rollup/pluginutils';
|
|
9
|
+
import Concat from 'concat-with-sourcemaps';
|
|
10
|
+
import { createRequire } from 'module';
|
|
11
|
+
import postcss from 'postcss';
|
|
12
|
+
import pify from 'pify';
|
|
13
|
+
import resolvePackage from 'resolve';
|
|
14
|
+
import PQueue from 'p-queue';
|
|
15
|
+
// from https://github.com/eemeli/safe-identifier
|
|
16
|
+
// from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords
|
|
17
|
+
const reserved = new Set([
|
|
18
|
+
'break',
|
|
19
|
+
'case',
|
|
20
|
+
'catch',
|
|
21
|
+
'class',
|
|
22
|
+
'const',
|
|
23
|
+
'continue',
|
|
24
|
+
'debugger',
|
|
25
|
+
'default',
|
|
26
|
+
'delete',
|
|
27
|
+
'do',
|
|
28
|
+
'else',
|
|
29
|
+
'export',
|
|
30
|
+
'extends',
|
|
31
|
+
'false',
|
|
32
|
+
'finally',
|
|
33
|
+
'for',
|
|
34
|
+
'function',
|
|
35
|
+
'if',
|
|
36
|
+
'import',
|
|
37
|
+
'in',
|
|
38
|
+
'instanceof',
|
|
39
|
+
'new',
|
|
40
|
+
'null',
|
|
41
|
+
'return',
|
|
42
|
+
'super',
|
|
43
|
+
'switch',
|
|
44
|
+
'this',
|
|
45
|
+
'throw',
|
|
46
|
+
'true',
|
|
47
|
+
'try',
|
|
48
|
+
'typeof',
|
|
49
|
+
'var',
|
|
50
|
+
'void',
|
|
51
|
+
'while',
|
|
52
|
+
'with',
|
|
53
|
+
'let',
|
|
54
|
+
'static',
|
|
55
|
+
'yield',
|
|
56
|
+
'await',
|
|
57
|
+
]);
|
|
58
|
+
// from https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
|
|
59
|
+
function hashCode(str) {
|
|
60
|
+
let hash = 0;
|
|
61
|
+
for (let i = 0; i < str.length; ++i) {
|
|
62
|
+
const char = str.charCodeAt(i);
|
|
63
|
+
hash = (hash << 5) - hash + char;
|
|
64
|
+
hash |= 0; // Convert to 32bit integer
|
|
65
|
+
}
|
|
66
|
+
return hash;
|
|
67
|
+
}
|
|
68
|
+
function identifier(key, unique) {
|
|
69
|
+
if (unique)
|
|
70
|
+
key += ` ${hashCode(key).toString(36)}`;
|
|
71
|
+
const id = key.trim().replace(/\W+/g, '_');
|
|
72
|
+
return reserved.has(id) || /^\d/.test(id) ? `_${id}` : id;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Normalize path separators to forward slashes
|
|
76
|
+
* @param {string} p - Path to normalize
|
|
77
|
+
* @returns {string} Normalized path
|
|
78
|
+
*/
|
|
79
|
+
function normalizePath(p) {
|
|
80
|
+
return p?.replace(/\\+/g, '/') || '';
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Convert absolute path to relative path from current working directory
|
|
84
|
+
* @param {string} filepath - Absolute file path
|
|
85
|
+
* @returns {string} Relative path
|
|
86
|
+
*/
|
|
87
|
+
function humanlizePath(filepath) {
|
|
88
|
+
return normalizePath(path.relative(process.cwd(), filepath));
|
|
89
|
+
}
|
|
90
|
+
const require = createRequire(import.meta.url);
|
|
91
|
+
const styleInjectPath = require.resolve('style-inject/dist/style-inject.es').replace(/[\\/]+/g, '/');
|
|
92
|
+
/**
|
|
93
|
+
* Escape CSS class name dashes for JavaScript identifiers
|
|
94
|
+
*/
|
|
95
|
+
function escapeClassNameDashes(string) {
|
|
96
|
+
return string.replace(/-+/g, (match) => {
|
|
97
|
+
return `$${match.replace(/-/g, '_')}$`;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Ensure class name is a valid JavaScript identifier
|
|
102
|
+
*/
|
|
103
|
+
function ensureClassName(name) {
|
|
104
|
+
const escapedName = escapeClassNameDashes(name);
|
|
105
|
+
return identifier(escapedName, false);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Ensure PostCSS option is properly loaded
|
|
109
|
+
*/
|
|
110
|
+
async function ensurePostCSSOption(option) {
|
|
111
|
+
if (typeof option === 'string') {
|
|
112
|
+
try {
|
|
113
|
+
const { createRequire } = await import('module');
|
|
114
|
+
const require = createRequire(import.meta.url);
|
|
115
|
+
const resolvedPath = require.resolve(option);
|
|
116
|
+
return await import(resolvedPath);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return option;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return option;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Check if file is a CSS module
|
|
126
|
+
*/
|
|
127
|
+
function isModuleFile(file) {
|
|
128
|
+
return /\.module\.[a-z]{2,6}$/.test(file);
|
|
129
|
+
}
|
|
130
|
+
var postcssLoader = {
|
|
131
|
+
name: 'postcss',
|
|
132
|
+
alwaysProcess: true,
|
|
133
|
+
async process({ code, map }) {
|
|
134
|
+
// This is modified to not load postcss config.
|
|
135
|
+
if (this.options.config !== false) {
|
|
136
|
+
throw new Error('This is a fork of rollup-plugin-postcss that does not support loading postcss config. ' +
|
|
137
|
+
'Please set `config: false` in the plugin options.');
|
|
138
|
+
}
|
|
139
|
+
const { options } = this;
|
|
140
|
+
const plugins = [...(options.postcss.plugins || [])];
|
|
141
|
+
const shouldExtract = options.extract;
|
|
142
|
+
const shouldInject = options.inject;
|
|
143
|
+
const modulesExported = {};
|
|
144
|
+
const autoModules = options.autoModules !== false && options.onlyModules !== true;
|
|
145
|
+
const isAutoModule = autoModules && isModuleFile(this.id);
|
|
146
|
+
const supportModules = autoModules ? isAutoModule : options.modules;
|
|
147
|
+
if (supportModules) {
|
|
148
|
+
const postcssModules = await import('postcss-modules');
|
|
149
|
+
plugins.unshift(postcssModules.default({
|
|
150
|
+
generateScopedName: process.env.ROLLUP_POSTCSS_TEST ? '[name]_[local]' : '[name]_[local]__[hash:base64:5]',
|
|
151
|
+
...options.modules,
|
|
152
|
+
getJSON(filepath, json, outpath) {
|
|
153
|
+
modulesExported[filepath] = json;
|
|
154
|
+
if (typeof options.modules === 'object' && typeof options.modules.getJSON === 'function') {
|
|
155
|
+
return options.modules.getJSON(filepath, json, outpath);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
if (!shouldExtract && options.minimize) {
|
|
161
|
+
const cssnano = await import('cssnano');
|
|
162
|
+
plugins.push(cssnano.default(options.minimize));
|
|
163
|
+
}
|
|
164
|
+
const postcssOptions = {
|
|
165
|
+
...this.options.postcss,
|
|
166
|
+
to: options.to || this.id,
|
|
167
|
+
from: this.id,
|
|
168
|
+
map: this.sourceMap
|
|
169
|
+
? shouldExtract
|
|
170
|
+
? { inline: false, annotation: false }
|
|
171
|
+
: { inline: true, annotation: false }
|
|
172
|
+
: false,
|
|
173
|
+
};
|
|
174
|
+
delete postcssOptions.plugins;
|
|
175
|
+
postcssOptions.parser = await ensurePostCSSOption(postcssOptions.parser);
|
|
176
|
+
postcssOptions.syntax = await ensurePostCSSOption(postcssOptions.syntax);
|
|
177
|
+
postcssOptions.stringifier = await ensurePostCSSOption(postcssOptions.stringifier);
|
|
178
|
+
if (map && postcssOptions.map) {
|
|
179
|
+
postcssOptions.map.prev = typeof map === 'string' ? JSON.parse(map) : map;
|
|
180
|
+
}
|
|
181
|
+
if (plugins.length === 0) {
|
|
182
|
+
const noopPlugin = () => ({
|
|
183
|
+
postcssPlugin: 'postcss-noop-plugin',
|
|
184
|
+
Once() { },
|
|
185
|
+
});
|
|
186
|
+
plugins.push(noopPlugin());
|
|
187
|
+
}
|
|
188
|
+
const result = await postcss(plugins).process(code, postcssOptions);
|
|
189
|
+
for (const message of result.messages) {
|
|
190
|
+
if (message.type === 'dependency') {
|
|
191
|
+
this.dependencies.add(message.file);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
for (const warning of result.warnings()) {
|
|
195
|
+
if (!warning.message) {
|
|
196
|
+
warning.message = warning.text;
|
|
197
|
+
}
|
|
198
|
+
this.warn(warning);
|
|
199
|
+
}
|
|
200
|
+
const outputMap = result.map && JSON.parse(result.map.toString());
|
|
201
|
+
if (outputMap?.sources) {
|
|
202
|
+
outputMap.sources = outputMap.sources.map((v) => normalizePath(v));
|
|
203
|
+
}
|
|
204
|
+
let output = '';
|
|
205
|
+
let extracted;
|
|
206
|
+
if (options.namedExports) {
|
|
207
|
+
const json = modulesExported[this.id];
|
|
208
|
+
const getClassName = typeof options.namedExports === 'function' ? options.namedExports : ensureClassName;
|
|
209
|
+
for (const name in json) {
|
|
210
|
+
const newName = getClassName(name);
|
|
211
|
+
// Log transformed class names
|
|
212
|
+
// But skip this when namedExports is a function
|
|
213
|
+
// Since a user like you can manually log that if you want
|
|
214
|
+
if (name !== newName && typeof options.namedExports !== 'function') {
|
|
215
|
+
this.warn(`Exported "${name}" as "${newName}" in ${humanlizePath(this.id)}`);
|
|
216
|
+
}
|
|
217
|
+
if (!json[newName]) {
|
|
218
|
+
json[newName] = json[name];
|
|
219
|
+
}
|
|
220
|
+
output += `export var ${newName} = ${JSON.stringify(json[name])};\n`;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const cssVariableName = identifier('css', true);
|
|
224
|
+
if (shouldExtract) {
|
|
225
|
+
output += `export default ${JSON.stringify(modulesExported[this.id])};`;
|
|
226
|
+
extracted = {
|
|
227
|
+
id: this.id,
|
|
228
|
+
code: result.css,
|
|
229
|
+
map: outputMap,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
const module = supportModules ? JSON.stringify(modulesExported[this.id]) : cssVariableName;
|
|
234
|
+
output += `var ${cssVariableName} = ${JSON.stringify(result.css)};\n`;
|
|
235
|
+
output += `export default ${module};\n`;
|
|
236
|
+
output += `export var stylesheet=${JSON.stringify(result.css)};`;
|
|
237
|
+
}
|
|
238
|
+
if (!shouldExtract && shouldInject) {
|
|
239
|
+
output +=
|
|
240
|
+
typeof options.inject === 'function'
|
|
241
|
+
? options.inject(cssVariableName, this.id)
|
|
242
|
+
: `\nimport styleInject from '${styleInjectPath}';\n` +
|
|
243
|
+
`styleInject(${cssVariableName}${Object.keys(options.inject).length > 0 ? `,${JSON.stringify(options.inject)}` : ''});`;
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
code: output,
|
|
247
|
+
map: outputMap,
|
|
248
|
+
extracted,
|
|
249
|
+
};
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Load a module using modern ESM dynamic imports
|
|
254
|
+
* @param {string} moduleId - The module to load
|
|
255
|
+
* @returns {Promise<any>} The loaded module
|
|
256
|
+
*/
|
|
257
|
+
async function loadModule(moduleId) {
|
|
258
|
+
try {
|
|
259
|
+
// Try to import the module directly
|
|
260
|
+
return await import(moduleId);
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
// If direct import fails, try resolving from current working directory
|
|
264
|
+
try {
|
|
265
|
+
const { createRequire } = await import('module');
|
|
266
|
+
const require = createRequire(import.meta.url);
|
|
267
|
+
const resolvedPath = require.resolve(moduleId);
|
|
268
|
+
return await import(resolvedPath);
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
// Return null if module cannot be loaded
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// This queue makes sure node-sass leaves one thread available for executing fs tasks
|
|
277
|
+
// See: https://github.com/sass/node-sass/issues/857
|
|
278
|
+
const threadPoolSize = process.env.UV_THREADPOOL_SIZE || 4;
|
|
279
|
+
const workQueue = new PQueue({ concurrency: threadPoolSize - 1 });
|
|
280
|
+
const moduleRe = /^~([a-z\d]|@).+/i;
|
|
281
|
+
const getUrlOfPartial = (url) => {
|
|
282
|
+
const parsedUrl = path.parse(url);
|
|
283
|
+
return `${parsedUrl.dir}${path.sep}_${parsedUrl.base}`;
|
|
284
|
+
};
|
|
285
|
+
const resolvePromise = pify(resolvePackage);
|
|
286
|
+
// List of supported SASS modules in the order of preference
|
|
287
|
+
const sassModuleIds = ['sass', 'node-sass'];
|
|
288
|
+
/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
|
|
289
|
+
var sassLoader = {
|
|
290
|
+
name: 'sass',
|
|
291
|
+
test: /\.(sass|scss)$/,
|
|
292
|
+
process({ code }) {
|
|
293
|
+
return new Promise((resolve, reject) => {
|
|
294
|
+
(async () => {
|
|
295
|
+
const sass = await loadSassOrThrow();
|
|
296
|
+
const render = pify(sass.render.bind(sass));
|
|
297
|
+
const data = this.options.data || '';
|
|
298
|
+
workQueue.add(() => render({
|
|
299
|
+
...this.options,
|
|
300
|
+
file: this.id,
|
|
301
|
+
data: data + code,
|
|
302
|
+
indentedSyntax: /\.sass$/.test(this.id),
|
|
303
|
+
sourceMap: this.sourceMap,
|
|
304
|
+
importer: [
|
|
305
|
+
(url, importer, done) => {
|
|
306
|
+
if (!moduleRe.test(url))
|
|
307
|
+
return done({ file: url });
|
|
308
|
+
const moduleUrl = url.slice(1);
|
|
309
|
+
const partialUrl = getUrlOfPartial(moduleUrl);
|
|
310
|
+
const options = {
|
|
311
|
+
basedir: path.dirname(importer),
|
|
312
|
+
extensions: ['.scss', '.sass', '.css'],
|
|
313
|
+
};
|
|
314
|
+
const finishImport = (id) => {
|
|
315
|
+
done({
|
|
316
|
+
// Do not add `.css` extension in order to inline the file
|
|
317
|
+
file: id.endsWith('.css') ? id.replace(/\.css$/, '') : id,
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
const next = () => {
|
|
321
|
+
// Catch all resolving errors, return the original file and pass responsibility back to other custom importers
|
|
322
|
+
done({ file: url });
|
|
323
|
+
};
|
|
324
|
+
// Give precedence to importing a partial
|
|
325
|
+
resolvePromise(partialUrl, options)
|
|
326
|
+
.then(finishImport)
|
|
327
|
+
.catch((error) => {
|
|
328
|
+
if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ENOENT') {
|
|
329
|
+
resolvePromise(moduleUrl, options).then(finishImport).catch(next);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
next();
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
].concat(this.options.importer || []),
|
|
337
|
+
})
|
|
338
|
+
.then((result) => {
|
|
339
|
+
for (const file of result.stats.includedFiles) {
|
|
340
|
+
this.dependencies.add(file);
|
|
341
|
+
}
|
|
342
|
+
resolve({
|
|
343
|
+
code: result.css.toString(),
|
|
344
|
+
map: result.map && result.map.toString(),
|
|
345
|
+
});
|
|
346
|
+
})
|
|
347
|
+
.catch(reject));
|
|
348
|
+
})();
|
|
349
|
+
});
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
async function loadSassOrThrow() {
|
|
353
|
+
// Loading one of the supported modules
|
|
354
|
+
for (const moduleId of sassModuleIds) {
|
|
355
|
+
const module = await loadModule(moduleId);
|
|
356
|
+
if (module) {
|
|
357
|
+
return module;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// Throwing exception if module can't be loaded
|
|
361
|
+
throw new Error(`You need to install one of the following packages: ${sassModuleIds
|
|
362
|
+
.map((moduleId) => `"${moduleId}"`)
|
|
363
|
+
.join(', ')} in order to process SASS files`);
|
|
364
|
+
}
|
|
365
|
+
var stylusLoader = {
|
|
366
|
+
name: 'stylus',
|
|
367
|
+
test: /\.(styl|stylus)$/,
|
|
368
|
+
async process({ code }) {
|
|
369
|
+
const stylusModule = await loadModule('stylus');
|
|
370
|
+
if (!stylusModule) {
|
|
371
|
+
throw new Error('You need to install "stylus" package to process Stylus files');
|
|
372
|
+
}
|
|
373
|
+
const stylus = stylusModule.default || stylusModule;
|
|
374
|
+
const style = stylus(code, {
|
|
375
|
+
...this.options,
|
|
376
|
+
filename: this.id,
|
|
377
|
+
sourcemap: this.sourceMap && {},
|
|
378
|
+
});
|
|
379
|
+
const renderAsync = pify(style.render.bind(style));
|
|
380
|
+
try {
|
|
381
|
+
const css = await renderAsync();
|
|
382
|
+
const deps = style.deps();
|
|
383
|
+
for (const dep of deps) {
|
|
384
|
+
this.dependencies.add(dep);
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
code: css,
|
|
388
|
+
map: style.sourcemap,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
throw new Error(`Stylus compilation failed: ${error.message}`);
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
var lessLoader = {
|
|
397
|
+
name: 'less',
|
|
398
|
+
test: /\.less$/,
|
|
399
|
+
async process({ code }) {
|
|
400
|
+
const lessModule = await loadModule('less');
|
|
401
|
+
if (!lessModule) {
|
|
402
|
+
throw new Error('You need to install "less" package to process Less files');
|
|
403
|
+
}
|
|
404
|
+
const less = lessModule.default || lessModule;
|
|
405
|
+
const renderAsync = pify(less.render.bind(less));
|
|
406
|
+
try {
|
|
407
|
+
const { css, map: initialMap, imports, } = await renderAsync(code, {
|
|
408
|
+
...this.options,
|
|
409
|
+
sourceMap: this.sourceMap && {},
|
|
410
|
+
filename: this.id,
|
|
411
|
+
});
|
|
412
|
+
for (const dep of imports) {
|
|
413
|
+
this.dependencies.add(dep);
|
|
414
|
+
}
|
|
415
|
+
let map = initialMap;
|
|
416
|
+
if (map) {
|
|
417
|
+
map = JSON.parse(map);
|
|
418
|
+
map.sources = map.sources.map((source) => humanlizePath(source));
|
|
419
|
+
}
|
|
420
|
+
return {
|
|
421
|
+
code: css,
|
|
422
|
+
map,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
throw new Error(`Less compilation failed: ${error.message}`);
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
const matchFile = (filepath, condition) => {
|
|
431
|
+
if (typeof condition === 'function') {
|
|
432
|
+
return condition(filepath);
|
|
433
|
+
}
|
|
434
|
+
return condition && condition.test(filepath);
|
|
435
|
+
};
|
|
436
|
+
class Loaders {
|
|
437
|
+
constructor(options = {}) {
|
|
438
|
+
this.use = options.use.map((rule) => {
|
|
439
|
+
if (typeof rule === 'string') {
|
|
440
|
+
return [rule];
|
|
441
|
+
}
|
|
442
|
+
if (Array.isArray(rule)) {
|
|
443
|
+
return rule;
|
|
444
|
+
}
|
|
445
|
+
throw new TypeError('The rule in `use` option must be string or Array!');
|
|
446
|
+
});
|
|
447
|
+
this.loaders = [];
|
|
448
|
+
const extensions = options.extensions || ['.css', '.sss', '.pcss'];
|
|
449
|
+
const customPostcssLoader = {
|
|
450
|
+
...postcssLoader,
|
|
451
|
+
test: (filepath) => extensions.some((ext) => path.extname(filepath) === ext),
|
|
452
|
+
};
|
|
453
|
+
this.registerLoader(customPostcssLoader);
|
|
454
|
+
this.registerLoader(sassLoader);
|
|
455
|
+
this.registerLoader(stylusLoader);
|
|
456
|
+
this.registerLoader(lessLoader);
|
|
457
|
+
if (options.loaders) {
|
|
458
|
+
options.loaders.forEach((loader) => this.registerLoader(loader));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
registerLoader(loader) {
|
|
462
|
+
const existing = this.getLoader(loader.name);
|
|
463
|
+
if (existing) {
|
|
464
|
+
this.removeLoader(loader.name);
|
|
465
|
+
}
|
|
466
|
+
this.loaders.push(loader);
|
|
467
|
+
return this;
|
|
468
|
+
}
|
|
469
|
+
removeLoader(name) {
|
|
470
|
+
this.loaders = this.loaders.filter((loader) => loader.name !== name);
|
|
471
|
+
return this;
|
|
472
|
+
}
|
|
473
|
+
isSupported(filepath) {
|
|
474
|
+
return this.loaders.some((loader) => {
|
|
475
|
+
return matchFile(filepath, loader.test);
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Process the resource with loaders in serial
|
|
480
|
+
* @param {object} resource
|
|
481
|
+
* @param {string} resource.code
|
|
482
|
+
* @param {any} resource.map
|
|
483
|
+
* @param {object} context
|
|
484
|
+
* @param {string} context.id The absolute path to resource
|
|
485
|
+
* @param {boolean | 'inline'} context.sourceMap
|
|
486
|
+
* @param {Set<string>} context.dependencies A set of dependencies to watch
|
|
487
|
+
* @returns {{code: string, map?: any}}
|
|
488
|
+
*/
|
|
489
|
+
async process({ code, map }, context) {
|
|
490
|
+
const loaderFunctions = this.use
|
|
491
|
+
.slice()
|
|
492
|
+
.reverse()
|
|
493
|
+
.map(([name, options]) => {
|
|
494
|
+
const loader = this.getLoader(name);
|
|
495
|
+
const loaderContext = {
|
|
496
|
+
options: options || {},
|
|
497
|
+
...context,
|
|
498
|
+
};
|
|
499
|
+
return (v) => {
|
|
500
|
+
if (loader.alwaysProcess || matchFile(loaderContext.id, loader.test)) {
|
|
501
|
+
return loader.process.call(loaderContext, v);
|
|
502
|
+
}
|
|
503
|
+
// Otherwise directly return input value
|
|
504
|
+
return v;
|
|
505
|
+
};
|
|
506
|
+
});
|
|
507
|
+
let result = { code, map };
|
|
508
|
+
for (const loaderFn of loaderFunctions) {
|
|
509
|
+
result = await loaderFn(result);
|
|
510
|
+
}
|
|
511
|
+
return result;
|
|
512
|
+
}
|
|
513
|
+
getLoader(name) {
|
|
514
|
+
return this.loaders.find((loader) => loader.name === name);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* The options that could be `boolean` or `object`
|
|
519
|
+
* We convert it to an object when it's truthy
|
|
520
|
+
* Otherwise fallback to default value
|
|
521
|
+
*/
|
|
522
|
+
function inferOption(option, defaultValue) {
|
|
523
|
+
if (option === false)
|
|
524
|
+
return false;
|
|
525
|
+
if (option && typeof option === 'object')
|
|
526
|
+
return option;
|
|
527
|
+
return option ? {} : defaultValue;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Recursively get the correct import order from rollup
|
|
531
|
+
* We only process a file once
|
|
532
|
+
*
|
|
533
|
+
* @param {string} id
|
|
534
|
+
* @param {Function} getModuleInfo
|
|
535
|
+
* @param {Set<string>} seen
|
|
536
|
+
*/
|
|
537
|
+
function getRecursiveImportOrder(id, getModuleInfo, seen = new Set()) {
|
|
538
|
+
if (seen.has(id)) {
|
|
539
|
+
return [];
|
|
540
|
+
}
|
|
541
|
+
seen.add(id);
|
|
542
|
+
const result = [id];
|
|
543
|
+
getModuleInfo(id).importedIds.forEach((importFile) => {
|
|
544
|
+
result.push(...getRecursiveImportOrder(importFile, getModuleInfo, seen));
|
|
545
|
+
});
|
|
546
|
+
return result;
|
|
547
|
+
}
|
|
548
|
+
/* eslint import/no-anonymous-default-export: [2, {"allowArrowFunction": true}] */
|
|
549
|
+
var index = (options = {}) => {
|
|
550
|
+
const filter = createFilter(options.include, options.exclude);
|
|
551
|
+
const postcssPlugins = Array.isArray(options.plugins) ? options.plugins.filter(Boolean) : options.plugins;
|
|
552
|
+
const { sourceMap } = options;
|
|
553
|
+
const postcssLoaderOptions = {
|
|
554
|
+
/** Inject CSS as `<style>` to `<head>` */
|
|
555
|
+
inject: typeof options.inject === 'function' ? options.inject : inferOption(options.inject, {}),
|
|
556
|
+
/** Extract CSS */
|
|
557
|
+
extract: typeof options.extract === 'undefined' ? false : options.extract,
|
|
558
|
+
/** CSS modules */
|
|
559
|
+
onlyModules: options.modules === true,
|
|
560
|
+
modules: inferOption(options.modules, false),
|
|
561
|
+
namedExports: options.namedExports,
|
|
562
|
+
/** Automatically CSS modules for .module.xxx files */
|
|
563
|
+
autoModules: options.autoModules,
|
|
564
|
+
/** Options for cssnano */
|
|
565
|
+
minimize: inferOption(options.minimize, false),
|
|
566
|
+
/** Postcss config file */
|
|
567
|
+
config: inferOption(options.config, false),
|
|
568
|
+
/** PostCSS target filename hint, for plugins that are relying on it */
|
|
569
|
+
to: options.to,
|
|
570
|
+
/** PostCSS options */
|
|
571
|
+
postcss: {
|
|
572
|
+
parser: options.parser,
|
|
573
|
+
plugins: postcssPlugins,
|
|
574
|
+
syntax: options.syntax,
|
|
575
|
+
stringifier: options.stringifier,
|
|
576
|
+
exec: options.exec,
|
|
577
|
+
},
|
|
578
|
+
};
|
|
579
|
+
let use = ['sass', 'stylus', 'less'];
|
|
580
|
+
if (Array.isArray(options.use)) {
|
|
581
|
+
({ use } = options);
|
|
582
|
+
}
|
|
583
|
+
else if (options.use !== null && typeof options.use === 'object') {
|
|
584
|
+
use = [
|
|
585
|
+
['sass', options.use.sass || {}],
|
|
586
|
+
['stylus', options.use.stylus || {}],
|
|
587
|
+
['less', options.use.less || {}],
|
|
588
|
+
];
|
|
589
|
+
}
|
|
590
|
+
use.unshift(['postcss', postcssLoaderOptions]);
|
|
591
|
+
const loaders = new Loaders({
|
|
592
|
+
use,
|
|
593
|
+
loaders: options.loaders,
|
|
594
|
+
extensions: options.extensions,
|
|
595
|
+
});
|
|
596
|
+
const extracted = new Map();
|
|
597
|
+
return {
|
|
598
|
+
name: 'postcss',
|
|
599
|
+
async transform(code, id) {
|
|
600
|
+
if (!filter(id) || !loaders.isSupported(id)) {
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
if (typeof options.onImport === 'function') {
|
|
604
|
+
options.onImport(id);
|
|
605
|
+
}
|
|
606
|
+
const loaderContext = {
|
|
607
|
+
id,
|
|
608
|
+
sourceMap,
|
|
609
|
+
dependencies: new Set(),
|
|
610
|
+
warn: this.warn.bind(this),
|
|
611
|
+
plugin: this,
|
|
612
|
+
};
|
|
613
|
+
const result = await loaders.process({
|
|
614
|
+
code,
|
|
615
|
+
map: undefined,
|
|
616
|
+
}, loaderContext);
|
|
617
|
+
for (const dep of loaderContext.dependencies) {
|
|
618
|
+
this.addWatchFile(dep);
|
|
619
|
+
}
|
|
620
|
+
if (postcssLoaderOptions.extract) {
|
|
621
|
+
extracted.set(id, result.extracted);
|
|
622
|
+
return {
|
|
623
|
+
code: result.code,
|
|
624
|
+
map: { mappings: '' },
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
return {
|
|
628
|
+
code: result.code,
|
|
629
|
+
map: result.map || { mappings: '' },
|
|
630
|
+
};
|
|
631
|
+
},
|
|
632
|
+
augmentChunkHash() {
|
|
633
|
+
if (extracted.size === 0)
|
|
634
|
+
return;
|
|
635
|
+
const extractedValue = [...extracted].reduce((object, [key, value]) => ({
|
|
636
|
+
...object,
|
|
637
|
+
[key]: value,
|
|
638
|
+
}), {});
|
|
639
|
+
return JSON.stringify(extractedValue);
|
|
640
|
+
},
|
|
641
|
+
async generateBundle(options_, bundle) {
|
|
642
|
+
if (extracted.size === 0 || !(options_.dir || options_.file))
|
|
643
|
+
return;
|
|
644
|
+
// TODO: support `[hash]`
|
|
645
|
+
const dir = options_.dir || path.dirname(options_.file);
|
|
646
|
+
const file = options_.file ||
|
|
647
|
+
path.join(options_.dir, Object.keys(bundle).find((fileName) => bundle[fileName].isEntry));
|
|
648
|
+
const getExtracted = () => {
|
|
649
|
+
let fileName = `${path.basename(file, path.extname(file))}.css`;
|
|
650
|
+
if (typeof postcssLoaderOptions.extract === 'string') {
|
|
651
|
+
fileName = path.isAbsolute(postcssLoaderOptions.extract)
|
|
652
|
+
? normalizePath(path.relative(dir, postcssLoaderOptions.extract))
|
|
653
|
+
: normalizePath(postcssLoaderOptions.extract);
|
|
654
|
+
}
|
|
655
|
+
const concat = new Concat(true, fileName, '\n');
|
|
656
|
+
const entries = [...extracted.values()];
|
|
657
|
+
const { modules, facadeModuleId } = bundle[normalizePath(path.relative(dir, file))];
|
|
658
|
+
if (modules) {
|
|
659
|
+
const moduleIds = getRecursiveImportOrder(facadeModuleId, this.getModuleInfo);
|
|
660
|
+
entries.sort((a, b) => moduleIds.indexOf(a.id) - moduleIds.indexOf(b.id));
|
|
661
|
+
}
|
|
662
|
+
for (const result of entries) {
|
|
663
|
+
const relative = normalizePath(path.relative(dir, result.id));
|
|
664
|
+
const map = result.map || null;
|
|
665
|
+
if (map) {
|
|
666
|
+
map.file = fileName;
|
|
667
|
+
}
|
|
668
|
+
concat.add(relative, result.code, map);
|
|
669
|
+
}
|
|
670
|
+
let code = concat.content;
|
|
671
|
+
if (sourceMap === 'inline') {
|
|
672
|
+
code += `\n/*# sourceMappingURL=data:application/json;base64,${Buffer.from(concat.sourceMap, 'utf8').toString('base64')}*/`;
|
|
673
|
+
}
|
|
674
|
+
else if (sourceMap === true) {
|
|
675
|
+
code += `\n/*# sourceMappingURL=${path.basename(fileName)}.map */`;
|
|
676
|
+
}
|
|
677
|
+
return {
|
|
678
|
+
code,
|
|
679
|
+
map: sourceMap === true && concat.sourceMap,
|
|
680
|
+
codeFileName: fileName,
|
|
681
|
+
mapFileName: `${fileName}.map`,
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
if (options.onExtract) {
|
|
685
|
+
const shouldExtract = await options.onExtract(getExtracted);
|
|
686
|
+
if (shouldExtract === false) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
const { code: initialCode, codeFileName, map: initialMap, mapFileName } = getExtracted();
|
|
691
|
+
let code = initialCode;
|
|
692
|
+
let map = initialMap;
|
|
693
|
+
// Perform cssnano on the extracted file
|
|
694
|
+
if (postcssLoaderOptions.minimize) {
|
|
695
|
+
const cssOptions = {};
|
|
696
|
+
cssOptions.from = codeFileName;
|
|
697
|
+
if (sourceMap === 'inline') {
|
|
698
|
+
cssOptions.map = { inline: true };
|
|
699
|
+
}
|
|
700
|
+
else if (sourceMap === true && map) {
|
|
701
|
+
cssOptions.map = { prev: map };
|
|
702
|
+
cssOptions.to = codeFileName;
|
|
703
|
+
}
|
|
704
|
+
const cssnano = (await import('cssnano')).default;
|
|
705
|
+
const result = await cssnano(postcssLoaderOptions.minimize).process(code, cssOptions);
|
|
706
|
+
code = result.css;
|
|
707
|
+
if (sourceMap === true && result.map && result.map.toString) {
|
|
708
|
+
map = result.map.toString();
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
this.emitFile({
|
|
712
|
+
fileName: codeFileName,
|
|
713
|
+
type: 'asset',
|
|
714
|
+
source: code,
|
|
715
|
+
});
|
|
716
|
+
if (map) {
|
|
717
|
+
this.emitFile({
|
|
718
|
+
fileName: mapFileName,
|
|
719
|
+
type: 'asset',
|
|
720
|
+
source: map,
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
export { index as default };
|
|
727
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/postcss/index.js"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,qEAAqE;AACrE,oBAAoB;AACpB,oBAAoB;AACpB,cAAc;AAEd,+BAA+B;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,cAAc,MAAM,SAAS,CAAC;AACrC,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,iDAAiD;AACjD,kGAAkG;AAClG,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,KAAK;IACL,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,OAAO;IACP,OAAO;CACR,CAAC,CA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C;oBACrC,UAAU,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;oBAC/B,UAAU,CAAC,EAAE,GAAG,YAAY,CAAC;gBAC/B,CAAC;gBAED,MAAM,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;gBAElD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBACtF,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;gBAElB,IAAI,SAAS,KAAK,IAAI,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;oBAC5D,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;gBAC9B,CAAC;YACH,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC;gBACZ,QAAQ,EAAE,YAAY;gBACtB,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;YACH,IAAI,GAAG,EAAE,CAAC;gBACR,IAAI,CAAC,QAAQ,CAAC;oBACZ,QAAQ,EAAE,WAAW;oBACrB,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE,GAAG;iBACZ,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC","sourcesContent":["// Fork of rollup-plugin-postcss to fix https://github.com/egoist/rollup-plugin-postcss/issues/184.\n// The plugin seems to no longer be maintained and no fork was found.\n/* tslint:disable */\n/* eslint-disable */\n// @ts-nocheck\n\n// rollup-plugin-postcss v3.0.0\nimport path from 'path';\nimport { createFilter } from '@rollup/pluginutils';\nimport Concat from 'concat-with-sourcemaps';\nimport { createRequire } from 'module';\nimport postcss from 'postcss';\nimport pify from 'pify';\nimport resolvePackage from 'resolve';\nimport PQueue from 'p-queue';\n\n// from https://github.com/eemeli/safe-identifier\n// from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords\nconst reserved = new Set([\n 'break',\n 'case',\n 'catch',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'else',\n 'export',\n 'extends',\n 'false',\n 'finally',\n 'for',\n 'function',\n 'if',\n 'import',\n 'in',\n 'instanceof',\n 'new',\n 'null',\n 'return',\n 'super',\n 'switch',\n 'this',\n 'throw',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'while',\n 'with',\n 'let',\n 'static',\n 'yield',\n 'await',\n]);\n\n// from https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\nfunction hashCode(str) {\n let hash = 0;\n for (let i = 0; i < str.length; ++i) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash |= 0; // Convert to 32bit integer\n }\n return hash;\n}\n\nfunction identifier(key, unique) {\n if (unique) key += ` ${hashCode(key).toString(36)}`;\n const id = key.trim().replace(/\\W+/g, '_');\n return reserved.has(id) || /^\\d/.test(id) ? `_${id}` : id;\n}\n\n/**\n * Normalize path separators to forward slashes\n * @param {string} p - Path to normalize\n * @returns {string} Normalized path\n */\nfunction normalizePath(p) {\n return p?.replace(/\\\\+/g, '/') || '';\n}\n\n/**\n * Convert absolute path to relative path from current working directory\n * @param {string} filepath - Absolute file path\n * @returns {string} Relative path\n */\nfunction humanlizePath(filepath) {\n return normalizePath(path.relative(process.cwd(), filepath));\n}\n\nconst require = createRequire(import.meta.url);\n\nconst styleInjectPath = require.resolve('style-inject/dist/style-inject.es').replace(/[\\\\/]+/g, '/');\n\n/**\n * Escape CSS class name dashes for JavaScript identifiers\n */\nfunction escapeClassNameDashes(string) {\n return string.replace(/-+/g, (match) => {\n return `$${match.replace(/-/g, '_')}$`;\n });\n}\n\n/**\n * Ensure class name is a valid JavaScript identifier\n */\nfunction ensureClassName(name) {\n const escapedName = escapeClassNameDashes(name);\n return identifier(escapedName, false);\n}\n\n/**\n * Ensure PostCSS option is properly loaded\n */\nasync function ensurePostCSSOption(option) {\n if (typeof option === 'string') {\n try {\n const { createRequire } = await import('module');\n const require = createRequire(import.meta.url);\n const resolvedPath = require.resolve(option);\n return await import(resolvedPath);\n } catch {\n return option;\n }\n }\n return option;\n}\n\n/**\n * Check if file is a CSS module\n */\nfunction isModuleFile(file) {\n return /\\.module\\.[a-z]{2,6}$/.test(file);\n}\n\nvar postcssLoader = {\n name: 'postcss',\n alwaysProcess: true,\n\n async process({ code, map }) {\n // This is modified to not load postcss config.\n if (this.options.config !== false) {\n throw new Error(\n 'This is a fork of rollup-plugin-postcss that does not support loading postcss config. ' +\n 'Please set `config: false` in the plugin options.',\n );\n }\n\n const { options } = this;\n const plugins = [...(options.postcss.plugins || [])];\n\n const shouldExtract = options.extract;\n const shouldInject = options.inject;\n const modulesExported = {};\n const autoModules = options.autoModules !== false && options.onlyModules !== true;\n const isAutoModule = autoModules && isModuleFile(this.id);\n const supportModules = autoModules ? isAutoModule : options.modules;\n\n if (supportModules) {\n const postcssModules = await import('postcss-modules');\n plugins.unshift(\n postcssModules.default({\n generateScopedName: process.env.ROLLUP_POSTCSS_TEST ? '[name]_[local]' : '[name]_[local]__[hash:base64:5]',\n ...options.modules,\n getJSON(filepath, json, outpath) {\n modulesExported[filepath] = json;\n if (typeof options.modules === 'object' && typeof options.modules.getJSON === 'function') {\n return options.modules.getJSON(filepath, json, outpath);\n }\n },\n }),\n );\n }\n\n if (!shouldExtract && options.minimize) {\n const cssnano = await import('cssnano');\n plugins.push(cssnano.default(options.minimize));\n }\n\n const postcssOptions = {\n ...this.options.postcss,\n to: options.to || this.id,\n from: this.id,\n map: this.sourceMap\n ? shouldExtract\n ? { inline: false, annotation: false }\n : { inline: true, annotation: false }\n : false,\n };\n\n delete postcssOptions.plugins;\n\n postcssOptions.parser = await ensurePostCSSOption(postcssOptions.parser);\n postcssOptions.syntax = await ensurePostCSSOption(postcssOptions.syntax);\n postcssOptions.stringifier = await ensurePostCSSOption(postcssOptions.stringifier);\n\n if (map && postcssOptions.map) {\n postcssOptions.map.prev = typeof map === 'string' ? JSON.parse(map) : map;\n }\n\n if (plugins.length === 0) {\n const noopPlugin = () => ({\n postcssPlugin: 'postcss-noop-plugin',\n Once() {},\n });\n plugins.push(noopPlugin());\n }\n\n const result = await postcss(plugins).process(code, postcssOptions);\n\n for (const message of result.messages) {\n if (message.type === 'dependency') {\n this.dependencies.add(message.file);\n }\n }\n\n for (const warning of result.warnings()) {\n if (!warning.message) {\n warning.message = warning.text;\n }\n this.warn(warning);\n }\n\n const outputMap = result.map && JSON.parse(result.map.toString());\n if (outputMap?.sources) {\n outputMap.sources = outputMap.sources.map((v) => normalizePath(v));\n }\n\n let output = '';\n let extracted;\n\n if (options.namedExports) {\n const json = modulesExported[this.id];\n const getClassName = typeof options.namedExports === 'function' ? options.namedExports : ensureClassName;\n\n for (const name in json) {\n const newName = getClassName(name);\n // Log transformed class names\n // But skip this when namedExports is a function\n // Since a user like you can manually log that if you want\n if (name !== newName && typeof options.namedExports !== 'function') {\n this.warn(`Exported \"${name}\" as \"${newName}\" in ${humanlizePath(this.id)}`);\n }\n\n if (!json[newName]) {\n json[newName] = json[name];\n }\n\n output += `export var ${newName} = ${JSON.stringify(json[name])};\\n`;\n }\n }\n\n const cssVariableName = identifier('css', true);\n\n if (shouldExtract) {\n output += `export default ${JSON.stringify(modulesExported[this.id])};`;\n extracted = {\n id: this.id,\n code: result.css,\n map: outputMap,\n };\n } else {\n const module = supportModules ? JSON.stringify(modulesExported[this.id]) : cssVariableName;\n\n output += `var ${cssVariableName} = ${JSON.stringify(result.css)};\\n`;\n output += `export default ${module};\\n`;\n output += `export var stylesheet=${JSON.stringify(result.css)};`;\n }\n\n if (!shouldExtract && shouldInject) {\n output +=\n typeof options.inject === 'function'\n ? options.inject(cssVariableName, this.id)\n : `\\nimport styleInject from '${styleInjectPath}';\\n` +\n `styleInject(${cssVariableName}${\n Object.keys(options.inject).length > 0 ? `,${JSON.stringify(options.inject)}` : ''\n });`;\n }\n\n return {\n code: output,\n map: outputMap,\n extracted,\n };\n },\n};\n\n/**\n * Load a module using modern ESM dynamic imports\n * @param {string} moduleId - The module to load\n * @returns {Promise<any>} The loaded module\n */\nasync function loadModule(moduleId) {\n try {\n // Try to import the module directly\n return await import(moduleId);\n } catch {\n // If direct import fails, try resolving from current working directory\n try {\n const { createRequire } = await import('module');\n const require = createRequire(import.meta.url);\n const resolvedPath = require.resolve(moduleId);\n return await import(resolvedPath);\n } catch {\n // Return null if module cannot be loaded\n return null;\n }\n }\n}\n\n// This queue makes sure node-sass leaves one thread available for executing fs tasks\n// See: https://github.com/sass/node-sass/issues/857\nconst threadPoolSize = process.env.UV_THREADPOOL_SIZE || 4;\nconst workQueue = new PQueue({ concurrency: threadPoolSize - 1 });\n\nconst moduleRe = /^~([a-z\\d]|@).+/i;\n\nconst getUrlOfPartial = (url) => {\n const parsedUrl = path.parse(url);\n return `${parsedUrl.dir}${path.sep}_${parsedUrl.base}`;\n};\n\nconst resolvePromise = pify(resolvePackage);\n\n// List of supported SASS modules in the order of preference\nconst sassModuleIds = ['sass', 'node-sass'];\n\n/* eslint import/no-anonymous-default-export: [2, {\"allowObject\": true}] */\nvar sassLoader = {\n name: 'sass',\n test: /\\.(sass|scss)$/,\n process({ code }) {\n return new Promise((resolve, reject) => {\n (async () => {\n const sass = await loadSassOrThrow();\n const render = pify(sass.render.bind(sass));\n const data = this.options.data || '';\n workQueue.add(() =>\n render({\n ...this.options,\n file: this.id,\n data: data + code,\n indentedSyntax: /\\.sass$/.test(this.id),\n sourceMap: this.sourceMap,\n importer: [\n (url, importer, done) => {\n if (!moduleRe.test(url)) return done({ file: url });\n\n const moduleUrl = url.slice(1);\n const partialUrl = getUrlOfPartial(moduleUrl);\n\n const options = {\n basedir: path.dirname(importer),\n extensions: ['.scss', '.sass', '.css'],\n };\n const finishImport = (id) => {\n done({\n // Do not add `.css` extension in order to inline the file\n file: id.endsWith('.css') ? id.replace(/\\.css$/, '') : id,\n });\n };\n\n const next = () => {\n // Catch all resolving errors, return the original file and pass responsibility back to other custom importers\n done({ file: url });\n };\n\n // Give precedence to importing a partial\n resolvePromise(partialUrl, options)\n .then(finishImport)\n .catch((error) => {\n if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ENOENT') {\n resolvePromise(moduleUrl, options).then(finishImport).catch(next);\n } else {\n next();\n }\n });\n },\n ].concat(this.options.importer || []),\n })\n .then((result) => {\n for (const file of result.stats.includedFiles) {\n this.dependencies.add(file);\n }\n\n resolve({\n code: result.css.toString(),\n map: result.map && result.map.toString(),\n });\n })\n .catch(reject),\n );\n })();\n });\n },\n};\n\nasync function loadSassOrThrow() {\n // Loading one of the supported modules\n for (const moduleId of sassModuleIds) {\n const module = await loadModule(moduleId);\n if (module) {\n return module;\n }\n }\n\n // Throwing exception if module can't be loaded\n throw new Error(\n `You need to install one of the following packages: ${sassModuleIds\n .map((moduleId) => `\"${moduleId}\"`)\n .join(', ')} in order to process SASS files`,\n );\n}\n\nvar stylusLoader = {\n name: 'stylus',\n test: /\\.(styl|stylus)$/,\n\n async process({ code }) {\n const stylusModule = await loadModule('stylus');\n if (!stylusModule) {\n throw new Error('You need to install \"stylus\" package to process Stylus files');\n }\n\n const stylus = stylusModule.default || stylusModule;\n const style = stylus(code, {\n ...this.options,\n filename: this.id,\n sourcemap: this.sourceMap && {},\n });\n\n const renderAsync = pify(style.render.bind(style));\n\n try {\n const css = await renderAsync();\n const deps = style.deps();\n\n for (const dep of deps) {\n this.dependencies.add(dep);\n }\n\n return {\n code: css,\n map: style.sourcemap,\n };\n } catch (error) {\n throw new Error(`Stylus compilation failed: ${error.message}`);\n }\n },\n};\n\nvar lessLoader = {\n name: 'less',\n test: /\\.less$/,\n\n async process({ code }) {\n const lessModule = await loadModule('less');\n if (!lessModule) {\n throw new Error('You need to install \"less\" package to process Less files');\n }\n\n const less = lessModule.default || lessModule;\n const renderAsync = pify(less.render.bind(less));\n\n try {\n const {\n css,\n map: initialMap,\n imports,\n } = await renderAsync(code, {\n ...this.options,\n sourceMap: this.sourceMap && {},\n filename: this.id,\n });\n\n for (const dep of imports) {\n this.dependencies.add(dep);\n }\n\n let map = initialMap;\n if (map) {\n map = JSON.parse(map);\n map.sources = map.sources.map((source) => humanlizePath(source));\n }\n\n return {\n code: css,\n map,\n };\n } catch (error) {\n throw new Error(`Less compilation failed: ${error.message}`);\n }\n },\n};\n\nconst matchFile = (filepath, condition) => {\n if (typeof condition === 'function') {\n return condition(filepath);\n }\n\n return condition && condition.test(filepath);\n};\n\nclass Loaders {\n constructor(options = {}) {\n this.use = options.use.map((rule) => {\n if (typeof rule === 'string') {\n return [rule];\n }\n\n if (Array.isArray(rule)) {\n return rule;\n }\n\n throw new TypeError('The rule in `use` option must be string or Array!');\n });\n this.loaders = [];\n\n const extensions = options.extensions || ['.css', '.sss', '.pcss'];\n const customPostcssLoader = {\n ...postcssLoader,\n test: (filepath) => extensions.some((ext) => path.extname(filepath) === ext),\n };\n this.registerLoader(customPostcssLoader);\n this.registerLoader(sassLoader);\n this.registerLoader(stylusLoader);\n this.registerLoader(lessLoader);\n if (options.loaders) {\n options.loaders.forEach((loader) => this.registerLoader(loader));\n }\n }\n\n registerLoader(loader) {\n const existing = this.getLoader(loader.name);\n if (existing) {\n this.removeLoader(loader.name);\n }\n\n this.loaders.push(loader);\n return this;\n }\n\n removeLoader(name) {\n this.loaders = this.loaders.filter((loader) => loader.name !== name);\n return this;\n }\n\n isSupported(filepath) {\n return this.loaders.some((loader) => {\n return matchFile(filepath, loader.test);\n });\n }\n\n /**\n * Process the resource with loaders in serial\n * @param {object} resource\n * @param {string} resource.code\n * @param {any} resource.map\n * @param {object} context\n * @param {string} context.id The absolute path to resource\n * @param {boolean | 'inline'} context.sourceMap\n * @param {Set<string>} context.dependencies A set of dependencies to watch\n * @returns {{code: string, map?: any}}\n */\n async process({ code, map }, context) {\n const loaderFunctions = this.use\n .slice()\n .reverse()\n .map(([name, options]) => {\n const loader = this.getLoader(name);\n const loaderContext = {\n options: options || {},\n ...context,\n };\n\n return (v) => {\n if (loader.alwaysProcess || matchFile(loaderContext.id, loader.test)) {\n return loader.process.call(loaderContext, v);\n }\n\n // Otherwise directly return input value\n return v;\n };\n });\n\n let result = { code, map };\n for (const loaderFn of loaderFunctions) {\n result = await loaderFn(result);\n }\n\n return result;\n }\n\n getLoader(name) {\n return this.loaders.find((loader) => loader.name === name);\n }\n}\n\n/**\n * The options that could be `boolean` or `object`\n * We convert it to an object when it's truthy\n * Otherwise fallback to default value\n */\nfunction inferOption(option, defaultValue) {\n if (option === false) return false;\n if (option && typeof option === 'object') return option;\n return option ? {} : defaultValue;\n}\n\n/**\n * Recursively get the correct import order from rollup\n * We only process a file once\n *\n * @param {string} id\n * @param {Function} getModuleInfo\n * @param {Set<string>} seen\n */\nfunction getRecursiveImportOrder(id, getModuleInfo, seen = new Set()) {\n if (seen.has(id)) {\n return [];\n }\n\n seen.add(id);\n\n const result = [id];\n getModuleInfo(id).importedIds.forEach((importFile) => {\n result.push(...getRecursiveImportOrder(importFile, getModuleInfo, seen));\n });\n\n return result;\n}\n\n/* eslint import/no-anonymous-default-export: [2, {\"allowArrowFunction\": true}] */\nvar index = (options = {}) => {\n const filter = createFilter(options.include, options.exclude);\n const postcssPlugins = Array.isArray(options.plugins) ? options.plugins.filter(Boolean) : options.plugins;\n const { sourceMap } = options;\n const postcssLoaderOptions = {\n /** Inject CSS as `<style>` to `<head>` */\n inject: typeof options.inject === 'function' ? options.inject : inferOption(options.inject, {}),\n /** Extract CSS */\n extract: typeof options.extract === 'undefined' ? false : options.extract,\n /** CSS modules */\n onlyModules: options.modules === true,\n modules: inferOption(options.modules, false),\n namedExports: options.namedExports,\n /** Automatically CSS modules for .module.xxx files */\n autoModules: options.autoModules,\n /** Options for cssnano */\n minimize: inferOption(options.minimize, false),\n /** Postcss config file */\n config: inferOption(options.config, false),\n /** PostCSS target filename hint, for plugins that are relying on it */\n to: options.to,\n /** PostCSS options */\n postcss: {\n parser: options.parser,\n plugins: postcssPlugins,\n syntax: options.syntax,\n stringifier: options.stringifier,\n exec: options.exec,\n },\n };\n let use = ['sass', 'stylus', 'less'];\n if (Array.isArray(options.use)) {\n ({ use } = options);\n } else if (options.use !== null && typeof options.use === 'object') {\n use = [\n ['sass', options.use.sass || {}],\n ['stylus', options.use.stylus || {}],\n ['less', options.use.less || {}],\n ];\n }\n\n use.unshift(['postcss', postcssLoaderOptions]);\n\n const loaders = new Loaders({\n use,\n loaders: options.loaders,\n extensions: options.extensions,\n });\n\n const extracted = new Map();\n\n return {\n name: 'postcss',\n\n async transform(code, id) {\n if (!filter(id) || !loaders.isSupported(id)) {\n return null;\n }\n\n if (typeof options.onImport === 'function') {\n options.onImport(id);\n }\n\n const loaderContext = {\n id,\n sourceMap,\n dependencies: new Set(),\n warn: this.warn.bind(this),\n plugin: this,\n };\n\n const result = await loaders.process(\n {\n code,\n map: undefined,\n },\n loaderContext,\n );\n\n for (const dep of loaderContext.dependencies) {\n this.addWatchFile(dep);\n }\n\n if (postcssLoaderOptions.extract) {\n extracted.set(id, result.extracted);\n return {\n code: result.code,\n map: { mappings: '' },\n };\n }\n\n return {\n code: result.code,\n map: result.map || { mappings: '' },\n };\n },\n\n augmentChunkHash() {\n if (extracted.size === 0) return;\n const extractedValue = [...extracted].reduce(\n (object, [key, value]) => ({\n ...object,\n [key]: value,\n }),\n {},\n );\n return JSON.stringify(extractedValue);\n },\n\n async generateBundle(options_, bundle) {\n if (extracted.size === 0 || !(options_.dir || options_.file)) return;\n\n // TODO: support `[hash]`\n const dir = options_.dir || path.dirname(options_.file);\n const file =\n options_.file ||\n path.join(\n options_.dir,\n Object.keys(bundle).find((fileName) => bundle[fileName].isEntry),\n );\n const getExtracted = () => {\n let fileName = `${path.basename(file, path.extname(file))}.css`;\n if (typeof postcssLoaderOptions.extract === 'string') {\n fileName = path.isAbsolute(postcssLoaderOptions.extract)\n ? normalizePath(path.relative(dir, postcssLoaderOptions.extract))\n : normalizePath(postcssLoaderOptions.extract);\n }\n\n const concat = new Concat(true, fileName, '\\n');\n const entries = [...extracted.values()];\n const { modules, facadeModuleId } = bundle[normalizePath(path.relative(dir, file))];\n\n if (modules) {\n const moduleIds = getRecursiveImportOrder(facadeModuleId, this.getModuleInfo);\n entries.sort((a, b) => moduleIds.indexOf(a.id) - moduleIds.indexOf(b.id));\n }\n\n for (const result of entries) {\n const relative = normalizePath(path.relative(dir, result.id));\n const map = result.map || null;\n if (map) {\n map.file = fileName;\n }\n\n concat.add(relative, result.code, map);\n }\n\n let code = concat.content;\n\n if (sourceMap === 'inline') {\n code += `\\n/*# sourceMappingURL=data:application/json;base64,${Buffer.from(concat.sourceMap, 'utf8').toString(\n 'base64',\n )}*/`;\n } else if (sourceMap === true) {\n code += `\\n/*# sourceMappingURL=${path.basename(fileName)}.map */`;\n }\n\n return {\n code,\n map: sourceMap === true && concat.sourceMap,\n codeFileName: fileName,\n mapFileName: `${fileName}.map`,\n };\n };\n\n if (options.onExtract) {\n const shouldExtract = await options.onExtract(getExtracted);\n if (shouldExtract === false) {\n return;\n }\n }\n\n const { code: initialCode, codeFileName, map: initialMap, mapFileName } = getExtracted();\n let code = initialCode;\n let map = initialMap;\n // Perform cssnano on the extracted file\n if (postcssLoaderOptions.minimize) {\n const cssOptions = {};\n cssOptions.from = codeFileName;\n if (sourceMap === 'inline') {\n cssOptions.map = { inline: true };\n } else if (sourceMap === true && map) {\n cssOptions.map = { prev: map };\n cssOptions.to = codeFileName;\n }\n\n const cssnano = (await import('cssnano')).default;\n\n const result = await cssnano(postcssLoaderOptions.minimize).process(code, cssOptions);\n code = result.css;\n\n if (sourceMap === true && result.map && result.map.toString) {\n map = result.map.toString();\n }\n }\n\n this.emitFile({\n fileName: codeFileName,\n type: 'asset',\n source: code,\n });\n if (map) {\n this.emitFile({\n fileName: mapFileName,\n type: 'asset',\n source: map,\n });\n }\n },\n };\n};\n\nexport { index as default };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler-rollup",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "A cloudpack plugin for abstracting rollup.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,13 +30,19 @@
|
|
|
30
30
|
"@rollup/plugin-url": "^8.0.0",
|
|
31
31
|
"@rollup/pluginutils": "^5.0.1",
|
|
32
32
|
"@swc/core": "^1.3.0",
|
|
33
|
+
"concat-with-sourcemaps": "^1.1.0",
|
|
34
|
+
"cssnano": "^6.0.0",
|
|
33
35
|
"magic-string": "^0.30.5",
|
|
36
|
+
"p-queue": "^8.0.1",
|
|
37
|
+
"pify": "^6.0.0",
|
|
34
38
|
"postcss": "^8.0.0",
|
|
39
|
+
"postcss-modules": "^6.0.0",
|
|
40
|
+
"resolve": "^1.22.0",
|
|
35
41
|
"rollup": "^4.0.0",
|
|
36
42
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
37
|
-
"rollup-plugin-postcss": "^4.0.0",
|
|
38
43
|
"rollup-plugin-string-import": "^1.2.6",
|
|
39
|
-
"sass": "^1.0.0"
|
|
44
|
+
"sass": "^1.0.0",
|
|
45
|
+
"style-inject": "^0.3.0"
|
|
40
46
|
},
|
|
41
47
|
"devDependencies": {
|
|
42
48
|
"@ms-cloudpack/bundler-tests": "^0.1.0",
|
|
@@ -54,7 +60,8 @@
|
|
|
54
60
|
"lint": "cloudpack-scripts lint",
|
|
55
61
|
"test:update": "cloudpack-scripts test-update",
|
|
56
62
|
"test:watch": "cloudpack-scripts test-watch",
|
|
57
|
-
"test": "cloudpack-scripts test"
|
|
63
|
+
"test": "cloudpack-scripts test",
|
|
64
|
+
"prepack": "cp .npmignore lib/.npmignore"
|
|
58
65
|
},
|
|
59
66
|
"files": [
|
|
60
67
|
"lib/**/!(*.test.*)"
|