@umijs/bundler-webpack 4.0.0-rc.6 → 4.0.0-rc.9

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.
Files changed (44) hide show
  1. package/compiled/autoprefixer/browserslist/index.d.ts +2 -0
  2. package/compiled/autoprefixer/index.js +3 -3
  3. package/compiled/autoprefixer/postcss/lib/declaration.d.ts +1 -1
  4. package/compiled/autoprefixer/postcss/lib/node.d.ts +2 -2
  5. package/compiled/babel-loader/index.js +2 -2
  6. package/compiled/copy-webpack-plugin/{576.index.js → 939.index.js} +11 -11
  7. package/compiled/copy-webpack-plugin/index.js +12 -12
  8. package/compiled/cssnano/index.js +5 -5
  9. package/compiled/express.d.ts +2 -0
  10. package/compiled/http-proxy-middleware/index.js +10 -10
  11. package/compiled/terser/index.js +1 -1
  12. package/dist/config/cssRules.js +1 -1
  13. package/dist/config/javaScriptRules.js +2 -1
  14. package/dist/dev.js +5 -4
  15. package/dist/index.d.ts +3 -1
  16. package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +1 -1
  17. package/dist/plugins/ParcelCSSMinifyPlugin.js +3 -2
  18. package/dist/schema.js +3 -2
  19. package/dist/server/server.js +15 -6
  20. package/dist/swcPlugins/autoCSSModules.js +3 -1
  21. package/dist/swcPlugins/changeImportFromString.d.ts +2 -0
  22. package/dist/swcPlugins/changeImportFromString.js +10 -0
  23. package/dist/swcPlugins/lockCoreJS.js +3 -2
  24. package/package.json +18 -23
  25. package/compiled/css-loader/LICENSE +0 -20
  26. package/compiled/css-loader/api.js +0 -102
  27. package/compiled/css-loader/getUrl.js +0 -29
  28. package/compiled/css-loader/index.js +0 -2
  29. package/compiled/css-loader/noSourceMaps.js +0 -5
  30. package/compiled/css-loader/package.json +0 -1
  31. package/compiled/css-loader/sourceMaps.js +0 -22
  32. package/compiled/express/LICENSE +0 -24
  33. package/compiled/express/body-parser/index.d.ts +0 -104
  34. package/compiled/express/connect/index.d.ts +0 -93
  35. package/compiled/express/express-serve-static-core/index.d.ts +0 -1252
  36. package/compiled/express/index.d.ts +0 -133
  37. package/compiled/express/index.js +0 -321
  38. package/compiled/express/mime/index.d.ts +0 -35
  39. package/compiled/express/package.json +0 -1
  40. package/compiled/express/qs/index.d.ts +0 -62
  41. package/compiled/express/range-parser/index.d.ts +0 -35
  42. package/compiled/express/serve-static/index.d.ts +0 -108
  43. package/compiled/less/index.js +0 -31
  44. package/compiled/less/package.json +0 -1
@@ -20,7 +20,7 @@ function addCSSRules(opts) {
20
20
  test: /\.less(\?.*)?$/,
21
21
  loader: require.resolve('@umijs/bundler-webpack/compiled/less-loader'),
22
22
  loaderOptions: {
23
- implementation: require.resolve('@umijs/bundler-webpack/compiled/less'),
23
+ implementation: require.resolve('@umijs/bundler-utils/compiled/less'),
24
24
  lessOptions: Object.assign({ modifyVars: userConfig.theme, javascriptEnabled: true }, userConfig.lessLoader),
25
25
  },
26
26
  },
@@ -42,7 +42,8 @@ function addJavaScriptRules(opts) {
42
42
  .test(/\.(js|mjs)$/)
43
43
  .include.add((path) => {
44
44
  try {
45
- if (path.includes('client/client'))
45
+ // do src transform for bundler-webpack/client/client/client.js
46
+ if (path.includes('client/client/client'))
46
47
  return true;
47
48
  return (0, depMatch_1.isMatch)({ path, pkgs: depPkgs });
48
49
  }
package/dist/dev.js CHANGED
@@ -22,8 +22,8 @@ const constants_1 = require("./constants");
22
22
  const server_1 = require("./server/server");
23
23
  const types_1 = require("./types");
24
24
  function dev(opts) {
25
- var _a, _b, _c, _d, _e;
26
- var _f;
25
+ var _a, _b, _c, _d, _e, _f;
26
+ var _g;
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  const enableMFSU = opts.config.mfsu !== false;
29
29
  let mfsu = null;
@@ -80,12 +80,13 @@ function dev(opts) {
80
80
  hash: true,
81
81
  staticPathPrefix: mfsu_1.MF_DEP_PREFIX,
82
82
  name: constants_1.MFSU_NAME,
83
+ chainWebpack: (_e = opts.config.mfsu) === null || _e === void 0 ? void 0 : _e.chainWebpack,
83
84
  cache: {
84
- buildDependencies: (_e = opts.cache) === null || _e === void 0 ? void 0 : _e.buildDependencies,
85
+ buildDependencies: (_f = opts.cache) === null || _f === void 0 ? void 0 : _f.buildDependencies,
85
86
  cacheDirectory: (0, path_1.join)(opts.cwd, 'node_modules', '.cache', 'mfsu-deps'),
86
87
  },
87
88
  });
88
- (_f = webpackConfig.resolve).alias || (_f.alias = {});
89
+ (_g = webpackConfig.resolve).alias || (_g.alias = {});
89
90
  // TODO: REMOVE ME
90
91
  ['@umijs/utils/compiled/strip-ansi', 'react-error-overlay'].forEach((dep) => {
91
92
  // @ts-ignore
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- export type { RequestHandler } from '../compiled/express';
1
+ import type webpack from '../compiled/webpack';
2
+ export type { RequestHandler } from '@umijs/bundler-utils/compiled/express';
2
3
  export type { Compiler, Stats } from '../compiled/webpack';
3
4
  export * from './build';
4
5
  export * from './config/config';
5
6
  export * from './dev';
6
7
  export * from './schema';
8
+ export { webpack };
@@ -1,4 +1,4 @@
1
- import { type TransformOptions } from '@parcel/css';
1
+ import type { TransformOptions } from '@parcel/css';
2
2
  import type { Compiler } from '../../compiled/webpack/types';
3
3
  declare type MinifyPluginOpts = Omit<TransformOptions, 'filename' | 'code' | 'minify'>;
4
4
  export declare class ParcelCSSMinifyPlugin {
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ParcelCSSMinifyPlugin = void 0;
13
- const css_1 = require("@parcel/css");
13
+ const utils_1 = require("@umijs/utils");
14
14
  const buffer_1 = require("buffer");
15
15
  const path_1 = require("path");
16
16
  const webpack_sources_1 = require("../../compiled/webpack-sources");
@@ -60,7 +60,8 @@ class ParcelCSSMinifyPlugin {
60
60
  const { source, map } = asset.source.sourceAndMap();
61
61
  const sourceAsString = source.toString();
62
62
  const code = typeof source === 'string' ? buffer_1.Buffer.from(source) : source;
63
- const result = yield (0, css_1.transform)(Object.assign({ filename: asset.name, code, minify: true, sourceMap: sourcemap }, this.options));
63
+ const { transform } = (0, utils_1.importLazy)('@parcel/css');
64
+ const result = yield transform(Object.assign({ filename: asset.name, code, minify: true, sourceMap: sourcemap }, this.options));
64
65
  const codeString = result.code.toString();
65
66
  compilation.updateAsset(asset.name,
66
67
  // @ts-ignore
package/dist/schema.js CHANGED
@@ -40,8 +40,8 @@ function getSchemas() {
40
40
  devtool: (Joi) => Joi.alternatives().try(Joi.string().regex(DEVTOOL_REGEX), Joi.boolean()),
41
41
  esm: (Joi) => Joi.object(),
42
42
  externals: (Joi) => Joi.alternatives().try(Joi.object(), Joi.string(), Joi.func()),
43
- extraBabelPlugins: (Joi) => Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object()))),
44
- extraBabelPresets: (Joi) => Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object()))),
43
+ extraBabelPlugins: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.array())),
44
+ extraBabelPresets: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.array())),
45
45
  extraPostCSSPlugins: (Joi) => Joi.array(),
46
46
  fastRefresh: (Joi) => Joi.boolean(),
47
47
  forkTSChecker: (Joi) => Joi.object(),
@@ -58,6 +58,7 @@ function getSchemas() {
58
58
  }),
59
59
  mfsu: (Joi) => Joi.alternatives(Joi.object({
60
60
  cacheDirectory: Joi.string(),
61
+ chainWebpack: Joi.function(),
61
62
  esbuild: Joi.boolean(),
62
63
  mfName: Joi.string(),
63
64
  }), Joi.boolean()),
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.createServer = void 0;
16
- const express_1 = __importDefault(require("@umijs/bundler-webpack/compiled/express"));
16
+ const express_1 = __importDefault(require("@umijs/bundler-utils/compiled/express"));
17
17
  const http_proxy_middleware_1 = require("@umijs/bundler-webpack/compiled/http-proxy-middleware");
18
18
  const webpack_1 = __importDefault(require("@umijs/bundler-webpack/compiled/webpack"));
19
19
  const utils_1 = require("@umijs/utils");
@@ -42,7 +42,7 @@ function createServer(opts) {
42
42
  // cros
43
43
  app.use((_req, res, next) => {
44
44
  res.header('Access-Control-Allow-Origin', '*');
45
- res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild');
45
+ res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With');
46
46
  res.header('Access-Control-Allow-Methods', 'GET, HEAD, PUT, POST, PATCH, DELETE, OPTIONS');
47
47
  next();
48
48
  });
@@ -55,7 +55,7 @@ function createServer(opts) {
55
55
  app.use((req, res, next) => {
56
56
  if (req.path === '/umi.js' && (0, fs_1.existsSync)((0, path_1.join)(opts.cwd, 'umi.js'))) {
57
57
  res.setHeader('Content-Type', 'application/javascript');
58
- res.send((0, fs_1.readFileSync)((0, path_1.join)(opts.cwd, 'umi.js'), 'utf-8'));
58
+ (0, fs_1.createReadStream)((0, path_1.join)(opts.cwd, 'umi.js')).on('error', next).pipe(res);
59
59
  }
60
60
  else {
61
61
  next();
@@ -133,7 +133,17 @@ function createServer(opts) {
133
133
  // proxy
134
134
  if (proxy) {
135
135
  Object.keys(proxy).forEach((key) => {
136
- app.use(key, (0, http_proxy_middleware_1.createProxyMiddleware)(proxy[key]));
136
+ const proxyConfig = proxy[key];
137
+ const target = proxyConfig.target;
138
+ if (target) {
139
+ app.use(key, (0, http_proxy_middleware_1.createProxyMiddleware)(key, Object.assign(Object.assign({}, proxy[key]), {
140
+ // Add x-real-url in response header
141
+ onProxyRes(proxyRes, req) {
142
+ var _a;
143
+ proxyRes.headers['x-real-url'] =
144
+ ((_a = new URL(req.url || '', target)) === null || _a === void 0 ? void 0 : _a.href) || '';
145
+ } })));
146
+ }
137
147
  });
138
148
  }
139
149
  // after middlewares
@@ -155,8 +165,7 @@ function createServer(opts) {
155
165
  res.set('Content-Type', 'text/html');
156
166
  const htmlPath = (0, path_1.join)(opts.cwd, 'index.html');
157
167
  if ((0, fs_1.existsSync)(htmlPath)) {
158
- const html = (0, fs_1.readFileSync)(htmlPath, 'utf-8');
159
- res.send(html);
168
+ (0, fs_1.createReadStream)(htmlPath).on('error', next).pipe(res);
160
169
  }
161
170
  else {
162
171
  next();
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Visitor_1 = __importDefault(require("@swc/core/Visitor"));
7
7
  const utils_1 = require("@umijs/utils");
8
+ const changeImportFromString_1 = require("./changeImportFromString");
8
9
  class AutoCSSModule extends Visitor_1.default {
9
10
  visitTsType(expression) {
10
11
  return expression;
@@ -24,7 +25,8 @@ class AutoCSSModule extends Visitor_1.default {
24
25
  const { specifiers, source } = expression;
25
26
  const { value } = source;
26
27
  if (specifiers.length && (0, utils_1.isStyleFile)({ filename: value })) {
27
- return Object.assign(Object.assign({}, expression), { source: Object.assign(Object.assign({}, source), { value: `${value}?modules` }) });
28
+ const newImportFrom = `${value}?modules`;
29
+ (0, changeImportFromString_1.changeImportFromString)(expression, newImportFrom);
28
30
  }
29
31
  return expression;
30
32
  }
@@ -0,0 +1,2 @@
1
+ import type { ImportDeclaration } from '@swc/core';
2
+ export declare const changeImportFromString: (e: ImportDeclaration, v: string) => void;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.changeImportFromString = void 0;
4
+ const changeImportFromString = (e, v) => {
5
+ e.source.value = v;
6
+ // sync change to `raw`
7
+ // https://github.com/swc-project/swc/issues/4128
8
+ e.source.raw = `'${v}'`;
9
+ };
10
+ exports.changeImportFromString = changeImportFromString;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Visitor_1 = __importDefault(require("@swc/core/Visitor"));
7
7
  const utils_1 = require("@umijs/utils");
8
8
  const path_1 = require("path");
9
+ const changeImportFromString_1 = require("./changeImportFromString");
9
10
  function addLastSlash(path) {
10
11
  return path.endsWith('/') ? path : `${path}/`;
11
12
  }
@@ -14,8 +15,8 @@ class LockCoreJS extends Visitor_1.default {
14
15
  const { source } = expression;
15
16
  let { value, type } = source;
16
17
  if (type === 'StringLiteral' && value.startsWith('core-js/')) {
17
- value = value.replace(/^core-js\//, addLastSlash((0, utils_1.winPath)((0, path_1.dirname)(require.resolve('core-js/package.json')))));
18
- return Object.assign(Object.assign({}, expression), { source: Object.assign(Object.assign({}, source), { value }) });
18
+ const newValue = value.replace(/^core-js\//, addLastSlash((0, utils_1.winPath)((0, path_1.dirname)(require.resolve('core-js/package.json')))));
19
+ (0, changeImportFromString_1.changeImportFromString)(expression, newValue);
19
20
  }
20
21
  return expression;
21
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.0-rc.6",
3
+ "version": "4.0.0-rc.9",
4
4
  "description": "@umijs/bundler-webpack",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-webpack#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -25,42 +25,40 @@
25
25
  "build:client": "pnpm tsc --project ./tsconfig.client.json",
26
26
  "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
27
27
  "dev": "pnpm build -- --watch",
28
- "generate:webpackPackages": "zx ./scripts/generateWebpackPackages.mjs"
28
+ "generate:webpackPackages": "zx ./scripts/generateWebpackPackages.mjs",
29
+ "test": "jest -c ../../jest.turbo.config.ts"
29
30
  },
30
31
  "dependencies": {
31
- "@parcel/css": "1.5.0",
32
+ "@parcel/css": "1.7.2",
32
33
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
33
34
  "@svgr/core": "6.2.1",
34
35
  "@svgr/plugin-jsx": "^6.2.1",
35
36
  "@svgr/plugin-svgo": "^6.2.0",
36
37
  "@types/hapi__joi": "17.1.8",
37
- "@umijs/babel-preset-umi": "4.0.0-rc.6",
38
- "@umijs/mfsu": "4.0.0-rc.6",
39
- "@umijs/utils": "4.0.0-rc.6",
38
+ "@umijs/babel-preset-umi": "4.0.0-rc.9",
39
+ "@umijs/mfsu": "4.0.0-rc.9",
40
+ "@umijs/utils": "4.0.0-rc.9",
40
41
  "css-loader": "6.7.1",
41
42
  "es5-imcompatible-versions": "^0.1.73",
42
43
  "jest-worker": "27.5.1",
43
44
  "node-libs-browser": "2.2.1",
44
- "postcss": "^8.4.8",
45
- "postcss-preset-env": "7.4.2",
45
+ "postcss": "^8.4.12",
46
+ "postcss-preset-env": "7.4.3",
46
47
  "react-error-overlay": "6.0.9"
47
48
  },
48
49
  "devDependencies": {
49
- "@swc/core": "1.2.151",
50
- "@types/express": "4.17.13",
50
+ "@swc/core": "1.2.160",
51
51
  "@types/webpack-sources": "3.2.0",
52
- "@types/ws": "8.5.2",
53
- "autoprefixer": "10.4.2",
54
- "babel-loader": "8.2.3",
52
+ "@types/ws": "8.5.3",
53
+ "autoprefixer": "10.4.4",
54
+ "babel-loader": "8.2.4",
55
55
  "compression": "1.7.4",
56
56
  "connect-history-api-fallback": "1.6.0",
57
57
  "copy-webpack-plugin": "10.2.4",
58
58
  "css-minimizer-webpack-plugin": "3.4.1",
59
- "cssnano": "5.1.1",
60
- "express": "4.17.3",
59
+ "cssnano": "5.1.5",
61
60
  "fork-ts-checker-webpack-plugin": "7.2.1",
62
- "http-proxy-middleware": "2.0.3",
63
- "less": "4.1.2",
61
+ "http-proxy-middleware": "2.0.4",
64
62
  "less-loader": "10.2.0",
65
63
  "mini-css-extract-plugin": "2.6.0",
66
64
  "postcss-flexbugs-fixes": "5.0.2",
@@ -73,7 +71,7 @@
73
71
  "style-loader": "3.3.1",
74
72
  "svgo-loader": "3.0.0",
75
73
  "tapable": "2.2.1",
76
- "terser": "5.12.0",
74
+ "terser": "5.12.1",
77
75
  "terser-webpack-plugin": "5.3.1",
78
76
  "url-loader": "4.1.1",
79
77
  "webpack": "5.70.0",
@@ -100,10 +98,8 @@
100
98
  "cssnano",
101
99
  "compression",
102
100
  "connect-history-api-fallback",
103
- "express",
104
101
  "fork-ts-checker-webpack-plugin",
105
102
  "http-proxy-middleware",
106
- "less",
107
103
  "less-loader",
108
104
  "mini-css-extract-plugin",
109
105
  "postcss-flexbugs-fixes",
@@ -132,9 +128,9 @@
132
128
  "@babel/core": "@umijs/bundler-utils/compiled/babel/core",
133
129
  "es-module-lexer": "@umijs/bundler-utils/compiled/es-module-lexer",
134
130
  "esbuild": "@umijs/bundler-utils/compiled/esbuild",
135
- "express": "$$LOCAL",
131
+ "express": "@umijs/bundler-utils/compiled/express",
136
132
  "jest-worker": "jest-worker",
137
- "less": "$$LOCAL",
133
+ "less": "@umijs/bundler-utils/compiled/less",
138
134
  "cssnano": "$$LOCAL",
139
135
  "postcss": "postcss",
140
136
  "tapable": "$$LOCAL",
@@ -173,7 +169,6 @@
173
169
  "compression",
174
170
  "connect-history-api-fallback",
175
171
  "fork-ts-checker-webpack-plugin",
176
- "less",
177
172
  "less-loader",
178
173
  "mini-css-extract-plugin",
179
174
  "postcss-flexbugs-fixes",
@@ -1,20 +0,0 @@
1
- Copyright JS Foundation and other contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- 'Software'), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,102 +0,0 @@
1
- "use strict";
2
-
3
- /*
4
- MIT License http://www.opensource.org/licenses/mit-license.php
5
- Author Tobias Koppers @sokra
6
- */
7
- module.exports = function (cssWithMappingToString) {
8
- var list = []; // return the list of modules as css string
9
-
10
- list.toString = function toString() {
11
- return this.map(function (item) {
12
- var content = "";
13
- var needLayer = typeof item[5] !== "undefined";
14
-
15
- if (item[4]) {
16
- content += "@supports (".concat(item[4], ") {");
17
- }
18
-
19
- if (item[2]) {
20
- content += "@media ".concat(item[2], " {");
21
- }
22
-
23
- if (needLayer) {
24
- content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
25
- }
26
-
27
- content += cssWithMappingToString(item);
28
-
29
- if (needLayer) {
30
- content += "}";
31
- }
32
-
33
- if (item[2]) {
34
- content += "}";
35
- }
36
-
37
- if (item[4]) {
38
- content += "}";
39
- }
40
-
41
- return content;
42
- }).join("");
43
- }; // import a list of modules into the list
44
-
45
-
46
- list.i = function i(modules, media, dedupe, supports, layer) {
47
- if (typeof modules === "string") {
48
- modules = [[null, modules, undefined]];
49
- }
50
-
51
- var alreadyImportedModules = {};
52
-
53
- if (dedupe) {
54
- for (var _i = 0; _i < this.length; _i++) {
55
- var id = this[_i][0];
56
-
57
- if (id != null) {
58
- alreadyImportedModules[id] = true;
59
- }
60
- }
61
- }
62
-
63
- for (var _i2 = 0; _i2 < modules.length; _i2++) {
64
- var item = [].concat(modules[_i2]);
65
-
66
- if (dedupe && alreadyImportedModules[item[0]]) {
67
- continue;
68
- }
69
-
70
- if (typeof layer !== "undefined") {
71
- if (typeof item[5] === "undefined") {
72
- item[5] = layer;
73
- } else {
74
- item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
75
- item[5] = layer;
76
- }
77
- }
78
-
79
- if (media) {
80
- if (!item[2]) {
81
- item[2] = media;
82
- } else {
83
- item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
84
- item[2] = media;
85
- }
86
- }
87
-
88
- if (supports) {
89
- if (!item[4]) {
90
- item[4] = "".concat(supports);
91
- } else {
92
- item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
93
- item[4] = supports;
94
- }
95
- }
96
-
97
- list.push(item);
98
- }
99
- };
100
-
101
- return list;
102
- };
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function (url, options) {
4
- if (!options) {
5
- options = {};
6
- }
7
-
8
- if (!url) {
9
- return url;
10
- }
11
-
12
- url = String(url.__esModule ? url.default : url); // If url is already wrapped in quotes, remove them
13
-
14
- if (/^['"].*['"]$/.test(url)) {
15
- url = url.slice(1, -1);
16
- }
17
-
18
- if (options.hash) {
19
- url += options.hash;
20
- } // Should url be wrapped?
21
- // See https://drafts.csswg.org/css-values-3/#urls
22
-
23
-
24
- if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) {
25
- return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\"");
26
- }
27
-
28
- return url;
29
- };