@shuvi/toolpack 0.0.1-rc.9 → 1.0.0-rc.10

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 (103) hide show
  1. package/lib/babel/plugins/auto-css-modules.js +1 -1
  2. package/lib/babel/plugins/{loadable-plugin.d.ts → dynamic-plugin.d.ts} +1 -1
  3. package/lib/babel/plugins/{loadable-plugin.js → dynamic-plugin.js} +9 -9
  4. package/lib/babel/plugins/optimize-hook-destructuring.d.ts +1 -1
  5. package/lib/babel/plugins/optimize-hook-destructuring.js +4 -4
  6. package/lib/babel/preset.js +25 -5
  7. package/lib/constants.d.ts +1 -0
  8. package/lib/constants.js +5 -1
  9. package/lib/utils/bundle-require.d.ts +33 -0
  10. package/lib/utils/bundle-require.js +143 -0
  11. package/lib/utils/forkTsCheckerWebpackPlugin.js +2 -1
  12. package/lib/utils/formatWebpackMessages.d.ts +18 -4
  13. package/lib/utils/formatWebpackMessages.js +17 -14
  14. package/lib/webpack/config/base.d.ts +17 -4
  15. package/lib/webpack/config/base.js +144 -99
  16. package/lib/webpack/config/browser.d.ts +3 -4
  17. package/lib/webpack/config/browser.js +132 -56
  18. package/lib/webpack/config/index.js +18 -7
  19. package/lib/webpack/config/node.d.ts +3 -4
  20. package/lib/webpack/config/node.js +21 -28
  21. package/lib/webpack/config/parts/external.d.ts +3 -2
  22. package/lib/webpack/config/parts/external.js +16 -10
  23. package/lib/webpack/config/parts/helpers.d.ts +3 -1
  24. package/lib/webpack/config/parts/helpers.js +14 -1
  25. package/lib/webpack/config/parts/resolve.js +1 -0
  26. package/lib/webpack/config/parts/style.d.ts +5 -2
  27. package/lib/webpack/config/parts/style.js +125 -60
  28. package/lib/webpack/dynamic-dll/bundler/index.d.ts +22 -0
  29. package/lib/webpack/dynamic-dll/bundler/index.js +211 -0
  30. package/lib/webpack/dynamic-dll/bundler/webpack-config.d.ts +16 -0
  31. package/lib/webpack/dynamic-dll/bundler/webpack-config.js +116 -0
  32. package/lib/webpack/dynamic-dll/constants.d.ts +6 -0
  33. package/lib/webpack/dynamic-dll/constants.js +9 -0
  34. package/lib/webpack/dynamic-dll/dep/getCJSExports.d.ts +3 -0
  35. package/lib/webpack/dynamic-dll/dep/getCJSExports.js +58 -0
  36. package/lib/webpack/dynamic-dll/dep/getExposeFromContent.d.ts +1 -0
  37. package/lib/webpack/dynamic-dll/dep/getExposeFromContent.js +80 -0
  38. package/lib/webpack/dynamic-dll/dep/getModuleExports.d.ts +7 -0
  39. package/lib/webpack/dynamic-dll/dep/getModuleExports.js +46 -0
  40. package/lib/webpack/dynamic-dll/dep/index.d.ts +13 -0
  41. package/lib/webpack/dynamic-dll/dep/index.js +43 -0
  42. package/lib/webpack/dynamic-dll/helper/check-not-in-node-modules.d.ts +1 -0
  43. package/lib/webpack/dynamic-dll/helper/check-not-in-node-modules.js +15 -0
  44. package/lib/webpack/dynamic-dll/index.d.ts +35 -0
  45. package/lib/webpack/dynamic-dll/index.js +198 -0
  46. package/lib/webpack/dynamic-dll/metadata.d.ts +13 -0
  47. package/lib/webpack/dynamic-dll/metadata.js +62 -0
  48. package/lib/webpack/dynamic-dll/moduleCollector.d.ts +28 -0
  49. package/lib/webpack/dynamic-dll/moduleCollector.js +64 -0
  50. package/lib/webpack/dynamic-dll/plugin/dynamic-dll-plugin.d.ts +24 -0
  51. package/lib/webpack/dynamic-dll/plugin/dynamic-dll-plugin.js +70 -0
  52. package/lib/webpack/dynamic-dll/utils.d.ts +6 -0
  53. package/lib/webpack/dynamic-dll/utils.js +29 -0
  54. package/lib/webpack/index.d.ts +15 -0
  55. package/lib/webpack/index.js +110 -0
  56. package/lib/webpack/loaders/parcel-css-loader/CssSyntaxError.d.ts +11 -0
  57. package/lib/webpack/loaders/parcel-css-loader/CssSyntaxError.js +40 -0
  58. package/lib/webpack/loaders/parcel-css-loader/index.d.ts +4 -0
  59. package/lib/webpack/loaders/parcel-css-loader/index.js +369 -0
  60. package/lib/webpack/loaders/parcel-css-loader/runtime/api.d.ts +2 -0
  61. package/lib/webpack/loaders/parcel-css-loader/runtime/api.js +85 -0
  62. package/lib/webpack/loaders/parcel-css-loader/runtime/getUrl.d.ts +2 -0
  63. package/lib/webpack/loaders/parcel-css-loader/runtime/getUrl.js +23 -0
  64. package/lib/webpack/loaders/parcel-css-loader/runtime/noSourceMaps.d.ts +2 -0
  65. package/lib/webpack/loaders/parcel-css-loader/runtime/noSourceMaps.js +2 -0
  66. package/lib/webpack/loaders/parcel-css-loader/runtime/sourceMaps.d.ts +2 -0
  67. package/lib/webpack/loaders/parcel-css-loader/runtime/sourceMaps.js +16 -0
  68. package/lib/webpack/loaders/parcel-css-loader/utils.d.ts +28 -0
  69. package/lib/webpack/loaders/parcel-css-loader/utils.js +869 -0
  70. package/lib/webpack/loaders/route-component-loader.js +25 -5
  71. package/lib/webpack/loaders/shuvi-swc-loader/getLoaderSWCOptions.d.ts +94 -0
  72. package/lib/webpack/loaders/shuvi-swc-loader/getLoaderSWCOptions.js +162 -0
  73. package/lib/webpack/loaders/shuvi-swc-loader/index.d.ts +2 -0
  74. package/lib/webpack/loaders/shuvi-swc-loader/index.js +119 -0
  75. package/lib/webpack/plugins/build-manifest-plugin.js +44 -23
  76. package/lib/webpack/plugins/dynamic-public-path-plugin.d.ts +9 -0
  77. package/lib/webpack/plugins/dynamic-public-path-plugin.js +50 -0
  78. package/lib/webpack/plugins/fix-watching-plugin.d.ts +4 -0
  79. package/lib/webpack/plugins/fix-watching-plugin.js +23 -0
  80. package/lib/webpack/plugins/jsconfig-paths-plugin.d.ts +44 -0
  81. package/lib/webpack/plugins/jsconfig-paths-plugin.js +228 -0
  82. package/lib/webpack/plugins/module-replace-plugin/index.js +5 -1
  83. package/lib/webpack/plugins/module-replace-plugin/plugin.d.ts +7 -6
  84. package/lib/webpack/plugins/module-replace-plugin/plugin.js +56 -33
  85. package/lib/webpack/plugins/module-replace-plugin/stub-loader.js +47 -7
  86. package/lib/webpack/plugins/require-cache-hot-reloader-plugin.js +9 -8
  87. package/lib/webpack/plugins/support-ts-extension-resolver-plugin.d.ts +4 -0
  88. package/lib/webpack/plugins/support-ts-extension-resolver-plugin.js +23 -0
  89. package/lib/webpack/types.d.ts +40 -0
  90. package/lib/webpack/types.js +2 -0
  91. package/package.json +46 -40
  92. package/lib/utils/emptyComponent.d.ts +0 -1
  93. package/lib/utils/emptyComponent.js +0 -7
  94. package/lib/utils/errorOverlayMiddleware.d.ts +0 -1
  95. package/lib/utils/errorOverlayMiddleware.js +0 -21
  96. package/lib/utils/hotDevClient/eventsource.d.ts +0 -1
  97. package/lib/utils/hotDevClient/eventsource.js +0 -63
  98. package/lib/utils/hotDevClient/index.d.ts +0 -4
  99. package/lib/utils/hotDevClient/index.js +0 -289
  100. package/lib/utils/verifyTypeScriptSetup.d.ts +0 -5
  101. package/lib/utils/verifyTypeScriptSetup.js +0 -229
  102. package/lib/webpack/loaders/export-global-loader.d.ts +0 -7
  103. package/lib/webpack/loaders/export-global-loader.js +0 -26
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function showSourceCode(source, lineNo, columnNo) {
4
+ if (!source)
5
+ return '';
6
+ let lines = source.split(/\r?\n/);
7
+ let start = Math.max(lineNo - 3, 0);
8
+ let end = Math.min(lineNo + 2, lines.length);
9
+ let maxWidth = String(end).length;
10
+ return lines
11
+ .slice(start, end)
12
+ .map((line, index) => {
13
+ let number = start + 1 + index;
14
+ let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ';
15
+ if (number === lineNo) {
16
+ let spacing = gutter.replace(/\d/g, ' ') +
17
+ line.slice(0, columnNo - 1).replace(/[^\t]/g, ' ');
18
+ return '>' + gutter + line + '\n ' + spacing + '^';
19
+ }
20
+ return ' ' + gutter + line;
21
+ })
22
+ .join('\n');
23
+ }
24
+ class CssSyntaxError extends Error {
25
+ constructor(error) {
26
+ super();
27
+ const { source, fileName, loc } = error;
28
+ const { line, column } = loc;
29
+ this.message = `\n\n${this.message}\n\n`;
30
+ this.message += `${fileName || `<css input>`}`;
31
+ if (typeof line !== 'undefined') {
32
+ this.message += `(${line}:${column}) \n`;
33
+ }
34
+ this.message += `\n${showSourceCode(source, line, column)}\n`;
35
+ // We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror
36
+ // @ts-ignore
37
+ this.stack = false;
38
+ }
39
+ }
40
+ exports.default = CssSyntaxError;
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ import type { loader } from 'webpack';
3
+ export default function loader(this: loader.LoaderContext, content: string | Buffer, map?: string): Promise<void>;
4
+ export declare const raw = true;
@@ -0,0 +1,369 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.raw = void 0;
39
+ const path = __importStar(require("path"));
40
+ const browserslist_1 = __importDefault(require("browserslist"));
41
+ const css_1 = require("@parcel/css");
42
+ const CssSyntaxError_1 = __importDefault(require("./CssSyntaxError"));
43
+ const utils_1 = require("./utils");
44
+ const browsersTargets = (0, css_1.browserslistToTargets)((0, browserslist_1.default)('last 1 major versions'));
45
+ function loader(content, map) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const rawOptions = this.getOptions();
48
+ const callback = this.async();
49
+ let options;
50
+ try {
51
+ options = (0, utils_1.normalizeOptions)(rawOptions, this);
52
+ }
53
+ catch (error) {
54
+ if (callback) {
55
+ callback(error);
56
+ }
57
+ return;
58
+ }
59
+ let isSupportAbsoluteURL = false;
60
+ // TODO enable by default in the next major release
61
+ if (this._compilation &&
62
+ this._compilation.options &&
63
+ this._compilation.options.experiments &&
64
+ this._compilation.options.experiments.buildHttp) {
65
+ isSupportAbsoluteURL = true;
66
+ }
67
+ const isSupportDataURL = options.esModule && Boolean('fsStartTime' in this._compiler);
68
+ const needToUseIcssPlugin = (0, utils_1.shouldUseIcssPlugin)(options);
69
+ let ParcelCssRes;
70
+ try {
71
+ ParcelCssRes = (0, css_1.transform)({
72
+ filename: path.relative(this.rootContext, this.resourcePath),
73
+ code: content instanceof Buffer ? content : Buffer.from(content),
74
+ // minify: this.mode === 'production',
75
+ cssModules: needToUseIcssPlugin,
76
+ analyzeDependencies: true,
77
+ sourceMap: options.sourceMap,
78
+ drafts: {
79
+ nesting: true,
80
+ customMedia: true
81
+ },
82
+ pseudoClasses: {},
83
+ targets: browsersTargets
84
+ });
85
+ if (options.sourceMap && map) {
86
+ ParcelCssRes.map = (0, utils_1.normalizeSourceMap)(map, this.resourcePath);
87
+ }
88
+ }
89
+ catch (error) {
90
+ console.error('-> error', error);
91
+ if (callback) {
92
+ callback(error.name === 'SyntaxError' ? new CssSyntaxError_1.default(error) : error);
93
+ }
94
+ return;
95
+ }
96
+ const { dependencies = [] } = ParcelCssRes;
97
+ const parcelImportsMap = new Map();
98
+ const parcelUrlsMap = new Map();
99
+ const icssMap = new Map();
100
+ const parcelReplacementsMap = new Map();
101
+ const parcelImports = [];
102
+ const parcelApis = [];
103
+ const parcelReplacements = [];
104
+ const parcelExports = [];
105
+ let hasUrlImportHelper = false;
106
+ for (let index = 0; index < dependencies.length; index++) {
107
+ const dep = dependencies[index];
108
+ let { type, url } = dep;
109
+ const dataUrl = (0, utils_1.isDataUrl)(url);
110
+ url = (0, utils_1.normalizeUrl)(url, !dataUrl);
111
+ url = url.trim();
112
+ if (url.length === 0) {
113
+ // Empty url - `@import "";` or `@import url();`
114
+ console.error("It looks like you didn't end your @import statement correctly. Child nodes are attached to it.");
115
+ continue;
116
+ }
117
+ if (type === 'import') {
118
+ const { supports, media } = dep;
119
+ const { requestable, needResolve } = (0, utils_1.isURLRequestable)(url, {
120
+ isSupportAbsoluteURL: false,
121
+ isSupportDataURL: false
122
+ });
123
+ let prefix;
124
+ if (requestable && needResolve) {
125
+ const queryParts = url.split('!');
126
+ if (queryParts.length > 1) {
127
+ url = queryParts.pop();
128
+ prefix = queryParts.join('!');
129
+ }
130
+ }
131
+ const resolver = this.getResolve({
132
+ dependencyType: 'css',
133
+ conditionNames: ['style'],
134
+ mainFields: ['css', 'style', 'main', '...'],
135
+ mainFiles: ['index', '...'],
136
+ extensions: ['.css', '...'],
137
+ preferRelative: true
138
+ });
139
+ if (needResolve) {
140
+ const request = (0, utils_1.requestify)(url, this.rootContext);
141
+ const resolvedUrl = yield (0, utils_1.resolveRequests)(resolver, this.context, [
142
+ ...new Set([request, url])
143
+ ]);
144
+ if (!resolvedUrl) {
145
+ continue;
146
+ }
147
+ if (resolvedUrl === this.resourcePath) {
148
+ continue;
149
+ }
150
+ url = resolvedUrl;
151
+ }
152
+ if (!requestable) {
153
+ parcelApis.push({
154
+ url,
155
+ layer: undefined,
156
+ supports,
157
+ media,
158
+ index
159
+ });
160
+ continue;
161
+ }
162
+ url = prefix ? `${prefix}!${url}` : url;
163
+ let importName = parcelImportsMap.get(url);
164
+ if (!importName) {
165
+ const { size } = parcelImportsMap;
166
+ importName = `___CSS_LOADER_AT_RULE_IMPORT_${size}___`;
167
+ parcelImportsMap.set(url, importName);
168
+ parcelImports.push({
169
+ type: 'rule_import',
170
+ importName,
171
+ url: (0, utils_1.stringifyRequest)(this, (0, utils_1.combineRequests)((0, utils_1.getPreRequester)(this)(options.importLoaders), url)),
172
+ index: size
173
+ });
174
+ }
175
+ parcelApis.push({
176
+ importName,
177
+ layer: undefined,
178
+ supports,
179
+ media,
180
+ index
181
+ });
182
+ }
183
+ else if (type === 'url') {
184
+ const { placeholder } = dep;
185
+ const { requestable, needResolve } = (0, utils_1.isURLRequestable)(url, {
186
+ isSupportAbsoluteURL,
187
+ isSupportDataURL
188
+ });
189
+ // console.log("-> url6 6", url, requestable, needResolve);
190
+ // Do not traverse inside `url`
191
+ if (!requestable && !needResolve) {
192
+ if (!parcelReplacementsMap.get(url)) {
193
+ parcelReplacementsMap.set(url, placeholder);
194
+ parcelReplacements.push({
195
+ placeholder,
196
+ replacementName: url,
197
+ hash: undefined,
198
+ needQuotes: false,
199
+ isString: true
200
+ });
201
+ }
202
+ continue;
203
+ }
204
+ const queryParts = url.split('!');
205
+ let prefix;
206
+ if (queryParts.length > 1) {
207
+ url = queryParts.pop();
208
+ prefix = queryParts.join('!');
209
+ }
210
+ const splittedUrl = url.split(/(\?)?#/);
211
+ const [pathname, query, hashOrQuery] = splittedUrl;
212
+ let hash = query ? '?' : '';
213
+ hash += hashOrQuery ? `#${hashOrQuery}` : '';
214
+ const resolver = !options.esModule
215
+ ? this.getResolve({ mainFiles: [], extensions: [] })
216
+ : undefined;
217
+ const request = (0, utils_1.requestify)(pathname, this.rootContext, Boolean(resolver));
218
+ if (!resolver) {
219
+ // eslint-disable-next-line consistent-return
220
+ url = request;
221
+ }
222
+ else {
223
+ const resolvedURL = yield (0, utils_1.resolveRequests)(resolver, this.context, [
224
+ ...new Set([request, url])
225
+ ]);
226
+ if (resolvedURL) {
227
+ url = resolvedURL;
228
+ }
229
+ }
230
+ if (!hasUrlImportHelper) {
231
+ parcelImports.push({
232
+ type: 'get_url_import',
233
+ importName: '___CSS_LOADER_GET_URL_IMPORT___',
234
+ url: (0, utils_1.stringifyRequest)(this, require.resolve('./runtime/getUrl.js')),
235
+ index: -1
236
+ });
237
+ hasUrlImportHelper = true;
238
+ }
239
+ url = prefix ? `${prefix}!${url}` : url;
240
+ let importName = parcelUrlsMap.get(url);
241
+ if (!importName) {
242
+ importName = `___CSS_LOADER_URL_IMPORT_${parcelUrlsMap.size}___`;
243
+ parcelUrlsMap.set(url, importName);
244
+ parcelImports.push({
245
+ // type: 'url',
246
+ importName,
247
+ url: (0, utils_1.stringifyRequest)(this, url),
248
+ index
249
+ });
250
+ parcelReplacements.push({
251
+ placeholder,
252
+ replacementName: `___CSS_LOADER_URL_REPLACEMENT_${index}___`,
253
+ importName,
254
+ hash,
255
+ needQuotes: false,
256
+ isString: false
257
+ });
258
+ }
259
+ }
260
+ }
261
+ if (ParcelCssRes.exports) {
262
+ const resolver = this.getResolve({
263
+ dependencyType: 'icss',
264
+ conditionNames: ['style'],
265
+ extensions: ['...'],
266
+ mainFields: ['css', 'style', 'main', '...'],
267
+ mainFiles: ['index', '...'],
268
+ preferRelative: true
269
+ });
270
+ const exportKeys = Object.keys(ParcelCssRes.exports);
271
+ for (const exportKey of exportKeys) {
272
+ const exportItem = ParcelCssRes.exports[exportKey];
273
+ const { name, composes } = exportItem;
274
+ let value = name;
275
+ for (const compose of composes) {
276
+ const { type } = compose;
277
+ if (['global', 'local'].includes(type)) {
278
+ value += ` ${compose.name}`;
279
+ }
280
+ if (type === 'dependency') {
281
+ let url = compose.specifier;
282
+ let prefix = '';
283
+ const queryParts = url.split('!');
284
+ if (queryParts.length > 1) {
285
+ url = queryParts.pop();
286
+ prefix = queryParts.join('!');
287
+ }
288
+ const request = (0, utils_1.requestify)((0, utils_1.normalizeUrl)(url, true), this.rootContext);
289
+ const resolvedUrl = yield (0, utils_1.resolveRequests)(resolver, this.context, [
290
+ ...new Set([url, request])
291
+ ]);
292
+ if (!resolvedUrl) {
293
+ continue;
294
+ }
295
+ url = resolvedUrl;
296
+ url = prefix ? `${prefix}!${url}` : url;
297
+ let importName = icssMap.get(url);
298
+ if (!importName) {
299
+ const index = icssMap.size;
300
+ importName = `___CSS_LOADER_ICSS_IMPORT_${index}___`;
301
+ icssMap.set(url, importName);
302
+ parcelImports.push({
303
+ type: 'icss_import',
304
+ importName,
305
+ url: (0, utils_1.stringifyRequest)(this, (0, utils_1.combineRequests)((0, utils_1.getPreRequester)(this)(options.importLoaders), url)),
306
+ icss: true,
307
+ index
308
+ });
309
+ parcelApis.push({ importName, dedupe: true, index });
310
+ }
311
+ const replacementName = `___REPLACEMENT_${parcelReplacements.length}_${importName}`;
312
+ parcelReplacements.push({
313
+ localName: compose.name,
314
+ replacementName,
315
+ importName
316
+ });
317
+ value += ` ${replacementName}`;
318
+ }
319
+ }
320
+ parcelExports.push({
321
+ name: exportKey,
322
+ value
323
+ });
324
+ }
325
+ }
326
+ if (options.modules.exportOnlyLocals !== true) {
327
+ parcelImports.unshift({
328
+ type: 'api_import',
329
+ importName: '___CSS_LOADER_API_IMPORT___',
330
+ url: (0, utils_1.stringifyRequest)(this, require.resolve('./runtime/api'))
331
+ });
332
+ if (options.sourceMap) {
333
+ parcelImports.unshift({
334
+ importName: '___CSS_LOADER_API_SOURCEMAP_IMPORT___',
335
+ url: (0, utils_1.stringifyRequest)(this, require.resolve('./runtime/sourceMaps'))
336
+ });
337
+ }
338
+ else {
339
+ parcelImports.unshift({
340
+ importName: '___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___',
341
+ url: (0, utils_1.stringifyRequest)(this, require.resolve('./runtime/noSourceMaps'))
342
+ });
343
+ }
344
+ }
345
+ parcelImportsMap.clear();
346
+ parcelUrlsMap.clear();
347
+ icssMap.clear();
348
+ parcelReplacementsMap.clear();
349
+ const importCode = (0, utils_1.getImportCode)(parcelImports, options);
350
+ let moduleCode;
351
+ try {
352
+ moduleCode = (0, utils_1.getParcelCssModuleCode)(ParcelCssRes, parcelApis, parcelReplacements, options, this);
353
+ }
354
+ catch (error) {
355
+ if (callback) {
356
+ callback(error);
357
+ }
358
+ return;
359
+ }
360
+ const exportCode = (0, utils_1.getExportCode)(parcelExports, parcelReplacements, needToUseIcssPlugin, options);
361
+ const resultCode = `${importCode}${moduleCode}${exportCode}`;
362
+ if (callback) {
363
+ callback(null, resultCode);
364
+ }
365
+ });
366
+ }
367
+ exports.default = loader;
368
+ // accept Buffers instead of strings
369
+ exports.raw = true;
@@ -0,0 +1,2 @@
1
+ declare function _exports(cssWithMappingToString: any): any[];
2
+ export = _exports;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ /*
3
+ MIT License http://www.opensource.org/licenses/mit-license.php
4
+ Author Tobias Koppers @sokra
5
+ */
6
+ module.exports = cssWithMappingToString => {
7
+ const list = [];
8
+ // return the list of modules as css string
9
+ list.toString = function toString() {
10
+ return this.map(item => {
11
+ let content = '';
12
+ const needLayer = typeof item[5] !== 'undefined';
13
+ if (item[4]) {
14
+ content += `@supports (${item[4]}) {`;
15
+ }
16
+ if (item[2]) {
17
+ content += `@media ${item[2]} {`;
18
+ }
19
+ if (needLayer) {
20
+ content += `@layer${item[5].length > 0 ? ` ${item[5]}` : ''} {`;
21
+ }
22
+ content += cssWithMappingToString(item);
23
+ if (needLayer) {
24
+ content += '}';
25
+ }
26
+ if (item[2]) {
27
+ content += '}';
28
+ }
29
+ if (item[4]) {
30
+ content += '}';
31
+ }
32
+ return content;
33
+ }).join('');
34
+ };
35
+ // import a list of modules into the list
36
+ list.i = function i(modules, media, dedupe, supports, layer) {
37
+ if (typeof modules === 'string') {
38
+ modules = [[null, modules, undefined]];
39
+ }
40
+ const alreadyImportedModules = {};
41
+ if (dedupe) {
42
+ for (let k = 0; k < this.length; k++) {
43
+ const id = this[k][0];
44
+ if (id != null) {
45
+ alreadyImportedModules[id] = true;
46
+ }
47
+ }
48
+ }
49
+ for (let k = 0; k < modules.length; k++) {
50
+ const item = [].concat(modules[k]);
51
+ if (dedupe && alreadyImportedModules[item[0]]) {
52
+ continue;
53
+ }
54
+ if (typeof layer !== 'undefined') {
55
+ if (typeof item[5] === 'undefined') {
56
+ item[5] = layer;
57
+ }
58
+ else {
59
+ item[1] = `@layer${item[5].length > 0 ? ` ${item[5]}` : ''} {${item[1]}}`;
60
+ item[5] = layer;
61
+ }
62
+ }
63
+ if (media) {
64
+ if (!item[2]) {
65
+ item[2] = media;
66
+ }
67
+ else {
68
+ item[1] = `@media ${item[2]} {${item[1]}}`;
69
+ item[2] = media;
70
+ }
71
+ }
72
+ if (supports) {
73
+ if (!item[4]) {
74
+ item[4] = `${supports}`;
75
+ }
76
+ else {
77
+ item[1] = `@supports (${item[4]}) {${item[1]}}`;
78
+ item[4] = supports;
79
+ }
80
+ }
81
+ list.push(item);
82
+ }
83
+ };
84
+ return list;
85
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(url: any, options: any): any;
2
+ export = _exports;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ module.exports = (url, options) => {
3
+ if (!options) {
4
+ options = {};
5
+ }
6
+ if (!url) {
7
+ return url;
8
+ }
9
+ url = String(url.__esModule ? url.default : url);
10
+ // If url is already wrapped in quotes, remove them
11
+ if (/^['"].*['"]$/.test(url)) {
12
+ url = url.slice(1, -1);
13
+ }
14
+ if (options.hash) {
15
+ url += options.hash;
16
+ }
17
+ // Should url be wrapped?
18
+ // See https://drafts.csswg.org/css-values-3/#urls
19
+ if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) {
20
+ return `"${url.replace(/"/g, '\\"').replace(/\n/g, '\\n')}"`;
21
+ }
22
+ return url;
23
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(i: any): any;
2
+ export = _exports;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ module.exports = i => i[1];
@@ -0,0 +1,2 @@
1
+ declare function _exports(item: any): any;
2
+ export = _exports;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ module.exports = item => {
3
+ const content = item[1];
4
+ const cssMapping = item[3];
5
+ if (!cssMapping) {
6
+ return content;
7
+ }
8
+ if (typeof btoa === 'function') {
9
+ const base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
10
+ const data = `sourceMappingURL=data:application/json;charset=utf-8;base64,${base64}`;
11
+ const sourceMapping = `/*# ${data} */`;
12
+ const sourceURLs = cssMapping.sources.map(source => `/*# sourceURL=${cssMapping.sourceRoot || ''}${source} */`);
13
+ return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
14
+ }
15
+ return [content].join('\n');
16
+ };
@@ -0,0 +1,28 @@
1
+ export function normalizeOptions(rawOptions: any, loaderContext: any): {
2
+ url: any;
3
+ import: any;
4
+ modules: any;
5
+ sourceMap: any;
6
+ importLoaders: any;
7
+ esModule: any;
8
+ exportType: any;
9
+ };
10
+ export function shouldUseIcssPlugin(options: any): boolean;
11
+ export function normalizeUrl(url: any, isStringValue: any): any;
12
+ export function requestify(url: any, rootContext: any, needToResolveURL?: boolean): any;
13
+ export function normalizeSourceMap(map: any, resourcePath: any): any;
14
+ export function getPreRequester({ loaders, loaderIndex }: {
15
+ loaders: any;
16
+ loaderIndex: any;
17
+ }): (number: any) => any;
18
+ export function getImportCode(imports: any, options: any): string;
19
+ export function getParcelCssModuleCode(result: any, api: any, replacements: any, options: any, loaderContext: any): string;
20
+ export function getExportCode(exports: any, replacements: any, icssPluginUsed: any, options: any): string;
21
+ export function resolveRequests(resolve: any, context: any, possibleRequests: any): Promise<any>;
22
+ export function isURLRequestable(url: any, options?: {}): {
23
+ requestable: boolean;
24
+ needResolve: boolean;
25
+ };
26
+ export function combineRequests(preRequest: any, url: any): any;
27
+ export function stringifyRequest(loaderContext: any, request: any): string;
28
+ export function isDataUrl(url: any): boolean;