@tmbr/bundler 1.10.1 → 1.12.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/cli.js +26 -17
- package/package.json +5 -5
package/cli.js
CHANGED
|
@@ -9,10 +9,9 @@ import { execSync as exec } from 'child_process';
|
|
|
9
9
|
import { sassPlugin as styles } from 'esbuild-sass-plugin';
|
|
10
10
|
import * as sass from 'sass';
|
|
11
11
|
|
|
12
|
-
const server = create();
|
|
13
|
-
|
|
14
12
|
const cwd = process.cwd();
|
|
15
13
|
const src = path.resolve(cwd, 'src');
|
|
14
|
+
const server = create();
|
|
16
15
|
const command = process.argv[2];
|
|
17
16
|
|
|
18
17
|
if (!['build', 'watch'].includes(command)) {
|
|
@@ -32,14 +31,18 @@ const logger = (options = {}) => ({
|
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
context.onEnd(result => {
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
if (result.warnings.length || result.errors.length) {
|
|
36
|
+
console.log('\x07');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
36
39
|
|
|
37
40
|
const css = `${path}/${slug}.css`;
|
|
38
41
|
const js = `${path}/${slug}.js`;
|
|
39
42
|
|
|
40
43
|
console.log(` ${chalk.green('✓')} ${css} ${Math.round(fs.statSync(css).size / 1000)} KB`);
|
|
41
44
|
console.log(` ${chalk.green('✓')} ${js} ${Math.round(fs.statSync(js).size / 1000)} KB`);
|
|
42
|
-
console.log()
|
|
45
|
+
console.log();
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
48
|
});
|
|
@@ -56,6 +59,11 @@ const buildOptions = {
|
|
|
56
59
|
sourcemap: false,
|
|
57
60
|
treeShaking: true,
|
|
58
61
|
legalComments: 'none',
|
|
62
|
+
loader: {
|
|
63
|
+
'.glsl': 'text',
|
|
64
|
+
'.vert': 'text',
|
|
65
|
+
'.frag': 'text',
|
|
66
|
+
},
|
|
59
67
|
plugins: [
|
|
60
68
|
styles({sourceMap: false, logger: sass.Logger.silent}),
|
|
61
69
|
logger()
|
|
@@ -74,7 +82,7 @@ const watchOptions = Object.assign({}, buildOptions, {
|
|
|
74
82
|
|
|
75
83
|
const serveOptions = {
|
|
76
84
|
proxy: `${process.env.npm_package_name}.test`,
|
|
77
|
-
files: ['assets/**', 'build/*', '**/*.php'],
|
|
85
|
+
files: ['assets/**', 'build/*', '**/*.php', '**/*.html'],
|
|
78
86
|
host: 'localhost',
|
|
79
87
|
open: false,
|
|
80
88
|
notify: false,
|
|
@@ -137,17 +145,18 @@ async function main() {
|
|
|
137
145
|
});
|
|
138
146
|
}
|
|
139
147
|
|
|
140
|
-
function extend(options, config) {
|
|
141
|
-
if (!config) return options;
|
|
142
|
-
return typeof config === 'function' ? config(options) : Object.assign(options, config);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
148
|
if (fs.existsSync(process.argv[3])) {
|
|
146
|
-
// const test = require(`${cwd}/${process.argv[3]}`);
|
|
147
|
-
// console.log(extend(watchOptions, test.watch));
|
|
148
|
-
// console.log(extend(buildOptions, test.build));
|
|
149
|
-
// console.log(extend(serveOptions, test.serve));
|
|
150
|
-
// process.exit();
|
|
151
|
-
}
|
|
152
149
|
|
|
153
|
-
|
|
150
|
+
function extend(options, config) {
|
|
151
|
+
if (typeof config === 'undefined') return;
|
|
152
|
+
Object.assign(options, typeof config === 'function' ? config(options) : config);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
import(`${cwd}/${process.argv[3]}`).then(settings => {
|
|
156
|
+
extend(watchOptions, settings.watch);
|
|
157
|
+
extend(buildOptions, settings.build);
|
|
158
|
+
extend(serveOptions, settings.serve);
|
|
159
|
+
main();
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
} else { main(); }
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmbr/bundler",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.0",
|
|
5
5
|
"repository": "github:TMBR/tmbr-bundler",
|
|
6
6
|
"bin": {
|
|
7
7
|
"bundler": "cli.js",
|
|
8
8
|
"tmbr-bundler": "cli.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"browser-sync": "^
|
|
12
|
-
"chalk": "^
|
|
13
|
-
"esbuild": "^0.
|
|
14
|
-
"esbuild-sass-plugin": "^
|
|
11
|
+
"browser-sync": "^3.0.2",
|
|
12
|
+
"chalk": "^5.3.0",
|
|
13
|
+
"esbuild": "^0.20.1",
|
|
14
|
+
"esbuild-sass-plugin": "^3.1.0"
|
|
15
15
|
}
|
|
16
16
|
}
|