balm-core 5.2.0 → 6.0.0-alpha.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 (301) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/index.cjs +2625 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +569 -0
  5. package/dist/index.d.ts +569 -0
  6. package/dist/index.js +2527 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +49 -123
  9. package/src/balm.ts +108 -0
  10. package/src/bundler/esbuild.ts +47 -0
  11. package/src/bundler/index.ts +3 -0
  12. package/src/bundler/rollup.ts +45 -0
  13. package/src/bundler/webpack.ts +124 -0
  14. package/src/config/constants.ts +12 -0
  15. package/src/config/defaults.ts +209 -0
  16. package/src/config/index.ts +112 -0
  17. package/src/hooks/index.ts +224 -0
  18. package/src/index.ts +16 -0
  19. package/src/pipeline/file.ts +69 -0
  20. package/src/pipeline/index.ts +10 -0
  21. package/src/pipeline/pipeline.ts +135 -0
  22. package/src/pipeline/transforms/cache.ts +146 -0
  23. package/src/pipeline/transforms/htmlmin.ts +18 -0
  24. package/src/pipeline/transforms/less.ts +75 -0
  25. package/src/pipeline/transforms/postcss.ts +43 -0
  26. package/src/pipeline/transforms/rename.ts +37 -0
  27. package/src/pipeline/transforms/replace.ts +30 -0
  28. package/src/pipeline/transforms/sass.ts +106 -0
  29. package/src/pipeline/transforms/terser.ts +20 -0
  30. package/src/runner/dag.ts +77 -0
  31. package/src/runner/task.ts +38 -0
  32. package/src/shims.d.ts +5 -0
  33. package/src/tasks/cache.ts +72 -0
  34. package/src/tasks/clean.ts +21 -0
  35. package/src/tasks/copy.ts +36 -0
  36. package/src/tasks/ftp.ts +90 -0
  37. package/src/tasks/html.ts +232 -0
  38. package/src/tasks/index.ts +14 -0
  39. package/src/tasks/publish.ts +71 -0
  40. package/src/tasks/pwa.ts +99 -0
  41. package/src/tasks/remove.ts +24 -0
  42. package/src/tasks/replace.ts +34 -0
  43. package/src/tasks/script.ts +28 -0
  44. package/src/tasks/server.ts +183 -0
  45. package/src/tasks/static.ts +104 -0
  46. package/src/tasks/style.ts +57 -0
  47. package/src/tasks/zip.ts +65 -0
  48. package/src/types/index.ts +202 -0
  49. package/src/utilities/file.ts +120 -0
  50. package/src/utilities/logger.ts +63 -0
  51. package/src/utilities/utils.ts +46 -0
  52. package/src/utilities/workspace.ts +38 -0
  53. package/src/watcher/index.ts +100 -0
  54. package/tsconfig.json +8 -0
  55. package/tsup.config.ts +12 -0
  56. package/README.md +0 -196
  57. package/index.d.ts +0 -360
  58. package/lib/balm.js +0 -49
  59. package/lib/bootstrap/check_config.js +0 -43
  60. package/lib/bootstrap/index.js +0 -87
  61. package/lib/bundler/esbuild/build.js +0 -26
  62. package/lib/bundler/esbuild/index.js +0 -7
  63. package/lib/bundler/esbuild/options.js +0 -7
  64. package/lib/bundler/esbuild/transform.js +0 -36
  65. package/lib/bundler/rollup/build.js +0 -52
  66. package/lib/bundler/rollup/entry.js +0 -28
  67. package/lib/bundler/rollup/index.js +0 -20
  68. package/lib/bundler/rollup/output.js +0 -20
  69. package/lib/bundler/rollup/plugins.js +0 -31
  70. package/lib/bundler/webpack/config/common.js +0 -135
  71. package/lib/bundler/webpack/config/dev.js +0 -12
  72. package/lib/bundler/webpack/config/env.js +0 -67
  73. package/lib/bundler/webpack/config/index.js +0 -6
  74. package/lib/bundler/webpack/config/prod.js +0 -39
  75. package/lib/bundler/webpack/config/regex.js +0 -10
  76. package/lib/bundler/webpack/entry.js +0 -65
  77. package/lib/bundler/webpack/index.js +0 -32
  78. package/lib/bundler/webpack/loaders.js +0 -50
  79. package/lib/bundler/webpack/output.js +0 -41
  80. package/lib/bundler/webpack/rules/asset.js +0 -33
  81. package/lib/bundler/webpack/rules/babel.js +0 -19
  82. package/lib/bundler/webpack/rules/css.js +0 -109
  83. package/lib/bundler/webpack/rules/html.js +0 -15
  84. package/lib/bundler/webpack/rules/index.js +0 -10
  85. package/lib/config/assets.js +0 -30
  86. package/lib/config/constants.js +0 -14
  87. package/lib/config/env.js +0 -35
  88. package/lib/config/extras.js +0 -6
  89. package/lib/config/ftp.js +0 -6
  90. package/lib/config/globals.js +0 -43
  91. package/lib/config/html.js +0 -22
  92. package/lib/config/images.js +0 -4
  93. package/lib/config/index.js +0 -63
  94. package/lib/config/logs.js +0 -11
  95. package/lib/config/paths.js +0 -46
  96. package/lib/config/pwa.js +0 -24
  97. package/lib/config/roots.js +0 -9
  98. package/lib/config/scripts.js +0 -162
  99. package/lib/config/server.js +0 -84
  100. package/lib/config/spinner.js +0 -9
  101. package/lib/config/styles.js +0 -67
  102. package/lib/hello.js +0 -19
  103. package/lib/hooks/index.js +0 -94
  104. package/lib/hooks/maker.js +0 -59
  105. package/lib/index.js +0 -5
  106. package/lib/middlewares/history.js +0 -6
  107. package/lib/middlewares/index.js +0 -11
  108. package/lib/middlewares/proxy.js +0 -28
  109. package/lib/middlewares/webpack.js +0 -26
  110. package/lib/plugins/htmlmin.js +0 -39
  111. package/lib/plugins/imagemin.js +0 -95
  112. package/lib/plugins/index.js +0 -27
  113. package/lib/plugins/jsmin.js +0 -37
  114. package/lib/plugins/less.js +0 -97
  115. package/lib/plugins/plumber.js +0 -87
  116. package/lib/plugins/postcss-plugins.js +0 -13
  117. package/lib/plugins/postcss.js +0 -117
  118. package/lib/plugins/rename.js +0 -51
  119. package/lib/plugins/replace.js +0 -91
  120. package/lib/plugins/sass-legacy.js +0 -131
  121. package/lib/plugins/sass.js +0 -134
  122. package/lib/plugins/sftp.js +0 -288
  123. package/lib/tasks/default.js +0 -46
  124. package/lib/tasks/foundation/balm.js +0 -72
  125. package/lib/tasks/foundation/balm_style.js +0 -65
  126. package/lib/tasks/foundation/index.js +0 -10
  127. package/lib/tasks/index.js +0 -48
  128. package/lib/tasks/private/build.js +0 -18
  129. package/lib/tasks/private/cache.js +0 -31
  130. package/lib/tasks/private/clean.js +0 -69
  131. package/lib/tasks/private/end.js +0 -24
  132. package/lib/tasks/private/extra.js +0 -35
  133. package/lib/tasks/private/font.js +0 -15
  134. package/lib/tasks/private/image.js +0 -37
  135. package/lib/tasks/private/index.js +0 -34
  136. package/lib/tasks/private/lint.js +0 -20
  137. package/lib/tasks/private/media.js +0 -15
  138. package/lib/tasks/private/modernizr.js +0 -59
  139. package/lib/tasks/private/pwa-cache.js +0 -32
  140. package/lib/tasks/private/script.js +0 -9
  141. package/lib/tasks/private/sprite.js +0 -105
  142. package/lib/tasks/private/start.js +0 -16
  143. package/lib/tasks/private/style.js +0 -9
  144. package/lib/tasks/private/workbox-sw.js +0 -15
  145. package/lib/tasks/public/copy.js +0 -16
  146. package/lib/tasks/public/esbuild.js +0 -18
  147. package/lib/tasks/public/ftp.js +0 -39
  148. package/lib/tasks/public/html.js +0 -65
  149. package/lib/tasks/public/index.js +0 -38
  150. package/lib/tasks/public/jsmin.js +0 -23
  151. package/lib/tasks/public/less.js +0 -21
  152. package/lib/tasks/public/postcss.js +0 -16
  153. package/lib/tasks/public/publish.js +0 -51
  154. package/lib/tasks/public/pwa.js +0 -84
  155. package/lib/tasks/public/remove.js +0 -46
  156. package/lib/tasks/public/replace.js +0 -26
  157. package/lib/tasks/public/rollup.js +0 -17
  158. package/lib/tasks/public/sass.js +0 -27
  159. package/lib/tasks/public/server.js +0 -130
  160. package/lib/tasks/public/url.js +0 -35
  161. package/lib/tasks/public/version.js +0 -23
  162. package/lib/tasks/public/webpack.js +0 -39
  163. package/lib/tasks/public/zip.js +0 -19
  164. package/lib/utilities/address.js +0 -55
  165. package/lib/utilities/cache-core.js +0 -66
  166. package/lib/utilities/color.js +0 -27
  167. package/lib/utilities/compiling.js +0 -24
  168. package/lib/utilities/detect-port.js +0 -100
  169. package/lib/utilities/escape-string-regexp.js +0 -10
  170. package/lib/utilities/file.js +0 -70
  171. package/lib/utilities/index.js +0 -8
  172. package/lib/utilities/loading.js +0 -37
  173. package/lib/utilities/logger.js +0 -99
  174. package/lib/utilities/merge-stream.js +0 -38
  175. package/lib/utilities/namespace.js +0 -11
  176. package/lib/utilities/public-url.js +0 -37
  177. package/lib/utilities/replacestream.js +0 -106
  178. package/lib/utilities/typeof.js +0 -5
  179. package/lib/utilities/utils.js +0 -43
  180. package/tslib/balm.js +0 -44
  181. package/tslib/bootstrap/check_config.js +0 -36
  182. package/tslib/bootstrap/index.js +0 -82
  183. package/tslib/bundler/esbuild/build.js +0 -30
  184. package/tslib/bundler/esbuild/index.js +0 -11
  185. package/tslib/bundler/esbuild/options.js +0 -7
  186. package/tslib/bundler/esbuild/transform.js +0 -38
  187. package/tslib/bundler/rollup/build.js +0 -17
  188. package/tslib/bundler/rollup/entry.js +0 -24
  189. package/tslib/bundler/rollup/index.js +0 -21
  190. package/tslib/bundler/rollup/output.js +0 -23
  191. package/tslib/bundler/rollup/plugins.js +0 -27
  192. package/tslib/bundler/webpack/config/common.js +0 -130
  193. package/tslib/bundler/webpack/config/dev.js +0 -14
  194. package/tslib/bundler/webpack/config/env.js +0 -44
  195. package/tslib/bundler/webpack/config/index.js +0 -8
  196. package/tslib/bundler/webpack/config/prod.js +0 -43
  197. package/tslib/bundler/webpack/config/regex.js +0 -10
  198. package/tslib/bundler/webpack/entry.js +0 -68
  199. package/tslib/bundler/webpack/index.js +0 -30
  200. package/tslib/bundler/webpack/loaders.js +0 -51
  201. package/tslib/bundler/webpack/output.js +0 -41
  202. package/tslib/bundler/webpack/rules/asset.js +0 -33
  203. package/tslib/bundler/webpack/rules/babel.js +0 -16
  204. package/tslib/bundler/webpack/rules/css.js +0 -95
  205. package/tslib/bundler/webpack/rules/html.js +0 -15
  206. package/tslib/bundler/webpack/rules/index.js +0 -10
  207. package/tslib/config/assets.js +0 -24
  208. package/tslib/config/constants.js +0 -14
  209. package/tslib/config/env.js +0 -43
  210. package/tslib/config/extras.js +0 -6
  211. package/tslib/config/ftp.js +0 -6
  212. package/tslib/config/globals.js +0 -47
  213. package/tslib/config/html.js +0 -17
  214. package/tslib/config/images.js +0 -4
  215. package/tslib/config/index.js +0 -56
  216. package/tslib/config/logs.js +0 -6
  217. package/tslib/config/paths.js +0 -30
  218. package/tslib/config/pwa.js +0 -18
  219. package/tslib/config/roots.js +0 -8
  220. package/tslib/config/scripts.js +0 -93
  221. package/tslib/config/server.js +0 -33
  222. package/tslib/config/spinner.js +0 -10
  223. package/tslib/config/styles.js +0 -37
  224. package/tslib/hello.js +0 -19
  225. package/tslib/hooks/index.js +0 -75
  226. package/tslib/hooks/maker.js +0 -66
  227. package/tslib/index.js +0 -5
  228. package/tslib/middlewares/history.js +0 -12
  229. package/tslib/middlewares/index.js +0 -18
  230. package/tslib/middlewares/proxy.js +0 -27
  231. package/tslib/middlewares/webpack.js +0 -29
  232. package/tslib/plugins/htmlmin.js +0 -38
  233. package/tslib/plugins/imagemin.js +0 -97
  234. package/tslib/plugins/index.js +0 -27
  235. package/tslib/plugins/jsmin.js +0 -39
  236. package/tslib/plugins/less.js +0 -90
  237. package/tslib/plugins/plumber.js +0 -81
  238. package/tslib/plugins/postcss-plugins.js +0 -24
  239. package/tslib/plugins/postcss.js +0 -111
  240. package/tslib/plugins/rename.js +0 -51
  241. package/tslib/plugins/replace.js +0 -72
  242. package/tslib/plugins/sass-legacy.js +0 -95
  243. package/tslib/plugins/sass.js +0 -109
  244. package/tslib/plugins/sftp.js +0 -258
  245. package/tslib/tasks/default.js +0 -59
  246. package/tslib/tasks/foundation/balm.js +0 -75
  247. package/tslib/tasks/foundation/balm_style.js +0 -68
  248. package/tslib/tasks/foundation/index.js +0 -10
  249. package/tslib/tasks/index.js +0 -43
  250. package/tslib/tasks/private/build.js +0 -15
  251. package/tslib/tasks/private/cache.js +0 -48
  252. package/tslib/tasks/private/clean.js +0 -82
  253. package/tslib/tasks/private/end.js +0 -21
  254. package/tslib/tasks/private/extra.js +0 -34
  255. package/tslib/tasks/private/font.js +0 -12
  256. package/tslib/tasks/private/image.js +0 -42
  257. package/tslib/tasks/private/index.js +0 -34
  258. package/tslib/tasks/private/lint.js +0 -17
  259. package/tslib/tasks/private/media.js +0 -12
  260. package/tslib/tasks/private/modernizr.js +0 -54
  261. package/tslib/tasks/private/pwa-cache.js +0 -32
  262. package/tslib/tasks/private/script.js +0 -9
  263. package/tslib/tasks/private/sprite.js +0 -93
  264. package/tslib/tasks/private/start.js +0 -13
  265. package/tslib/tasks/private/style.js +0 -12
  266. package/tslib/tasks/private/workbox-sw.js +0 -15
  267. package/tslib/tasks/public/copy.js +0 -18
  268. package/tslib/tasks/public/esbuild.js +0 -18
  269. package/tslib/tasks/public/ftp.js +0 -39
  270. package/tslib/tasks/public/html.js +0 -75
  271. package/tslib/tasks/public/index.js +0 -38
  272. package/tslib/tasks/public/jsmin.js +0 -24
  273. package/tslib/tasks/public/less.js +0 -21
  274. package/tslib/tasks/public/postcss.js +0 -16
  275. package/tslib/tasks/public/publish.js +0 -50
  276. package/tslib/tasks/public/pwa.js +0 -87
  277. package/tslib/tasks/public/remove.js +0 -44
  278. package/tslib/tasks/public/replace.js +0 -27
  279. package/tslib/tasks/public/rollup.js +0 -17
  280. package/tslib/tasks/public/sass.js +0 -27
  281. package/tslib/tasks/public/server.js +0 -129
  282. package/tslib/tasks/public/url.js +0 -35
  283. package/tslib/tasks/public/version.js +0 -27
  284. package/tslib/tasks/public/webpack.js +0 -41
  285. package/tslib/tasks/public/zip.js +0 -19
  286. package/tslib/utilities/address.js +0 -48
  287. package/tslib/utilities/cache-core.js +0 -57
  288. package/tslib/utilities/color.js +0 -33
  289. package/tslib/utilities/compiling.js +0 -16
  290. package/tslib/utilities/detect-port.js +0 -91
  291. package/tslib/utilities/escape-string-regexp.js +0 -7
  292. package/tslib/utilities/file.js +0 -78
  293. package/tslib/utilities/index.js +0 -8
  294. package/tslib/utilities/loading.js +0 -25
  295. package/tslib/utilities/logger.js +0 -92
  296. package/tslib/utilities/merge-stream.js +0 -34
  297. package/tslib/utilities/namespace.js +0 -12
  298. package/tslib/utilities/public-url.js +0 -31
  299. package/tslib/utilities/replacestream.js +0 -112
  300. package/tslib/utilities/typeof.js +0 -8
  301. package/tslib/utilities/utils.js +0 -38
@@ -1,11 +0,0 @@
1
- const level = 3;
2
- /**
3
- * Node.js - util.inspect(object[, options])
4
- *
5
- * @reference https://github.com/nodejs/node/blob/master/doc/api/util.md#utilinspectobject-options
6
- */
7
- const formatOptions = {};
8
- export default {
9
- level,
10
- formatOptions
11
- };
@@ -1,46 +0,0 @@
1
- const source = {
2
- base: '',
3
- // Project directory
4
- html: '',
5
- // HTML template directory: `src`
6
- css: 'styles',
7
- // Stylesheet directory: `src/styles`
8
- js: 'scripts',
9
- // Javascript directory: `src/scripts`
10
- img: 'images',
11
- // Image directory: `src/images`
12
- font: 'fonts',
13
- // Font directory: `src/fonts`
14
- media: 'media' // Media directory: `src/media`
15
- };
16
- const tmp = {
17
- base: '',
18
- // `.tmp`
19
- css: 'css',
20
- // `.tmp/css`
21
- js: 'js',
22
- // `.tmp/js`
23
- img: 'img',
24
- // `.tmp/img`
25
- font: 'fonts',
26
- // `.tmp/fonts`
27
- media: 'media' // `.tmp/media`
28
- };
29
- const target = {
30
- base: '',
31
- // `dist`
32
- css: 'css',
33
- // `dist/css`
34
- js: 'js',
35
- // `dist/js`
36
- img: 'img',
37
- // `dist/img`
38
- font: 'font',
39
- // `dist/font`
40
- media: 'media' // `dist/media`
41
- };
42
- export default {
43
- source,
44
- tmp,
45
- target
46
- };
package/lib/config/pwa.js DELETED
@@ -1,24 +0,0 @@
1
- const enabled = false;
2
- const manifest = 'manifest.json'; // 'manifest.json' or 'manifest.webmanifest'
3
- const workboxSw = 'node_modules/workbox-sw/build/workbox-sw.js';
4
- const mode = 'generateSW'; // 'generateSW' or 'injectManifest'
5
- /**
6
- * Workbox Build options
7
- *
8
- * @reference https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config
9
- * @reference https://developers.google.com/web/tools/workbox/modules/workbox-build#full_injectmanifest_config
10
- */
11
- const options = {};
12
- const swSrcFilename = 'service-worker.js';
13
- const swDestFilename = 'sw.js';
14
- const version = '';
15
- export default {
16
- enabled,
17
- manifest,
18
- workboxSw,
19
- mode,
20
- options,
21
- swSrcFilename,
22
- swDestFilename,
23
- version
24
- };
@@ -1,9 +0,0 @@
1
- const source = 'src'; // Source code
2
- const tmp = '.tmp'; // Temporary precompiled assets
3
- const target = 'dist'; // The final distribution folder
4
-
5
- export default {
6
- source,
7
- tmp,
8
- target
9
- };
@@ -1,162 +0,0 @@
1
- // Base options
2
- const bundler = 'webpack';
3
- const minify = false;
4
- /**
5
- * Terser minify options
6
- *
7
- * @reference https://github.com/terser/terser#minify-options
8
- */
9
- const minifyOptions = {
10
- ecma: 5,
11
- compress: {
12
- // Disabled because of an issue with Uglify breaking seemingly valid code:
13
- // https://github.com/facebook/create-react-app/issues/2376
14
- // Pending further investigation:
15
- // https://github.com/mishoo/UglifyJS2/issues/2011
16
- comparisons: false,
17
- // Disabled because of an issue with Terser breaking valid code:
18
- // https://github.com/facebook/create-react-app/issues/5250
19
- // Pending further investigation:
20
- // https://github.com/terser-js/terser/issues/120
21
- inline: 2
22
- },
23
- mangle: {
24
- safari10: true
25
- },
26
- format: {
27
- comments: false,
28
- // Turned on because emoji and regex is not minified properly using default
29
- // https://github.com/facebook/create-react-app/issues/2488
30
- ascii_only: true
31
- }
32
- };
33
- // Entry and Context (webpack/esbuild common options)
34
- const entry = '';
35
- const lint = false;
36
-
37
- /**
38
- * Webpack bundler
39
- */
40
-
41
- // Output
42
- const library = '';
43
- // Module
44
- const loaders = [];
45
- const defaultLoaders = {};
46
- const includeJsResource = [];
47
- const useEsModule = true;
48
- /**
49
- * Scripts: babel-loader options
50
- *
51
- * @reference https://github.com/babel/babel-loader#options
52
- */
53
- const babelLoaderOptions = {};
54
- /**
55
- * Styling: postcss-loader options
56
- *
57
- * @reference https://github.com/postcss/postcss-loader#options
58
- */
59
- const postcssLoaderOptions = {};
60
- /**
61
- * Template: html-loader options
62
- *
63
- * @reference https://github.com/webpack-contrib/html-loader#options
64
- */
65
- const htmlLoaderOptions = {};
66
- const imageAssetType = 'asset';
67
- const imageInlineSizeLimit = 8096; // 8kb
68
- // Resolve
69
- const extensions = [];
70
- const alias = {};
71
- // Plugins
72
- const plugins = [];
73
- const nodeEnv = {};
74
- const injectHtml = false;
75
- const htmlPluginOptions = {};
76
- const extractCss = false;
77
- // Devtool
78
- const sourceMap = false;
79
- // Target
80
- const target = ['web', 'es5'];
81
- // Externals
82
- const externals = '';
83
- // Stats
84
- const stats = {
85
- colors: true,
86
- assets: true,
87
- children: false,
88
- chunks: false,
89
- modules: false
90
- };
91
- /**
92
- * Full custom webpack configuration
93
- *
94
- * @reference https://webpack.js.org/configuration/
95
- */
96
- const webpackOptions = {};
97
- // Optimization
98
- /**
99
- * Webpack optimizations for manual configuration and overrides
100
- *
101
- * @reference https://webpack.js.org/configuration/optimization/
102
- */
103
- const optimization = {};
104
- const extractAllVendors = false; // Extract all vendors (all in one)
105
- const vendorName = 'vendor'; // AllInOne vendor filename or Vendors folder name
106
- // IE8 compatibility
107
- const ie8 = false;
108
-
109
- /**
110
- * Rollup bundler
111
- */
112
- const inputOptions = {};
113
- const outputOptions = {};
114
-
115
- /**
116
- * Esbuild bundler
117
- */
118
- const buildOptions = {};
119
- const useTransform = false;
120
- const transformOptions = {};
121
- export default {
122
- // base
123
- bundler,
124
- minify,
125
- minifyOptions,
126
- entry,
127
- lint,
128
- // webpack
129
- library,
130
- loaders,
131
- defaultLoaders,
132
- includeJsResource,
133
- useEsModule,
134
- babelLoaderOptions,
135
- postcssLoaderOptions,
136
- htmlLoaderOptions,
137
- imageAssetType,
138
- imageInlineSizeLimit,
139
- extensions,
140
- alias,
141
- plugins,
142
- nodeEnv,
143
- injectHtml,
144
- htmlPluginOptions,
145
- extractCss,
146
- sourceMap,
147
- target,
148
- externals,
149
- stats,
150
- webpackOptions,
151
- optimization,
152
- extractAllVendors,
153
- vendorName,
154
- ie8,
155
- // rollup
156
- inputOptions,
157
- outputOptions,
158
- // esbuild
159
- buildOptions,
160
- useTransform,
161
- transformOptions
162
- };
@@ -1,84 +0,0 @@
1
- const port = 3000;
2
- const host = null;
3
- const https = undefined;
4
- const open = false;
5
- const proxy = false; // Host: your.project.dev
6
- const serveStatic = [
7
- // {
8
- // route: '/public',
9
- // dir: '/path/to/public'
10
- // }
11
- ];
12
- /**
13
- * Browsersync options
14
- *
15
- * @reference https://browsersync.io/docs/options
16
- */
17
- const options = {};
18
- const next = NOOP;
19
- // Middleware
20
- /**
21
- * A development middleware for webpack
22
- *
23
- * @reference https://github.com/webpack/webpack-dev-middleware#options
24
- */
25
- const devOptions = {};
26
- /**
27
- * Webpack hot reloading
28
- *
29
- * @reference https://github.com/webpack-contrib/webpack-hot-middleware#config
30
- */
31
- const hotOptions = {
32
- reload: true,
33
- noInfo: true
34
- };
35
- /**
36
- * Http-proxy middleware
37
- *
38
- * @reference https://github.com/chimurai/http-proxy-middleware#options
39
- *
40
- * @example
41
- * Single proxy example
42
- * {
43
- * target: 'http://www.example.org',
44
- * changeOrigin: true,
45
- * pathFilter: '/api'
46
- * }
47
- * @example
48
- * Multiple proxies example
49
- * [{
50
- * target: 'http://www.example.org',
51
- * changeOrigin: true,
52
- * pathFilter: '/api'
53
- * }, {
54
- * target: 'http://www.example2.org',
55
- * changeOrigin: true,
56
- * pathFilter: ['/api2', '/api3']
57
- * }]
58
- */
59
- const proxyOptions = false;
60
- /**
61
- * HTML 5 history API
62
- *
63
- * @reference https://github.com/bripkens/connect-history-api-fallback#options
64
- */
65
- const historyOptions = false;
66
- const middlewares = []; // Extra middlewares for server
67
- const extraWatchFiles = []; // Just for `mix.serve`
68
-
69
- export default {
70
- port,
71
- host,
72
- https,
73
- open,
74
- proxy,
75
- serveStatic,
76
- options,
77
- next,
78
- devOptions,
79
- hotOptions,
80
- proxyOptions,
81
- historyOptions,
82
- middlewares,
83
- extraWatchFiles
84
- };
@@ -1,9 +0,0 @@
1
- // Reference `cli-spinners`
2
- const spinner = process.platform === 'win32' ? {
3
- interval: 130,
4
- frames: ['-', '\\', '|', '/']
5
- } : {
6
- interval: 80,
7
- frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
8
- };
9
- export default spinner;
@@ -1,67 +0,0 @@
1
- const extname = 'css';
2
- const minify = false;
3
- const atImportPaths = [];
4
- const entry = '';
5
- /**
6
- * Cssnano optimisations
7
- *
8
- * @reference https://cssnano.co/docs/optimisations/
9
- */
10
- const options = {
11
- discardComments: {
12
- removeAll: true
13
- }
14
- };
15
- /**
16
- * LibSass options
17
- *
18
- * @reference https://github.com/sass/node-sass#options
19
- */
20
- const sassOptions = {};
21
- /**
22
- * Less plugin for Gulp
23
- *
24
- * @reference https://github.com/gulp-community/gulp-less#options
25
- */
26
- const lessOptions = {};
27
- /**
28
- * PostCSS Preset Env
29
- *
30
- * @reference https://github.com/csstools/postcss-preset-env#options
31
- */
32
- const postcssEnvOptions = {
33
- autoprefixer: {
34
- flexbox: 'no-2009'
35
- },
36
- stage: 3
37
- };
38
- /**
39
- * PostCSS plugins
40
- *
41
- * @reference https://www.postcss.parts/
42
- */
43
- const postcssPlugins = [];
44
- // CSS Sprites
45
- const imageBasePath = '../'; // Relative to css file
46
- const sprites = []; // Image folders
47
- const spriteRetina = false;
48
- /**
49
- * Spritesmith parameters
50
- * @reference https://github.com/twolfson/gulp.spritesmith#spritesmithparams
51
- */
52
- const spriteParams = {};
53
- export default {
54
- extname,
55
- minify,
56
- atImportPaths,
57
- entry,
58
- options,
59
- sassOptions,
60
- lessOptions,
61
- postcssEnvOptions,
62
- postcssPlugins,
63
- imageBasePath,
64
- sprites,
65
- spriteRetina,
66
- spriteParams
67
- };
package/lib/hello.js DELETED
@@ -1,19 +0,0 @@
1
- import { versions } from 'node:process';
2
- import { createRequire } from 'node:module';
3
- import fs from 'node:fs';
4
- import { URL } from 'node:url';
5
- import { EventEmitter } from 'node:events';
6
- import cacheBalmCore from './utilities/cache-core.js';
7
- const requireModule = createRequire(import.meta.url);
8
- const balmCorePkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
9
- global.requireModule = requireModule;
10
- global.BalmJS = {
11
- version: balmCorePkg.version,
12
- emitter: new EventEmitter(),
13
- useCacache: +versions.node.split('.')[0] >= 18
14
- };
15
- if (!BalmJS.useCacache) {
16
- BalmJS.loading = true;
17
- cacheBalmCore();
18
- }
19
- export default balmCorePkg.version;
@@ -1,94 +0,0 @@
1
- import Maker from './maker.js';
2
- class BaseHooks {
3
- get env() {
4
- return BalmJS.config.env;
5
- }
6
-
7
- // HTML
8
- html(input, output) {
9
- Maker.generate('html', [input, output]);
10
- }
11
-
12
- // Stylesheets
13
- css(input, output) {
14
- Maker.generate('postcss', [input, output]);
15
- }
16
- sass(input, output, options) {
17
- Maker.generate('sass', [input, output, options]);
18
- }
19
- less(input, output, options) {
20
- Maker.generate('less', [input, output, options]);
21
- }
22
- url(input, output) {
23
- Maker.generate('url', [input, output]);
24
- }
25
-
26
- // JavaScript
27
- js() {
28
- BalmJS.logger.warn('balm api', '`mix.js` is deprecated, please use `mix.webpack`/`mix.rollup`/`mix.esbuild` instead.');
29
- }
30
- webpack(input, output, options, fn) {
31
- Maker.generate('webpack', [input, output, options, fn]);
32
- }
33
- esbuild(input, output, options) {
34
- Maker.generate('esbuild', [input, output, options]);
35
- }
36
- rollup(input, output) {
37
- Maker.generate('rollup', [input, output]);
38
- }
39
- jsmin(input, output, options) {
40
- Maker.generate('jsmin', [input, output, options]);
41
- }
42
-
43
- // Files & Directories
44
- copy(input, output, options) {
45
- Maker.generate('copy', [input, output, options]);
46
- }
47
- remove(paths) {
48
- Maker.generate('remove', [paths]);
49
- }
50
-
51
- // Cache
52
- version(input, output, assetsOptions) {
53
- Maker.generate('version', [input, output, assetsOptions]);
54
- }
55
-
56
- // Server
57
- serve(handler) {
58
- Maker.generate('serve', [handler]);
59
- }
60
- }
61
- class BalmHooks extends BaseHooks {
62
- // Stylesheets
63
- sprite(input, output, spriteOptions) {
64
- Maker.generate('sprite', [input, output, spriteOptions]);
65
- }
66
-
67
- // Assets
68
- replace(input, output, options) {
69
- Maker.generate('replace', [input, output, options]);
70
- }
71
- publish(input, output, renameOptions) {
72
- Maker.generate('publish', [input, output, renameOptions]);
73
- }
74
- zip(input = '', output = '', filename = 'archive.zip') {
75
- Maker.generate('zip', [input, output, filename]);
76
- }
77
- ftp(localFiles, options) {
78
- Maker.generate('ftp', [localFiles, options]);
79
- }
80
-
81
- // PWA
82
- generateSW(pwaOptions) {
83
- Maker.generate('pwa', ['generateSW', pwaOptions]);
84
- }
85
- injectManifest(pwaOptions) {
86
- Maker.generate('pwa', ['injectManifest', pwaOptions]);
87
- }
88
-
89
- // Others
90
- modernizr() {
91
- Maker.generate('modernizr');
92
- }
93
- }
94
- export default BalmHooks;
@@ -1,59 +0,0 @@
1
- const BLOCKLIST_IN_PROD = ['serve'];
2
- let compiling = false;
3
- function ban(name) {
4
- const BLOCKLIST_IN_DEV = ['publish', ...(BalmJS.config.useDefaults ? BLOCKLIST_IN_PROD : [])];
5
- const banInProd = BalmJS.config.env.isProd && BLOCKLIST_IN_PROD.includes(name);
6
- const banInDev = BalmJS.config.env.isDev && BLOCKLIST_IN_DEV.includes(name);
7
- const isBan = banInProd || banInDev;
8
- const api = name === 'postcss' ? 'css' : name;
9
- if (isBan) {
10
- const message = BalmJS.config.useDefaults && BalmJS.config.env.isDev && BLOCKLIST_IN_PROD.includes(name) ? `'mix.${api}()' can only be used for 'balm.config.useDefaults = false;'` : `There is no 'mix.${api}()' hook in ${banInProd ? 'production' : 'development'} mode`;
11
- BalmJS.logger.warn('balm hook', message);
12
- }
13
- return isBan;
14
- }
15
- class Maker {
16
- // Register custom task
17
- static generate(name, args = []) {
18
- if (ban(name)) {
19
- return;
20
- }
21
- const customTask = BalmJS.tasks.get(name);
22
- const taskName = ['sprite', ...BLOCKLIST_IN_PROD].includes(customTask.name) ? customTask.name : `${customTask.name}:${BalmJS.recipeIndex}`;
23
- let balmTask = callback => {
24
- callback();
25
- }; // NOTE: `balmTask` function name for `gulp.parallel`
26
-
27
- switch (customTask.name) {
28
- // private
29
- case 'sprite':
30
- customTask.recipe(...args);
31
- if (customTask.deps.length) {
32
- balmTask = gulp.series(...BalmJS.toNamespace(customTask.deps));
33
- } else {
34
- BalmJS.logger.warn('balm hook', '`mix.sprite()` is missing `input` parameters');
35
- }
36
- break;
37
- case 'modernizr':
38
- balmTask = customTask.fn;
39
- break;
40
- // public
41
- default:
42
- balmTask = customTask.recipe(...args);
43
- }
44
- if (BalmJS.watching) {
45
- if (!compiling) {
46
- compiling = true;
47
- gulp.series(balmTask, done => {
48
- compiling = false;
49
- done();
50
- })();
51
- }
52
- } else {
53
- gulp.task(BalmJS.toNamespace(taskName), balmTask);
54
- BalmJS.recipes.push(taskName);
55
- BalmJS.recipeIndex++;
56
- }
57
- }
58
- }
59
- export default Maker;
package/lib/index.js DELETED
@@ -1,5 +0,0 @@
1
- import version from './hello.js';
2
- import Balm from './balm.js';
3
- const balm = new Balm();
4
- export default balm;
5
- export { Balm, version };
@@ -1,6 +0,0 @@
1
- import history from 'connect-history-api-fallback';
2
- function historyMiddleware() {
3
- const historyOptions = BalmJS.config.server.historyOptions;
4
- return historyOptions ? [BalmJS.utils.isObject(historyOptions) ? history(historyOptions) : history()] : [];
5
- }
6
- export default historyMiddleware;
@@ -1,11 +0,0 @@
1
- import webpackMiddleware from './webpack.js';
2
- import httpProxyMiddleware from './proxy.js';
3
- import historyMiddleware from './history.js';
4
- function getMiddlewares() {
5
- const canOverride = BalmJS.config.server.middlewares.every(middleware => BalmJS.utils.isFunction(middleware) || BalmJS.utils.isObject(middleware));
6
- if (!canOverride) {
7
- BalmJS.logger.error('server middleware', 'Server middleware must be a function (`function (req, res, next) {}`) or object (`{ route: "/api", handle: function (req, res, next) {} }`)');
8
- }
9
- return [...(BalmJS.config.scripts.bundler === BalmJS.Bundler.webpack ? webpackMiddleware() : []), ...httpProxyMiddleware(), ...historyMiddleware(), ...(canOverride ? BalmJS.config.server.middlewares : [])];
10
- }
11
- export default getMiddlewares;
@@ -1,28 +0,0 @@
1
- import { createProxyMiddleware } from 'http-proxy-middleware';
2
- function httpProxyMiddleware() {
3
- const middleware = [];
4
- const proxyOptions = BalmJS.config.server.proxyOptions;
5
- if (proxyOptions) {
6
- try {
7
- if (BalmJS.utils.isObject(proxyOptions)) {
8
- // Single proxy
9
- const options = proxyOptions;
10
- middleware.push(createProxyMiddleware(options));
11
- } else if (BalmJS.utils.isArray(proxyOptions)) {
12
- // Multiple proxies
13
- for (const options of proxyOptions) {
14
- middleware.push(createProxyMiddleware(options));
15
- }
16
- } else {
17
- BalmJS.logger.error('proxy middleware', `Proxy options (https://github.com/chimurai/http-proxy-middleware#options) must be an object or array`);
18
- }
19
- } catch (error) {
20
- const {
21
- message
22
- } = error;
23
- BalmJS.logger.error('proxy middleware', message);
24
- }
25
- }
26
- return middleware;
27
- }
28
- export default httpProxyMiddleware;
@@ -1,26 +0,0 @@
1
- import webpackDevMiddleware from 'webpack-dev-middleware';
2
- import webpackHotMiddleware from 'webpack-hot-middleware';
3
- import { HMR_PATH } from '../config/constants.js';
4
- function webpackMiddleware() {
5
- const middleware = [];
6
- if (BalmJS.webpackCompiler) {
7
- middleware.push(webpackDevMiddleware(BalmJS.webpackCompiler, Object.assign({}, BalmJS.config.server.devOptions, {
8
- headers: [{
9
- key: 'balm-core',
10
- value: BalmJS.version
11
- }],
12
- publicPath: BalmJS.file.publicUrlOrPath,
13
- stats: false
14
- })));
15
- if (BalmJS.config.server.useHMR) {
16
- middleware.push(webpackHotMiddleware(BalmJS.webpackCompiler, {
17
- log: false,
18
- path: HMR_PATH
19
- }));
20
- }
21
- } else {
22
- BalmJS.logger.warn('webpack middleware', 'Webpack compiler is not ready');
23
- }
24
- return middleware;
25
- }
26
- export default webpackMiddleware;