This commit is contained in:
darenhsu
2022-07-17 13:16:16 +08:00
parent 84759556ff
commit befd344ab0
28070 changed files with 4008428 additions and 1 deletions
+7
View File
@@ -0,0 +1,7 @@
import { StyleResourcesFileFormat } from '..';
export declare const PACKAGE_NAME = "style-resources-loader";
export declare const ISSUES_URL: string;
export declare const LOADER_NAME: string;
export declare const VALIDATION_BASE_DATA_PATH = "options";
export declare const SUPPORTED_FILE_FORMATS: StyleResourcesFileFormat[];
export declare const SUPPORTED_FILE_EXTS: string[];
+11
View File
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PACKAGE_NAME = 'style-resources-loader';
exports.ISSUES_URL = `https://github.com/yenshih/${exports.PACKAGE_NAME}/issues`;
exports.LOADER_NAME = exports.PACKAGE_NAME.split('-')
.map(word => `${word[0].toUpperCase()}${word.slice(1)}`)
.join(' ');
exports.VALIDATION_BASE_DATA_PATH = 'options';
exports.SUPPORTED_FILE_FORMATS = ['css', 'sass', 'scss', 'less', 'styl'];
exports.SUPPORTED_FILE_EXTS = exports.SUPPORTED_FILE_FORMATS.map(type => `.${type}`);
//# sourceMappingURL=constants.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;AAEa,QAAA,YAAY,GAAG,wBAAwB,CAAC;AAExC,QAAA,UAAU,GAAG,8BAA8B,oBAAY,SAAS,CAAC;AAEjE,QAAA,WAAW,GAAG,oBAAY,CAAC,KAAK,CAAC,GAAG,CAAC;KAC7C,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;KACvD,IAAI,CAAC,GAAG,CAAC,CAAC;AAEF,QAAA,yBAAyB,GAAG,SAAS,CAAC;AAEtC,QAAA,sBAAsB,GAA+B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7F,QAAA,mBAAmB,GAAG,8BAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC"}
+5
View File
@@ -0,0 +1,5 @@
export declare const errorMessage: {
impossible: string;
syncCompilation: string;
invalidInjectorReturn: string;
};
+14
View File
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require(".");
const formatErrorMessage = (message) => `[${_1.PACKAGE_NAME}] ${message}`;
const messageByType = {
impossible: `This error is caused by a bug. Please file an issue: ${_1.ISSUES_URL}.`,
syncCompilation: 'Synchronous compilation is not supported.',
invalidInjectorReturn: 'Expected options.injector(...) returns a string. Instead received number.',
};
exports.errorMessage = Object.entries(messageByType).reduce((errorMessage, [type, message]) => ({
...errorMessage,
[type]: formatErrorMessage(message),
}), messageByType);
//# sourceMappingURL=error-message.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"error-message.js","sourceRoot":"","sources":["../../src/utils/error-message.ts"],"names":[],"mappings":";;AAAA,wBAA2C;AAE3C,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,IAAI,eAAY,KAAK,OAAO,EAAE,CAAC;AAE/E,MAAM,aAAa,GAAG;IAClB,UAAU,EAAE,wDAAwD,aAAU,GAAG;IACjF,eAAe,EAAE,2CAA2C;IAC5D,qBAAqB,EAAE,2EAA2E;CACrG,CAAC;AAEW,QAAA,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,MAAM,CAC5D,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAChC,GAAG,YAAY;IACf,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC;CACtC,CAAC,EACF,aAAa,CAChB,CAAC"}
+3
View File
@@ -0,0 +1,3 @@
/// <reference types="webpack" />
import { StyleResource, StyleResourcesLoaderNormalizedOptions } from '..';
export declare const getResources: (ctx: import("webpack").loader.LoaderContext, options: StyleResourcesLoaderNormalizedOptions) => Promise<StyleResource[]>;
+20
View File
@@ -0,0 +1,20 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const util_1 = __importDefault(require("util"));
const _1 = require(".");
exports.getResources = async (ctx, options) => {
const { resolveUrl } = options;
const files = await _1.matchFiles(ctx, options);
files.forEach(file => ctx.dependency(file));
const resources = await Promise.all(files.map(async (file) => {
const content = await util_1.default.promisify(fs_1.default.readFile)(file, 'utf8');
const resource = { file, content };
return resolveUrl ? _1.resolveImportUrl(ctx, resource) : resource;
}));
return resources;
};
//# sourceMappingURL=get-resources.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"get-resources.js","sourceRoot":"","sources":["../../src/utils/get-resources.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAIxB,wBAA+C;AAElC,QAAA,YAAY,GAAG,KAAK,EAAE,GAAkB,EAAE,OAA8C,EAAE,EAAE;IACrG,MAAM,EAAC,UAAU,EAAC,GAAG,OAAO,CAAC;IAE7B,MAAM,KAAK,GAAG,MAAM,aAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAE7C,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE;QACnB,MAAM,OAAO,GAAG,MAAM,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAkB,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;QAEhD,OAAO,UAAU,CAAC,CAAC,CAAC,mBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnE,CAAC,CAAC,CACL,CAAC;IAEF,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC"}
+10
View File
@@ -0,0 +1,10 @@
export * from './constants';
export * from './error-message';
export * from './get-resources';
export * from './inject-resources';
export * from './load-resources';
export * from './match-files';
export * from './normalize-options';
export * from './resolve-import-url';
export * from './type-guards';
export * from './validate-options';
+16
View File
@@ -0,0 +1,16 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./constants"));
__export(require("./error-message"));
__export(require("./get-resources"));
__export(require("./inject-resources"));
__export(require("./load-resources"));
__export(require("./match-files"));
__export(require("./normalize-options"));
__export(require("./resolve-import-url"));
__export(require("./type-guards"));
__export(require("./validate-options"));
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;AAAA,iCAA4B;AAC5B,qCAAgC;AAChC,qCAAgC;AAChC,wCAAmC;AACnC,sCAAiC;AACjC,mCAA8B;AAC9B,yCAAoC;AACpC,0CAAqC;AACrC,mCAA8B;AAC9B,wCAAmC"}
+2
View File
@@ -0,0 +1,2 @@
import { StyleResources, StyleResourcesLoaderNormalizedOptions } from '..';
export declare const injectResources: (options: StyleResourcesLoaderNormalizedOptions, source: string, resources: StyleResources) => Promise<string>;
+13
View File
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require(".");
exports.injectResources = async (options, source, resources) => {
const { injector } = options;
const dist = injector(source, resources);
const content = _1.isPromise(dist) ? await dist : dist;
if (typeof content !== 'string') {
throw new Error(_1.errorMessage.invalidInjectorReturn);
}
return content;
};
//# sourceMappingURL=inject-resources.js.map
@@ -0,0 +1 @@
{"version":3,"file":"inject-resources.js","sourceRoot":"","sources":["../../src/utils/inject-resources.ts"],"names":[],"mappings":";;AAEA,wBAA0C;AAE7B,QAAA,eAAe,GAAG,KAAK,EAChC,OAA8C,EAC9C,MAAc,EACd,SAAyB,EAC3B,EAAE;IACA,MAAM,EAAC,QAAQ,EAAC,GAAG,OAAO,CAAC;IAE3B,MAAM,IAAI,GAAQ,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAE9C,MAAM,OAAO,GAAG,YAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,eAAY,CAAC,qBAAqB,CAAC,CAAC;KACvD;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC"}
+2
View File
@@ -0,0 +1,2 @@
/// <reference types="webpack" />
export declare const loadResources: (ctx: import("webpack").loader.LoaderContext, source: string, callback: import("webpack").loader.loaderCallback) => Promise<void>;
+15
View File
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require(".");
exports.loadResources = async (ctx, source, callback) => {
try {
const options = _1.normalizeOptions(ctx);
const resources = await _1.getResources(ctx, options);
const content = await _1.injectResources(options, source, resources);
return callback(null, content);
}
catch (err) {
return callback(err);
}
};
//# sourceMappingURL=load-resources.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"load-resources.js","sourceRoot":"","sources":["../../src/utils/load-resources.ts"],"names":[],"mappings":";;AAEA,wBAAkE;AAErD,QAAA,aAAa,GAAG,KAAK,EAAE,GAAkB,EAAE,MAAc,EAAE,QAAwB,EAAE,EAAE;IAChG,IAAI;QACA,MAAM,OAAO,GAAG,mBAAgB,CAAC,GAAG,CAAC,CAAC;QAEtC,MAAM,SAAS,GAAG,MAAM,eAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAEnD,MAAM,OAAO,GAAG,MAAM,kBAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAElE,OAAO,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAClC;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;KACxB;AACL,CAAC,CAAC"}
+3
View File
@@ -0,0 +1,3 @@
/// <reference types="webpack" />
import { StyleResourcesLoaderNormalizedOptions } from '..';
export declare const matchFiles: (ctx: import("webpack").loader.LoaderContext, options: StyleResourcesLoaderNormalizedOptions) => Promise<string[]>;
+31
View File
@@ -0,0 +1,31 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const util_1 = __importDefault(require("util"));
const glob_1 = __importDefault(require("glob"));
const _1 = require(".");
const isLegacyWebpack = (ctx) => !!ctx.options;
const getRootContext = (ctx) => {
if (isLegacyWebpack(ctx)) {
return ctx.options.context;
}
return ctx.rootContext;
};
const flatten = (items) => {
const emptyItems = [];
return emptyItems.concat(...items);
};
exports.matchFiles = async (ctx, options) => {
const { patterns, globOptions } = options;
const files = await Promise.all(patterns.map(async (pattern) => {
const rootContext = getRootContext(ctx);
const absolutePattern = path_1.default.isAbsolute(pattern) ? pattern : path_1.default.resolve(rootContext, pattern);
const partialFiles = await util_1.default.promisify(glob_1.default)(absolutePattern, globOptions);
return partialFiles.filter(_1.isStyleFile);
}));
return [...new Set(flatten(files))].map(file => path_1.default.resolve(file));
};
//# sourceMappingURL=match-files.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"match-files.js","sourceRoot":"","sources":["../../src/utils/match-files.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,gDAAwB;AAExB,gDAAwB;AAIxB,wBAA8B;AAE9B,MAAM,eAAe,GAAG,CAAC,GAAQ,EAAuC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;AAEzF,MAAM,cAAc,GAAG,CAAC,GAAkB,EAAE,EAAE;IAE1C,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE;QACtB,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC;KAC9B;IAED,OAAO,GAAG,CAAC,WAAW,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAI,KAAY,EAAE,EAAE;IAChC,MAAM,UAAU,GAAQ,EAAE,CAAC;IAE3B,OAAO,UAAU,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;AACvC,CAAC,CAAC;AAEW,QAAA,UAAU,GAAG,KAAK,EAAE,GAAkB,EAAE,OAA8C,EAAE,EAAE;IACnG,MAAM,EAAC,QAAQ,EAAE,WAAW,EAAC,GAAG,OAAO,CAAC;IAExC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAC3B,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAC,OAAO,EAAC,EAAE;QACzB,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,eAAe,GAAG,cAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAChG,MAAM,YAAY,GAAG,MAAM,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAE9E,OAAO,YAAY,CAAC,MAAM,CAAC,cAAW,CAAC,CAAC;IAC5C,CAAC,CAAC,CACL,CAAC;IAQF,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACxE,CAAC,CAAC"}
+3
View File
@@ -0,0 +1,3 @@
/// <reference types="webpack" />
import { StyleResourcesLoaderNormalizedOptions } from '..';
export declare const normalizeOptions: (ctx: import("webpack").loader.LoaderContext) => StyleResourcesLoaderNormalizedOptions;
+29
View File
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = require("os");
const loader_utils_1 = require("loader-utils");
const _1 = require(".");
const normalizePatterns = (patterns) => Array.isArray(patterns) ? patterns : [patterns];
const coerceContentEOL = (content) => (content.endsWith(os_1.EOL) ? content : `${content}${os_1.EOL}`);
const getResourceContent = ({ content }) => coerceContentEOL(content);
const normalizeInjector = (injector) => {
if (typeof injector === 'undefined' || injector === 'prepend') {
return (source, resources) => resources.map(getResourceContent).join('') + source;
}
if (injector === 'append') {
return (source, resources) => source + resources.map(getResourceContent).join('');
}
return injector;
};
exports.normalizeOptions = (ctx) => {
const options = loader_utils_1.getOptions(ctx) || {};
_1.validateOptions(options);
const { patterns, injector, globOptions = {}, resolveUrl = true } = options;
return {
patterns: normalizePatterns(patterns),
injector: normalizeInjector(injector),
globOptions,
resolveUrl,
};
};
//# sourceMappingURL=normalize-options.js.map
@@ -0,0 +1 @@
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../src/utils/normalize-options.ts"],"names":[],"mappings":";;AAAA,2BAAuB;AAEvB,+CAAwC;AAUxC,wBAAkC;AAElC,MAAM,iBAAiB,GAAG,CAAC,QAAiD,EAAE,EAAE,CAC5E,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEpD,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,QAAG,EAAE,CAAC,CAAC;AACrG,MAAM,kBAAkB,GAAG,CAAC,EAAC,OAAO,EAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAEnF,MAAM,iBAAiB,GAAG,CAAC,QAAiD,EAAoC,EAAE;IAC9G,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC3D,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;KACrF;IAED,IAAI,QAAQ,KAAK,QAAQ,EAAE;QACvB,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KACrF;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEW,QAAA,gBAAgB,GAAG,CAAC,GAAkB,EAAyC,EAAE;IAC1F,MAAM,OAAO,GAAG,yBAAU,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAEtC,kBAAe,CAA8B,OAAO,CAAC,CAAC;IAEtD,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,GAAG,EAAE,EAAE,UAAU,GAAG,IAAI,EAAC,GAAG,OAAO,CAAC;IAE1E,OAAO;QACH,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,CAAC;QACrC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,CAAC;QACrC,WAAW;QACX,UAAU;KACb,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,3 @@
/// <reference types="webpack" />
import { StyleResource } from '..';
export declare const resolveImportUrl: (ctx: import("webpack").loader.LoaderContext, { file, content }: StyleResource) => StyleResource;
+22
View File
@@ -0,0 +1,22 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const regex = /@(?:import|require)\s+(?:\([a-z,\s]+\)\s*)?['"]?([^'"\s;]+)['"]?;?/gu;
exports.resolveImportUrl = (ctx, { file, content }) => ({
file,
content: content.replace(regex, (match, pathToResource) => {
if (!pathToResource || /^[~/]/u.test(pathToResource)) {
return match;
}
const absolutePathToResource = path_1.default.resolve(path_1.default.dirname(file), pathToResource);
const relativePathFromContextToResource = path_1.default
.relative(ctx.context, absolutePathToResource)
.split(path_1.default.sep)
.join('/');
return match.replace(pathToResource, relativePathFromContextToResource);
}),
});
//# sourceMappingURL=resolve-import-url.js.map
@@ -0,0 +1 @@
{"version":3,"file":"resolve-import-url.js","sourceRoot":"","sources":["../../src/utils/resolve-import-url.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAKxB,MAAM,KAAK,GAAG,sEAAsE,CAAC;AAExE,QAAA,gBAAgB,GAAG,CAAC,GAAkB,EAAE,EAAC,IAAI,EAAE,OAAO,EAAgB,EAAiB,EAAE,CAAC,CAAC;IACpG,IAAI;IACJ,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,KAAa,EAAE,cAAuB,EAAE,EAAE;QACvE,IAAI,CAAC,cAAc,IAAI,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;YAClD,OAAO,KAAK,CAAC;SAChB;QAED,MAAM,sBAAsB,GAAG,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,CAAC;QAChF,MAAM,iCAAiC,GAAG,cAAI;aACzC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,sBAAsB,CAAC;aAC7C,KAAK,CAAC,cAAI,CAAC,GAAG,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEf,OAAO,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,iCAAiC,CAAC,CAAC;IAC5E,CAAC,CAAC;CACL,CAAC,CAAC"}
+4
View File
@@ -0,0 +1,4 @@
import isPromise from 'is-promise';
export declare const isFunction: <T extends (...args: any[]) => any>(arg: any) => arg is T;
export declare const isStyleFile: (file: string) => boolean;
export { isPromise };
+12
View File
@@ -0,0 +1,12 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const is_promise_1 = __importDefault(require("is-promise"));
exports.isPromise = is_promise_1.default;
const _1 = require(".");
exports.isFunction = (arg) => typeof arg === 'function';
exports.isStyleFile = (file) => _1.SUPPORTED_FILE_EXTS.includes(path_1.default.extname(file));
//# sourceMappingURL=type-guards.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"type-guards.js","sourceRoot":"","sources":["../../src/utils/type-guards.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,4DAAmC;AAQ3B,oBARD,oBAAS,CAQC;AANjB,wBAAsC;AAEzB,QAAA,UAAU,GAAG,CAAoC,GAAQ,EAAY,EAAE,CAAC,OAAO,GAAG,KAAK,UAAU,CAAC;AAElG,QAAA,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,sBAAmB,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC"}
+1
View File
@@ -0,0 +1 @@
export declare const validateOptions: <T extends {}>(options: any) => asserts options is T;
+13
View File
@@ -0,0 +1,13 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const schema_utils_1 = __importDefault(require("schema-utils"));
const __1 = require("..");
const _1 = require(".");
exports.validateOptions = options => schema_utils_1.default(__1.schema, options, {
name: _1.LOADER_NAME,
baseDataPath: _1.VALIDATION_BASE_DATA_PATH,
});
//# sourceMappingURL=validate-options.js.map
@@ -0,0 +1 @@
{"version":3,"file":"validate-options.js","sourceRoot":"","sources":["../../src/utils/validate-options.ts"],"names":[],"mappings":";;;;;AAAA,gEAAoC;AAEpC,0BAA0B;AAE1B,wBAAyD;AAE5C,QAAA,eAAe,GAAyD,OAAO,CAAC,EAAE,CAC3F,sBAAQ,CAAC,UAAM,EAAE,OAAO,EAAE;IACtB,IAAI,EAAE,cAAW;IACjB,YAAY,EAAE,4BAAyB;CAC1C,CAAC,CAAC"}