magic-comments-loader 1.6.0 → 2.0.0
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 +16 -325
- package/dist/cjs/comment.cjs +8 -5
- package/dist/cjs/formatter.cjs +11 -10
- package/dist/cjs/loader.cjs +6 -4
- package/dist/cjs/schema.cjs +3 -25
- package/dist/comment.js +8 -5
- package/dist/formatter.js +11 -10
- package/dist/loader.js +5 -3
- package/dist/schema.js +3 -25
- package/package.json +2 -2
- package/dist/booleanComment.js +0 -90
- package/dist/cjs/booleanComment.cjs +0 -97
- package/dist/cjs/enumComment.cjs +0 -99
- package/dist/cjs/regexComment.cjs +0 -101
- package/dist/cjs/strategy.cjs +0 -27
- package/dist/cjs/util.cjs +0 -66
- package/dist/cjs/webpackChunkName.cjs +0 -61
- package/dist/cjs/webpackExclude.cjs +0 -13
- package/dist/cjs/webpackExports.cjs +0 -72
- package/dist/cjs/webpackFetchPriority.cjs +0 -13
- package/dist/cjs/webpackIgnore.cjs +0 -18
- package/dist/cjs/webpackInclude.cjs +0 -13
- package/dist/cjs/webpackMode.cjs +0 -13
- package/dist/cjs/webpackPrefetch.cjs +0 -18
- package/dist/cjs/webpackPreload.cjs +0 -18
- package/dist/enumComment.js +0 -93
- package/dist/regexComment.js +0 -95
- package/dist/strategy.js +0 -21
- package/dist/util.js +0 -54
- package/dist/webpackChunkName.js +0 -54
- package/dist/webpackExclude.js +0 -6
- package/dist/webpackExports.js +0 -65
- package/dist/webpackFetchPriority.js +0 -6
- package/dist/webpackIgnore.js +0 -11
- package/dist/webpackInclude.js +0 -6
- package/dist/webpackMode.js +0 -6
- package/dist/webpackPrefetch.js +0 -11
- package/dist/webpackPreload.js +0 -11
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.webpackIgnore = exports.schema = void 0;
|
|
7
|
-
var _booleanComment = require("./booleanComment.cjs");
|
|
8
|
-
const schema = (0, _booleanComment.getSchema)();
|
|
9
|
-
exports.schema = schema;
|
|
10
|
-
const webpackIgnore = (filepath, importPath, value, match) => {
|
|
11
|
-
const config = (0, _booleanComment.getConfig)(value, match, filepath, importPath);
|
|
12
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
13
|
-
if (!isActive) {
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
return 'webpackIgnore: true';
|
|
17
|
-
};
|
|
18
|
-
exports.webpackIgnore = webpackIgnore;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.webpackInclude = exports.schema = void 0;
|
|
7
|
-
var _regexComment = require("./regexComment.cjs");
|
|
8
|
-
const {
|
|
9
|
-
comment: webpackInclude,
|
|
10
|
-
schema
|
|
11
|
-
} = (0, _regexComment.getRegexComment)('include');
|
|
12
|
-
exports.schema = schema;
|
|
13
|
-
exports.webpackInclude = webpackInclude;
|
package/dist/cjs/webpackMode.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.webpackMode = exports.schema = void 0;
|
|
7
|
-
var _enumComment = require("./enumComment.cjs");
|
|
8
|
-
const {
|
|
9
|
-
comment: webpackMode,
|
|
10
|
-
schema
|
|
11
|
-
} = (0, _enumComment.getEnumComment)('mode', ['lazy', 'lazy-once', 'eager', 'weak'], 'lazy');
|
|
12
|
-
exports.schema = schema;
|
|
13
|
-
exports.webpackMode = webpackMode;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.webpackPrefetch = exports.schema = void 0;
|
|
7
|
-
var _booleanComment = require("./booleanComment.cjs");
|
|
8
|
-
const schema = (0, _booleanComment.getSchema)();
|
|
9
|
-
exports.schema = schema;
|
|
10
|
-
const webpackPrefetch = (filepath, importPath, value, match) => {
|
|
11
|
-
const config = (0, _booleanComment.getConfig)(value, match, filepath, importPath);
|
|
12
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
13
|
-
if (!isActive) {
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
return 'webpackPrefetch: true';
|
|
17
|
-
};
|
|
18
|
-
exports.webpackPrefetch = webpackPrefetch;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.webpackPreload = exports.schema = void 0;
|
|
7
|
-
var _booleanComment = require("./booleanComment.cjs");
|
|
8
|
-
const schema = (0, _booleanComment.getSchema)();
|
|
9
|
-
exports.schema = schema;
|
|
10
|
-
const webpackPreload = (filepath, importPath, value, match) => {
|
|
11
|
-
const config = (0, _booleanComment.getConfig)(value, match, filepath, importPath);
|
|
12
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
13
|
-
if (!isActive) {
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
return 'webpackPreload: true';
|
|
17
|
-
};
|
|
18
|
-
exports.webpackPreload = webpackPreload;
|
package/dist/enumComment.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { getOverrideConfig, getOverrideSchema } from './util.js';
|
|
2
|
-
const getEnumComment = (name, enums, defaultValue) => {
|
|
3
|
-
const configSchema = {
|
|
4
|
-
type: 'object',
|
|
5
|
-
properties: {
|
|
6
|
-
active: {
|
|
7
|
-
oneOf: [{
|
|
8
|
-
type: 'boolean'
|
|
9
|
-
}, {
|
|
10
|
-
instanceof: 'Function'
|
|
11
|
-
}]
|
|
12
|
-
},
|
|
13
|
-
[name]: {
|
|
14
|
-
oneOf: [{
|
|
15
|
-
enum: enums
|
|
16
|
-
}, {
|
|
17
|
-
instanceof: 'Function'
|
|
18
|
-
}]
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
additionalProperties: false
|
|
22
|
-
};
|
|
23
|
-
const schema = {
|
|
24
|
-
oneOf: [{
|
|
25
|
-
type: 'boolean'
|
|
26
|
-
}, {
|
|
27
|
-
type: 'string'
|
|
28
|
-
}, {
|
|
29
|
-
instanceof: 'Function'
|
|
30
|
-
}, {
|
|
31
|
-
type: 'object',
|
|
32
|
-
properties: {
|
|
33
|
-
config: configSchema,
|
|
34
|
-
overrides: getOverrideSchema(configSchema)
|
|
35
|
-
},
|
|
36
|
-
required: ['config'],
|
|
37
|
-
additionalProperties: false
|
|
38
|
-
}]
|
|
39
|
-
};
|
|
40
|
-
const defaultConfig = {
|
|
41
|
-
active: true,
|
|
42
|
-
[name]: defaultValue
|
|
43
|
-
};
|
|
44
|
-
const getConfig = (value, filepath) => {
|
|
45
|
-
if (value === true) {
|
|
46
|
-
return defaultConfig;
|
|
47
|
-
}
|
|
48
|
-
if (value === false) {
|
|
49
|
-
return {
|
|
50
|
-
...defaultConfig,
|
|
51
|
-
active: false
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
if (typeof value === 'string' || typeof value === 'function') {
|
|
55
|
-
return {
|
|
56
|
-
...defaultConfig,
|
|
57
|
-
[name]: value
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
let config = {
|
|
61
|
-
...defaultConfig,
|
|
62
|
-
...value.config
|
|
63
|
-
};
|
|
64
|
-
if (Array.isArray(value.overrides)) {
|
|
65
|
-
config = getOverrideConfig(value.overrides, filepath, config);
|
|
66
|
-
}
|
|
67
|
-
return config;
|
|
68
|
-
};
|
|
69
|
-
const comment = (filepath, importPath, value) => {
|
|
70
|
-
let enumValue = '';
|
|
71
|
-
const commentSuffix = `${name[0].toUpperCase()}${name.slice(1)}`;
|
|
72
|
-
const config = getConfig(value, filepath);
|
|
73
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
74
|
-
if (!isActive) {
|
|
75
|
-
return '';
|
|
76
|
-
}
|
|
77
|
-
if (typeof config[name] === 'function') {
|
|
78
|
-
enumValue = config[name](filepath, importPath);
|
|
79
|
-
}
|
|
80
|
-
if (typeof config[name] === 'string') {
|
|
81
|
-
enumValue = config[name];
|
|
82
|
-
}
|
|
83
|
-
if (!enums.includes(enumValue)) {
|
|
84
|
-
return '';
|
|
85
|
-
}
|
|
86
|
-
return `webpack${commentSuffix}: "${enumValue}"`;
|
|
87
|
-
};
|
|
88
|
-
return {
|
|
89
|
-
comment,
|
|
90
|
-
schema
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
export { getEnumComment };
|
package/dist/regexComment.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { getOverrideConfig, getOverrideSchema } from './util.js';
|
|
2
|
-
const getRegexComment = type => {
|
|
3
|
-
const configSchema = {
|
|
4
|
-
type: 'object',
|
|
5
|
-
properties: {
|
|
6
|
-
active: {
|
|
7
|
-
oneOf: [{
|
|
8
|
-
type: 'boolean'
|
|
9
|
-
}, {
|
|
10
|
-
instanceof: 'Function'
|
|
11
|
-
}]
|
|
12
|
-
},
|
|
13
|
-
include: {
|
|
14
|
-
oneOf: [{
|
|
15
|
-
instanceof: 'Function'
|
|
16
|
-
}, {
|
|
17
|
-
instanceof: 'RegExp'
|
|
18
|
-
}]
|
|
19
|
-
},
|
|
20
|
-
exclude: {
|
|
21
|
-
oneOf: [{
|
|
22
|
-
instanceof: 'Function'
|
|
23
|
-
}, {
|
|
24
|
-
instanceof: 'RegExp'
|
|
25
|
-
}]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
additionalProperties: false
|
|
29
|
-
};
|
|
30
|
-
const schema = {
|
|
31
|
-
oneOf: [{
|
|
32
|
-
instanceof: 'Function'
|
|
33
|
-
}, {
|
|
34
|
-
instanceof: 'RegExp'
|
|
35
|
-
}, {
|
|
36
|
-
type: 'object',
|
|
37
|
-
properties: {
|
|
38
|
-
config: configSchema,
|
|
39
|
-
overrides: getOverrideSchema(configSchema)
|
|
40
|
-
},
|
|
41
|
-
required: ['config'],
|
|
42
|
-
additionalProperties: false
|
|
43
|
-
}]
|
|
44
|
-
};
|
|
45
|
-
const getConfig = (value, filepath) => {
|
|
46
|
-
if (typeof value === 'function' || value instanceof RegExp) {
|
|
47
|
-
return {
|
|
48
|
-
active: true,
|
|
49
|
-
[type]: value
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
let config = {
|
|
53
|
-
active: true,
|
|
54
|
-
...value.config
|
|
55
|
-
};
|
|
56
|
-
if (Array.isArray(value.overrides)) {
|
|
57
|
-
config = getOverrideConfig(value.overrides, filepath, config);
|
|
58
|
-
}
|
|
59
|
-
return config;
|
|
60
|
-
};
|
|
61
|
-
const comment = (filepath, importPath, value) => {
|
|
62
|
-
const config = getConfig(value, filepath);
|
|
63
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
64
|
-
let regex = null;
|
|
65
|
-
if (!isActive) {
|
|
66
|
-
return '';
|
|
67
|
-
}
|
|
68
|
-
if (typeof config[type] === 'function') {
|
|
69
|
-
regex = config[type](filepath, importPath);
|
|
70
|
-
}
|
|
71
|
-
if (config[type] instanceof RegExp) {
|
|
72
|
-
regex = config[type];
|
|
73
|
-
}
|
|
74
|
-
if (!(regex instanceof RegExp)) {
|
|
75
|
-
return '';
|
|
76
|
-
}
|
|
77
|
-
const source = regex.source;
|
|
78
|
-
const typeName = `${type[0].toUpperCase()}${type.slice(1)}`;
|
|
79
|
-
/**
|
|
80
|
-
* Check if the provided RegExp ends in one or more '*'
|
|
81
|
-
* and if so be sure to escape the ending '/' in the
|
|
82
|
-
* comments regular expression so as not to break the
|
|
83
|
-
* comment and cause a SyntaxError.
|
|
84
|
-
*/
|
|
85
|
-
if (/(\*+)$/.test(source)) {
|
|
86
|
-
return `webpack${typeName}: /${source}\\/${regex.flags}`;
|
|
87
|
-
}
|
|
88
|
-
return `webpack${typeName}: /${source}/${regex.flags}`;
|
|
89
|
-
};
|
|
90
|
-
return {
|
|
91
|
-
comment,
|
|
92
|
-
schema
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
export { getRegexComment };
|
package/dist/strategy.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { webpackChunkName } from './webpackChunkName.js';
|
|
2
|
-
import { webpackFetchPriority } from './webpackFetchPriority.js';
|
|
3
|
-
import { webpackMode } from './webpackMode.js';
|
|
4
|
-
import { webpackIgnore } from './webpackIgnore.js';
|
|
5
|
-
import { webpackPreload } from './webpackPreload.js';
|
|
6
|
-
import { webpackPrefetch } from './webpackPrefetch.js';
|
|
7
|
-
import { webpackExports } from './webpackExports.js';
|
|
8
|
-
import { webpackInclude } from './webpackInclude.js';
|
|
9
|
-
import { webpackExclude } from './webpackExclude.js';
|
|
10
|
-
const commentFor = {
|
|
11
|
-
webpackChunkName,
|
|
12
|
-
webpackFetchPriority,
|
|
13
|
-
webpackMode,
|
|
14
|
-
webpackIgnore,
|
|
15
|
-
webpackPreload,
|
|
16
|
-
webpackPrefetch,
|
|
17
|
-
webpackExports,
|
|
18
|
-
webpackInclude,
|
|
19
|
-
webpackExclude
|
|
20
|
-
};
|
|
21
|
-
export { commentFor };
|
package/dist/util.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import micromatch from 'micromatch';
|
|
2
|
-
const pathIsMatch = (path, files) => {
|
|
3
|
-
const globs = [];
|
|
4
|
-
const notglobs = [];
|
|
5
|
-
if (!Array.isArray(files)) {
|
|
6
|
-
files = [files];
|
|
7
|
-
}
|
|
8
|
-
files.forEach(file => {
|
|
9
|
-
if (/^!/.test(file)) {
|
|
10
|
-
notglobs.push(file);
|
|
11
|
-
} else {
|
|
12
|
-
globs.push(file);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return (globs.length === 0 || globs.some(glob => micromatch.isMatch(path, glob))) && notglobs.every(notglob => micromatch.isMatch(path, notglob));
|
|
16
|
-
};
|
|
17
|
-
const getOverrideSchema = commentSchema => ({
|
|
18
|
-
type: 'array',
|
|
19
|
-
items: {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
config: commentSchema,
|
|
23
|
-
files: {
|
|
24
|
-
oneOf: [{
|
|
25
|
-
type: 'string'
|
|
26
|
-
}, {
|
|
27
|
-
type: 'array',
|
|
28
|
-
items: {
|
|
29
|
-
type: 'string'
|
|
30
|
-
}
|
|
31
|
-
}]
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
additionalProperties: false
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const getOverrideConfig = (overrides, filepath, config) => {
|
|
38
|
-
const length = overrides.length;
|
|
39
|
-
for (let i = 0; i < length; i++) {
|
|
40
|
-
if (pathIsMatch(filepath, overrides[i].files)) {
|
|
41
|
-
return {
|
|
42
|
-
...config,
|
|
43
|
-
...overrides[i].config
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return config;
|
|
48
|
-
};
|
|
49
|
-
const getBareImportSpecifier = specifier => {
|
|
50
|
-
return specifier.replace(/['"`]/g, '');
|
|
51
|
-
};
|
|
52
|
-
const importPrefix = /^(?:(\.{1,2}\/)+)|^\/|^.+:\/\/\/?[.-\w]+\//;
|
|
53
|
-
const dynamicImportsWithoutComments = /(?<![\w.]|#!|(?:\/{2}.+\n?)+|\/\*[\s\w]*?|\*.+?|['"`][^)$,\n]*)import\s*\((?!\s*\/\*)(?<path>\s*?['"`][^)]+['"`]\s*)\)(?!\s*?\*\/)/gm;
|
|
54
|
-
export { getBareImportSpecifier, getOverrideConfig, getOverrideSchema, pathIsMatch, importPrefix, dynamicImportsWithoutComments };
|
package/dist/webpackChunkName.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { parse } from 'path';
|
|
2
|
-
import { getSchema, getConfig } from './booleanComment.js';
|
|
3
|
-
const schema = getSchema({
|
|
4
|
-
type: 'object',
|
|
5
|
-
properties: {
|
|
6
|
-
active: {
|
|
7
|
-
oneOf: [{
|
|
8
|
-
type: 'boolean'
|
|
9
|
-
}, {
|
|
10
|
-
instanceof: 'Function'
|
|
11
|
-
}]
|
|
12
|
-
},
|
|
13
|
-
basename: {
|
|
14
|
-
type: 'boolean'
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
additionalProperties: false
|
|
18
|
-
});
|
|
19
|
-
const webpackChunkName = (filepath, importPath, value, match) => {
|
|
20
|
-
const config = getConfig(value, match, filepath, importPath, {
|
|
21
|
-
active: true,
|
|
22
|
-
basename: false
|
|
23
|
-
});
|
|
24
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
25
|
-
if (!isActive) {
|
|
26
|
-
return '';
|
|
27
|
-
}
|
|
28
|
-
if (typeof config.dynamic === 'string') {
|
|
29
|
-
return `webpackChunkName: "${config.dynamic}"`;
|
|
30
|
-
}
|
|
31
|
-
const {
|
|
32
|
-
basename
|
|
33
|
-
} = config;
|
|
34
|
-
const {
|
|
35
|
-
dir,
|
|
36
|
-
name
|
|
37
|
-
} = parse(importPath);
|
|
38
|
-
const segments = `${dir}/${name}`.split('/').filter(segment => /\w/.test(segment));
|
|
39
|
-
const chunkName = basename ? name : segments.reduce((prev, curr) => {
|
|
40
|
-
/**
|
|
41
|
-
* Check for dynamic expressions in imports.
|
|
42
|
-
* If it exists, it has to be at least the second path
|
|
43
|
-
* segment or greater, i.e. can not be the first.
|
|
44
|
-
*
|
|
45
|
-
* @see https://webpack.js.org/api/module-methods/#dynamic-expressions-in-import
|
|
46
|
-
*/
|
|
47
|
-
if (/^\${/.test(curr)) {
|
|
48
|
-
return prev ? `${prev}-[request]` : '[request]';
|
|
49
|
-
}
|
|
50
|
-
return prev ? `${prev}-${curr}` : curr;
|
|
51
|
-
}, '');
|
|
52
|
-
return `webpackChunkName: "${chunkName}"`;
|
|
53
|
-
};
|
|
54
|
-
export { webpackChunkName, schema };
|
package/dist/webpackExclude.js
DELETED
package/dist/webpackExports.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { getOverrideConfig, getOverrideSchema } from './util.js';
|
|
2
|
-
const configSchema = {
|
|
3
|
-
type: 'object',
|
|
4
|
-
properties: {
|
|
5
|
-
active: {
|
|
6
|
-
oneOf: [{
|
|
7
|
-
type: 'boolean'
|
|
8
|
-
}, {
|
|
9
|
-
instanceof: 'Function'
|
|
10
|
-
}]
|
|
11
|
-
},
|
|
12
|
-
exports: {
|
|
13
|
-
instanceof: 'Function'
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
additionalProperties: false
|
|
17
|
-
};
|
|
18
|
-
const schema = {
|
|
19
|
-
oneOf: [{
|
|
20
|
-
instanceof: 'Function'
|
|
21
|
-
}, {
|
|
22
|
-
type: 'object',
|
|
23
|
-
properties: {
|
|
24
|
-
config: configSchema,
|
|
25
|
-
overrides: getOverrideSchema(configSchema)
|
|
26
|
-
},
|
|
27
|
-
required: ['config'],
|
|
28
|
-
additionalProperties: false
|
|
29
|
-
}]
|
|
30
|
-
};
|
|
31
|
-
const defaultConfig = {
|
|
32
|
-
active: true
|
|
33
|
-
};
|
|
34
|
-
const getConfig = (value, filepath) => {
|
|
35
|
-
if (typeof value === 'function') {
|
|
36
|
-
return {
|
|
37
|
-
...defaultConfig,
|
|
38
|
-
exports: value
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
let config = {
|
|
42
|
-
...defaultConfig,
|
|
43
|
-
...value.config
|
|
44
|
-
};
|
|
45
|
-
if (Array.isArray(value.overrides)) {
|
|
46
|
-
config = getOverrideConfig(value.overrides, filepath, config);
|
|
47
|
-
}
|
|
48
|
-
return config;
|
|
49
|
-
};
|
|
50
|
-
const webpackExports = (filepath, importPath, value) => {
|
|
51
|
-
let exports = '';
|
|
52
|
-
let configExports = [];
|
|
53
|
-
const config = getConfig(value, filepath);
|
|
54
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
55
|
-
if (!isActive || typeof config.exports !== 'function') {
|
|
56
|
-
return '';
|
|
57
|
-
}
|
|
58
|
-
configExports = config.exports(filepath, importPath);
|
|
59
|
-
if (!Array.isArray(configExports)) {
|
|
60
|
-
return '';
|
|
61
|
-
}
|
|
62
|
-
exports = `["${configExports.reduce((curr, next) => `${curr}", "${next}`)}"]`;
|
|
63
|
-
return `webpackExports: ${exports}`;
|
|
64
|
-
};
|
|
65
|
-
export { webpackExports, schema };
|
package/dist/webpackIgnore.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getSchema, getConfig } from './booleanComment.js';
|
|
2
|
-
const schema = getSchema();
|
|
3
|
-
const webpackIgnore = (filepath, importPath, value, match) => {
|
|
4
|
-
const config = getConfig(value, match, filepath, importPath);
|
|
5
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
6
|
-
if (!isActive) {
|
|
7
|
-
return '';
|
|
8
|
-
}
|
|
9
|
-
return 'webpackIgnore: true';
|
|
10
|
-
};
|
|
11
|
-
export { webpackIgnore, schema };
|
package/dist/webpackInclude.js
DELETED
package/dist/webpackMode.js
DELETED
package/dist/webpackPrefetch.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getSchema, getConfig } from './booleanComment.js';
|
|
2
|
-
const schema = getSchema();
|
|
3
|
-
const webpackPrefetch = (filepath, importPath, value, match) => {
|
|
4
|
-
const config = getConfig(value, match, filepath, importPath);
|
|
5
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
6
|
-
if (!isActive) {
|
|
7
|
-
return '';
|
|
8
|
-
}
|
|
9
|
-
return 'webpackPrefetch: true';
|
|
10
|
-
};
|
|
11
|
-
export { webpackPrefetch, schema };
|
package/dist/webpackPreload.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getSchema, getConfig } from './booleanComment.js';
|
|
2
|
-
const schema = getSchema();
|
|
3
|
-
const webpackPreload = (filepath, importPath, value, match) => {
|
|
4
|
-
const config = getConfig(value, match, filepath, importPath);
|
|
5
|
-
const isActive = typeof config.active === 'function' ? config.active(filepath, importPath) : config.active;
|
|
6
|
-
if (!isActive) {
|
|
7
|
-
return '';
|
|
8
|
-
}
|
|
9
|
-
return 'webpackPreload: true';
|
|
10
|
-
};
|
|
11
|
-
export { webpackPreload, schema };
|