balm-core 5.2.0 → 6.0.0-alpha.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/dist/index.cjs +2191 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +559 -0
- package/dist/index.d.ts +559 -0
- package/dist/index.js +2098 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -123
- package/src/balm.ts +103 -0
- package/src/bundler/esbuild.ts +47 -0
- package/src/bundler/index.ts +3 -0
- package/src/bundler/rollup.ts +39 -0
- package/src/bundler/webpack.ts +82 -0
- package/src/config/constants.ts +12 -0
- package/src/config/defaults.ts +209 -0
- package/src/config/index.ts +112 -0
- package/src/hooks/index.ts +192 -0
- package/src/index.ts +16 -0
- package/src/pipeline/file.ts +69 -0
- package/src/pipeline/index.ts +10 -0
- package/src/pipeline/pipeline.ts +132 -0
- package/src/pipeline/transforms/cache.ts +96 -0
- package/src/pipeline/transforms/htmlmin.ts +18 -0
- package/src/pipeline/transforms/less.ts +75 -0
- package/src/pipeline/transforms/postcss.ts +43 -0
- package/src/pipeline/transforms/rename.ts +37 -0
- package/src/pipeline/transforms/replace.ts +30 -0
- package/src/pipeline/transforms/sass.ts +106 -0
- package/src/pipeline/transforms/terser.ts +20 -0
- package/src/runner/dag.ts +77 -0
- package/src/runner/task.ts +38 -0
- package/src/shims.d.ts +5 -0
- package/src/tasks/cache.ts +58 -0
- package/src/tasks/clean.ts +21 -0
- package/src/tasks/copy.ts +36 -0
- package/src/tasks/ftp.ts +90 -0
- package/src/tasks/html.ts +78 -0
- package/src/tasks/index.ts +13 -0
- package/src/tasks/publish.ts +71 -0
- package/src/tasks/pwa.ts +49 -0
- package/src/tasks/remove.ts +24 -0
- package/src/tasks/replace.ts +34 -0
- package/src/tasks/script.ts +28 -0
- package/src/tasks/server.ts +89 -0
- package/src/tasks/style.ts +57 -0
- package/src/tasks/zip.ts +65 -0
- package/src/types/index.ts +200 -0
- package/src/utilities/file.ts +120 -0
- package/src/utilities/logger.ts +63 -0
- package/src/utilities/utils.ts +46 -0
- package/src/utilities/workspace.ts +38 -0
- package/src/watcher/index.ts +100 -0
- package/tsconfig.json +8 -0
- package/tsup.config.ts +12 -0
- package/README.md +0 -196
- package/index.d.ts +0 -360
- package/lib/balm.js +0 -49
- package/lib/bootstrap/check_config.js +0 -43
- package/lib/bootstrap/index.js +0 -87
- package/lib/bundler/esbuild/build.js +0 -26
- package/lib/bundler/esbuild/index.js +0 -7
- package/lib/bundler/esbuild/options.js +0 -7
- package/lib/bundler/esbuild/transform.js +0 -36
- package/lib/bundler/rollup/build.js +0 -52
- package/lib/bundler/rollup/entry.js +0 -28
- package/lib/bundler/rollup/index.js +0 -20
- package/lib/bundler/rollup/output.js +0 -20
- package/lib/bundler/rollup/plugins.js +0 -31
- package/lib/bundler/webpack/config/common.js +0 -135
- package/lib/bundler/webpack/config/dev.js +0 -12
- package/lib/bundler/webpack/config/env.js +0 -67
- package/lib/bundler/webpack/config/index.js +0 -6
- package/lib/bundler/webpack/config/prod.js +0 -39
- package/lib/bundler/webpack/config/regex.js +0 -10
- package/lib/bundler/webpack/entry.js +0 -65
- package/lib/bundler/webpack/index.js +0 -32
- package/lib/bundler/webpack/loaders.js +0 -50
- package/lib/bundler/webpack/output.js +0 -41
- package/lib/bundler/webpack/rules/asset.js +0 -33
- package/lib/bundler/webpack/rules/babel.js +0 -19
- package/lib/bundler/webpack/rules/css.js +0 -109
- package/lib/bundler/webpack/rules/html.js +0 -15
- package/lib/bundler/webpack/rules/index.js +0 -10
- package/lib/config/assets.js +0 -30
- package/lib/config/constants.js +0 -14
- package/lib/config/env.js +0 -35
- package/lib/config/extras.js +0 -6
- package/lib/config/ftp.js +0 -6
- package/lib/config/globals.js +0 -43
- package/lib/config/html.js +0 -22
- package/lib/config/images.js +0 -4
- package/lib/config/index.js +0 -63
- package/lib/config/logs.js +0 -11
- package/lib/config/paths.js +0 -46
- package/lib/config/pwa.js +0 -24
- package/lib/config/roots.js +0 -9
- package/lib/config/scripts.js +0 -162
- package/lib/config/server.js +0 -84
- package/lib/config/spinner.js +0 -9
- package/lib/config/styles.js +0 -67
- package/lib/hello.js +0 -19
- package/lib/hooks/index.js +0 -94
- package/lib/hooks/maker.js +0 -59
- package/lib/index.js +0 -5
- package/lib/middlewares/history.js +0 -6
- package/lib/middlewares/index.js +0 -11
- package/lib/middlewares/proxy.js +0 -28
- package/lib/middlewares/webpack.js +0 -26
- package/lib/plugins/htmlmin.js +0 -39
- package/lib/plugins/imagemin.js +0 -95
- package/lib/plugins/index.js +0 -27
- package/lib/plugins/jsmin.js +0 -37
- package/lib/plugins/less.js +0 -97
- package/lib/plugins/plumber.js +0 -87
- package/lib/plugins/postcss-plugins.js +0 -13
- package/lib/plugins/postcss.js +0 -117
- package/lib/plugins/rename.js +0 -51
- package/lib/plugins/replace.js +0 -91
- package/lib/plugins/sass-legacy.js +0 -131
- package/lib/plugins/sass.js +0 -134
- package/lib/plugins/sftp.js +0 -288
- package/lib/tasks/default.js +0 -46
- package/lib/tasks/foundation/balm.js +0 -72
- package/lib/tasks/foundation/balm_style.js +0 -65
- package/lib/tasks/foundation/index.js +0 -10
- package/lib/tasks/index.js +0 -48
- package/lib/tasks/private/build.js +0 -18
- package/lib/tasks/private/cache.js +0 -31
- package/lib/tasks/private/clean.js +0 -69
- package/lib/tasks/private/end.js +0 -24
- package/lib/tasks/private/extra.js +0 -35
- package/lib/tasks/private/font.js +0 -15
- package/lib/tasks/private/image.js +0 -37
- package/lib/tasks/private/index.js +0 -34
- package/lib/tasks/private/lint.js +0 -20
- package/lib/tasks/private/media.js +0 -15
- package/lib/tasks/private/modernizr.js +0 -59
- package/lib/tasks/private/pwa-cache.js +0 -32
- package/lib/tasks/private/script.js +0 -9
- package/lib/tasks/private/sprite.js +0 -105
- package/lib/tasks/private/start.js +0 -16
- package/lib/tasks/private/style.js +0 -9
- package/lib/tasks/private/workbox-sw.js +0 -15
- package/lib/tasks/public/copy.js +0 -16
- package/lib/tasks/public/esbuild.js +0 -18
- package/lib/tasks/public/ftp.js +0 -39
- package/lib/tasks/public/html.js +0 -65
- package/lib/tasks/public/index.js +0 -38
- package/lib/tasks/public/jsmin.js +0 -23
- package/lib/tasks/public/less.js +0 -21
- package/lib/tasks/public/postcss.js +0 -16
- package/lib/tasks/public/publish.js +0 -51
- package/lib/tasks/public/pwa.js +0 -84
- package/lib/tasks/public/remove.js +0 -46
- package/lib/tasks/public/replace.js +0 -26
- package/lib/tasks/public/rollup.js +0 -17
- package/lib/tasks/public/sass.js +0 -27
- package/lib/tasks/public/server.js +0 -130
- package/lib/tasks/public/url.js +0 -35
- package/lib/tasks/public/version.js +0 -23
- package/lib/tasks/public/webpack.js +0 -39
- package/lib/tasks/public/zip.js +0 -19
- package/lib/utilities/address.js +0 -55
- package/lib/utilities/cache-core.js +0 -66
- package/lib/utilities/color.js +0 -27
- package/lib/utilities/compiling.js +0 -24
- package/lib/utilities/detect-port.js +0 -100
- package/lib/utilities/escape-string-regexp.js +0 -10
- package/lib/utilities/file.js +0 -70
- package/lib/utilities/index.js +0 -8
- package/lib/utilities/loading.js +0 -37
- package/lib/utilities/logger.js +0 -99
- package/lib/utilities/merge-stream.js +0 -38
- package/lib/utilities/namespace.js +0 -11
- package/lib/utilities/public-url.js +0 -37
- package/lib/utilities/replacestream.js +0 -106
- package/lib/utilities/typeof.js +0 -5
- package/lib/utilities/utils.js +0 -43
- package/tslib/balm.js +0 -44
- package/tslib/bootstrap/check_config.js +0 -36
- package/tslib/bootstrap/index.js +0 -82
- package/tslib/bundler/esbuild/build.js +0 -30
- package/tslib/bundler/esbuild/index.js +0 -11
- package/tslib/bundler/esbuild/options.js +0 -7
- package/tslib/bundler/esbuild/transform.js +0 -38
- package/tslib/bundler/rollup/build.js +0 -17
- package/tslib/bundler/rollup/entry.js +0 -24
- package/tslib/bundler/rollup/index.js +0 -21
- package/tslib/bundler/rollup/output.js +0 -23
- package/tslib/bundler/rollup/plugins.js +0 -27
- package/tslib/bundler/webpack/config/common.js +0 -130
- package/tslib/bundler/webpack/config/dev.js +0 -14
- package/tslib/bundler/webpack/config/env.js +0 -44
- package/tslib/bundler/webpack/config/index.js +0 -8
- package/tslib/bundler/webpack/config/prod.js +0 -43
- package/tslib/bundler/webpack/config/regex.js +0 -10
- package/tslib/bundler/webpack/entry.js +0 -68
- package/tslib/bundler/webpack/index.js +0 -30
- package/tslib/bundler/webpack/loaders.js +0 -51
- package/tslib/bundler/webpack/output.js +0 -41
- package/tslib/bundler/webpack/rules/asset.js +0 -33
- package/tslib/bundler/webpack/rules/babel.js +0 -16
- package/tslib/bundler/webpack/rules/css.js +0 -95
- package/tslib/bundler/webpack/rules/html.js +0 -15
- package/tslib/bundler/webpack/rules/index.js +0 -10
- package/tslib/config/assets.js +0 -24
- package/tslib/config/constants.js +0 -14
- package/tslib/config/env.js +0 -43
- package/tslib/config/extras.js +0 -6
- package/tslib/config/ftp.js +0 -6
- package/tslib/config/globals.js +0 -47
- package/tslib/config/html.js +0 -17
- package/tslib/config/images.js +0 -4
- package/tslib/config/index.js +0 -56
- package/tslib/config/logs.js +0 -6
- package/tslib/config/paths.js +0 -30
- package/tslib/config/pwa.js +0 -18
- package/tslib/config/roots.js +0 -8
- package/tslib/config/scripts.js +0 -93
- package/tslib/config/server.js +0 -33
- package/tslib/config/spinner.js +0 -10
- package/tslib/config/styles.js +0 -37
- package/tslib/hello.js +0 -19
- package/tslib/hooks/index.js +0 -75
- package/tslib/hooks/maker.js +0 -66
- package/tslib/index.js +0 -5
- package/tslib/middlewares/history.js +0 -12
- package/tslib/middlewares/index.js +0 -18
- package/tslib/middlewares/proxy.js +0 -27
- package/tslib/middlewares/webpack.js +0 -29
- package/tslib/plugins/htmlmin.js +0 -38
- package/tslib/plugins/imagemin.js +0 -97
- package/tslib/plugins/index.js +0 -27
- package/tslib/plugins/jsmin.js +0 -39
- package/tslib/plugins/less.js +0 -90
- package/tslib/plugins/plumber.js +0 -81
- package/tslib/plugins/postcss-plugins.js +0 -24
- package/tslib/plugins/postcss.js +0 -111
- package/tslib/plugins/rename.js +0 -51
- package/tslib/plugins/replace.js +0 -72
- package/tslib/plugins/sass-legacy.js +0 -95
- package/tslib/plugins/sass.js +0 -109
- package/tslib/plugins/sftp.js +0 -258
- package/tslib/tasks/default.js +0 -59
- package/tslib/tasks/foundation/balm.js +0 -75
- package/tslib/tasks/foundation/balm_style.js +0 -68
- package/tslib/tasks/foundation/index.js +0 -10
- package/tslib/tasks/index.js +0 -43
- package/tslib/tasks/private/build.js +0 -15
- package/tslib/tasks/private/cache.js +0 -48
- package/tslib/tasks/private/clean.js +0 -82
- package/tslib/tasks/private/end.js +0 -21
- package/tslib/tasks/private/extra.js +0 -34
- package/tslib/tasks/private/font.js +0 -12
- package/tslib/tasks/private/image.js +0 -42
- package/tslib/tasks/private/index.js +0 -34
- package/tslib/tasks/private/lint.js +0 -17
- package/tslib/tasks/private/media.js +0 -12
- package/tslib/tasks/private/modernizr.js +0 -54
- package/tslib/tasks/private/pwa-cache.js +0 -32
- package/tslib/tasks/private/script.js +0 -9
- package/tslib/tasks/private/sprite.js +0 -93
- package/tslib/tasks/private/start.js +0 -13
- package/tslib/tasks/private/style.js +0 -12
- package/tslib/tasks/private/workbox-sw.js +0 -15
- package/tslib/tasks/public/copy.js +0 -18
- package/tslib/tasks/public/esbuild.js +0 -18
- package/tslib/tasks/public/ftp.js +0 -39
- package/tslib/tasks/public/html.js +0 -75
- package/tslib/tasks/public/index.js +0 -38
- package/tslib/tasks/public/jsmin.js +0 -24
- package/tslib/tasks/public/less.js +0 -21
- package/tslib/tasks/public/postcss.js +0 -16
- package/tslib/tasks/public/publish.js +0 -50
- package/tslib/tasks/public/pwa.js +0 -87
- package/tslib/tasks/public/remove.js +0 -44
- package/tslib/tasks/public/replace.js +0 -27
- package/tslib/tasks/public/rollup.js +0 -17
- package/tslib/tasks/public/sass.js +0 -27
- package/tslib/tasks/public/server.js +0 -129
- package/tslib/tasks/public/url.js +0 -35
- package/tslib/tasks/public/version.js +0 -27
- package/tslib/tasks/public/webpack.js +0 -41
- package/tslib/tasks/public/zip.js +0 -19
- package/tslib/utilities/address.js +0 -48
- package/tslib/utilities/cache-core.js +0 -57
- package/tslib/utilities/color.js +0 -33
- package/tslib/utilities/compiling.js +0 -16
- package/tslib/utilities/detect-port.js +0 -91
- package/tslib/utilities/escape-string-regexp.js +0 -7
- package/tslib/utilities/file.js +0 -78
- package/tslib/utilities/index.js +0 -8
- package/tslib/utilities/loading.js +0 -25
- package/tslib/utilities/logger.js +0 -92
- package/tslib/utilities/merge-stream.js +0 -34
- package/tslib/utilities/namespace.js +0 -12
- package/tslib/utilities/public-url.js +0 -31
- package/tslib/utilities/replacestream.js +0 -112
- package/tslib/utilities/typeof.js +0 -8
- package/tslib/utilities/utils.js +0 -38
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Transform } from 'readable-stream';
|
|
2
|
-
import escapeRegExp from './escape-string-regexp.js';
|
|
3
|
-
function createReplaceFn(replace, isRegEx) {
|
|
4
|
-
function regexReplaceFunction(...args) {
|
|
5
|
-
let newReplace = replace;
|
|
6
|
-
const paramLength = [...args].length - 2;
|
|
7
|
-
for (let i = 1; i < paramLength; i++) {
|
|
8
|
-
newReplace = newReplace.replace(new RegExp(`\\$${i}`, 'g'), [...args][i] || '');
|
|
9
|
-
}
|
|
10
|
-
return newReplace;
|
|
11
|
-
}
|
|
12
|
-
if (!(replace instanceof Function)) {
|
|
13
|
-
return isRegEx
|
|
14
|
-
? regexReplaceFunction
|
|
15
|
-
: () => {
|
|
16
|
-
return replace;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
return replace;
|
|
20
|
-
}
|
|
21
|
-
function matchFromRegex(regex, options) {
|
|
22
|
-
if (options.regExpFlags) {
|
|
23
|
-
regex = new RegExp(regex.source, options.regExpFlags);
|
|
24
|
-
}
|
|
25
|
-
if (!regex.global) {
|
|
26
|
-
options.limit = 1;
|
|
27
|
-
}
|
|
28
|
-
return regex;
|
|
29
|
-
}
|
|
30
|
-
function matchFromString(str, options) {
|
|
31
|
-
if (options.regExpFlags) {
|
|
32
|
-
return new RegExp(escapeRegExp(str), options.regExpFlags);
|
|
33
|
-
}
|
|
34
|
-
return new RegExp(escapeRegExp(str), options.ignoreCase ? 'gmi' : 'gm');
|
|
35
|
-
}
|
|
36
|
-
function replaceStream(search, replace, opts) {
|
|
37
|
-
const options = Object.assign({
|
|
38
|
-
limit: Infinity,
|
|
39
|
-
encoding: 'utf8',
|
|
40
|
-
maxMatchLen: 100
|
|
41
|
-
}, opts);
|
|
42
|
-
let tail = '';
|
|
43
|
-
let totalMatches = 0;
|
|
44
|
-
const isRegex = search instanceof RegExp;
|
|
45
|
-
const replaceFn = createReplaceFn(replace, isRegex);
|
|
46
|
-
let match;
|
|
47
|
-
if (isRegex) {
|
|
48
|
-
match = matchFromRegex(search, options);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
match = matchFromString(search, options);
|
|
52
|
-
options.maxMatchLen = search.length;
|
|
53
|
-
}
|
|
54
|
-
function getDataToAppend(before, match) {
|
|
55
|
-
let dataToAppend = before;
|
|
56
|
-
totalMatches++;
|
|
57
|
-
dataToAppend += isRegex
|
|
58
|
-
? replaceFn.apply(this, match.concat([match.index.toString(), match.input]))
|
|
59
|
-
: replaceFn(match[0]);
|
|
60
|
-
return dataToAppend;
|
|
61
|
-
}
|
|
62
|
-
function getDataToQueue(matchCount, haystack, rewritten, lastPos) {
|
|
63
|
-
if (matchCount > 0) {
|
|
64
|
-
if (haystack.length > tail.length) {
|
|
65
|
-
return (rewritten + haystack.slice(lastPos, haystack.length - tail.length));
|
|
66
|
-
}
|
|
67
|
-
return rewritten;
|
|
68
|
-
}
|
|
69
|
-
return haystack.slice(0, haystack.length - tail.length);
|
|
70
|
-
}
|
|
71
|
-
function transform(chunk, encoding, callback) {
|
|
72
|
-
let matches;
|
|
73
|
-
let lastPos = 0;
|
|
74
|
-
let matchCount = 0;
|
|
75
|
-
let rewritten = '';
|
|
76
|
-
const haystack = `${tail}${chunk.toString(options.encoding)}`;
|
|
77
|
-
tail = '';
|
|
78
|
-
while (totalMatches < options.limit &&
|
|
79
|
-
(matches = match.exec(haystack)) !== null) {
|
|
80
|
-
matchCount++;
|
|
81
|
-
const before = haystack.slice(lastPos, matches.index);
|
|
82
|
-
const regexMatch = matches;
|
|
83
|
-
lastPos = matches.index + regexMatch[0].length;
|
|
84
|
-
if (lastPos > haystack.length &&
|
|
85
|
-
regexMatch[0].length < options.maxMatchLen) {
|
|
86
|
-
tail = regexMatch[0];
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
const dataToAppend = getDataToAppend(before, regexMatch);
|
|
90
|
-
rewritten += dataToAppend;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (tail.length < 1)
|
|
94
|
-
tail =
|
|
95
|
-
haystack.slice(lastPos).length > options.maxMatchLen
|
|
96
|
-
? haystack.slice(lastPos).slice(0 - options.maxMatchLen)
|
|
97
|
-
: haystack.slice(lastPos);
|
|
98
|
-
const dataToQueue = getDataToQueue(matchCount, haystack, rewritten, lastPos);
|
|
99
|
-
callback(null, dataToQueue);
|
|
100
|
-
}
|
|
101
|
-
function flush(callback) {
|
|
102
|
-
if (tail) {
|
|
103
|
-
this.push(tail);
|
|
104
|
-
}
|
|
105
|
-
callback();
|
|
106
|
-
}
|
|
107
|
-
return new Transform({
|
|
108
|
-
transform,
|
|
109
|
-
flush
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
export default replaceStream;
|
package/tslib/utilities/utils.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import getType from './typeof.js';
|
|
2
|
-
function isString(str) {
|
|
3
|
-
return getType(str) === 'string';
|
|
4
|
-
}
|
|
5
|
-
function isObject(obj) {
|
|
6
|
-
return getType(obj) === 'object';
|
|
7
|
-
}
|
|
8
|
-
function isArray(arr) {
|
|
9
|
-
return Array.isArray(arr);
|
|
10
|
-
}
|
|
11
|
-
function isFunction(fn) {
|
|
12
|
-
const type = getType(fn);
|
|
13
|
-
return type === 'function' || type === 'generatorfunction';
|
|
14
|
-
}
|
|
15
|
-
function deepMerge(target, source) {
|
|
16
|
-
if (isObject(target) && isObject(source)) {
|
|
17
|
-
Object.keys(source).forEach((key) => {
|
|
18
|
-
if (isObject(source[key])) {
|
|
19
|
-
if (!target[key]) {
|
|
20
|
-
Object.assign(target, { [key]: {} });
|
|
21
|
-
}
|
|
22
|
-
deepMerge(target[key], source[key]);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
Object.assign(target, { [key]: source[key] });
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return target;
|
|
30
|
-
}
|
|
31
|
-
export default {
|
|
32
|
-
getType,
|
|
33
|
-
isString,
|
|
34
|
-
isObject,
|
|
35
|
-
isArray,
|
|
36
|
-
isFunction,
|
|
37
|
-
deepMerge
|
|
38
|
-
};
|