@tmbr/bundler 1.10.0 → 1.10.1

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 (2) hide show
  1. package/cli.js +20 -19
  2. package/package.json +5 -4
package/cli.js CHANGED
@@ -1,16 +1,18 @@
1
1
  #!/usr/bin/env node
2
- const esbuild = require('esbuild');
3
- const fs = require('fs');
4
- const path = require('path');
5
- const exec = require('child_process').execSync;
6
- const chalk = require('chalk');
7
- const server = require('browser-sync').create();
8
- const styles = require('esbuild-sass-plugin').sassPlugin;
9
- const silent = require('sass').Logger.silent;
2
+ import esbuild from 'esbuild';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import chalk from 'chalk';
6
+ import readline from 'readline';
7
+ import { create } from 'browser-sync';
8
+ import { execSync as exec } from 'child_process';
9
+ import { sassPlugin as styles } from 'esbuild-sass-plugin';
10
+ import * as sass from 'sass';
11
+
12
+ const server = create();
10
13
 
11
14
  const cwd = process.cwd();
12
15
  const src = path.resolve(cwd, 'src');
13
- const package = require(`${cwd}/package.json`);
14
16
  const command = process.argv[2];
15
17
 
16
18
  if (!['build', 'watch'].includes(command)) {
@@ -30,7 +32,7 @@ const logger = (options = {}) => ({
30
32
  });
31
33
 
32
34
  context.onEnd(result => {
33
- if (result.warnings.length || result.errors.length) return console.log('\007');
35
+ if (result.warnings.length || result.errors.length) return console.log('\\007');
34
36
 
35
37
  const css = `${path}/${slug}.css`;
36
38
  const js = `${path}/${slug}.js`;
@@ -55,7 +57,7 @@ const buildOptions = {
55
57
  treeShaking: true,
56
58
  legalComments: 'none',
57
59
  plugins: [
58
- styles({sourceMap: false, logger: silent}),
60
+ styles({sourceMap: false, logger: sass.Logger.silent}),
59
61
  logger()
60
62
  ]
61
63
  };
@@ -71,7 +73,7 @@ const watchOptions = Object.assign({}, buildOptions, {
71
73
  });
72
74
 
73
75
  const serveOptions = {
74
- proxy: `${package.name}.test`,
76
+ proxy: `${process.env.npm_package_name}.test`,
75
77
  files: ['assets/**', 'build/*', '**/*.php'],
76
78
  host: 'localhost',
77
79
  open: false,
@@ -125,8 +127,7 @@ async function main() {
125
127
  server.init(serveOptions, () => {
126
128
  builder.watch();
127
129
  watcher.watch();
128
-
129
- require('readline').emitKeypressEvents(process.stdin);
130
+ readline.emitKeypressEvents(process.stdin);
130
131
 
131
132
  process.stdin.setRawMode(true);
132
133
  process.stdin.on('keypress', (_, key) => {
@@ -142,11 +143,11 @@ function extend(options, config) {
142
143
  }
143
144
 
144
145
  if (fs.existsSync(process.argv[3])) {
145
- const test = require(`${cwd}/${process.argv[3]}`);
146
- console.log(extend(watchOptions, test.watch));
147
- console.log(extend(buildOptions, test.build));
148
- console.log(extend(serveOptions, test.serve));
149
- process.exit();
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();
150
151
  }
151
152
 
152
153
  main();
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@tmbr/bundler",
3
- "version": "1.10.0",
3
+ "type": "module",
4
+ "version": "1.10.1",
4
5
  "repository": "github:TMBR/tmbr-bundler",
5
6
  "bin": {
6
7
  "bundler": "cli.js",
7
8
  "tmbr-bundler": "cli.js"
8
9
  },
9
10
  "dependencies": {
10
- "browser-sync": "^2.28.3",
11
+ "browser-sync": "^2.29.3",
11
12
  "chalk": "^4.1.2",
12
- "esbuild": "^0.17.11",
13
- "esbuild-sass-plugin": "^2.6.0"
13
+ "esbuild": "^0.19.3",
14
+ "esbuild-sass-plugin": "^2.15.0"
14
15
  }
15
16
  }