@americanexpress/one-app-bundler
Advanced tools
Comparing version 6.15.4 to 6.16.0
#! /usr/bin/env node | ||
/* | ||
* Copyright 2019 American Express Travel Related Services Company, Inc. | ||
* Copyright 2022 American Express Travel Related Services Company, Inc. | ||
* | ||
@@ -16,21 +16,20 @@ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
const webpack = require('webpack'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const localeBundler = require('@americanexpress/one-app-locale-bundler'); | ||
const getConfigOptions = require('../utils/getConfigOptions'); | ||
const clientConfig = require('../webpack/module/webpack.client'); | ||
const serverConfig = require('../webpack/module/webpack.server'); | ||
const getWebpackCallback = require('./webpackCallback'); | ||
const { watch } = require('../utils/getCliOptions')(); | ||
const modernClientConfig = clientConfig('modern'); | ||
const legacyClientConfig = clientConfig('legacy'); | ||
fs.writeFileSync(path.join(process.cwd(), 'bundle.integrity.manifest.json'), JSON.stringify({})); | ||
localeBundler(watch); | ||
webpack(serverConfig, getWebpackCallback('node', true)); | ||
webpack(modernClientConfig, getWebpackCallback('browser', true)); | ||
if (!getConfigOptions().disableDevelopmentLegacyBundle) webpack(legacyClientConfig, getWebpackCallback('legacyBrowser', true)); | ||
if (process.env.NODE_ENV !== 'production' && process.argv.includes('--dev')) { | ||
console.info('Running dev bundler'); | ||
import('@americanexpress/one-app-dev-bundler').then(({ default: esbuildBundleModule }) => { | ||
if (esbuildBundleModule) { | ||
esbuildBundleModule().catch((error) => { | ||
console.error(`Build failed with error ${error.message}`); | ||
console.error(error); | ||
throw error; | ||
}); | ||
} | ||
}); | ||
} else { | ||
if (process.argv.includes('--dev')) { | ||
console.info('Ignoring `--dev` flag for NODE_ENV=production'); | ||
} | ||
console.info('Running production bundler'); | ||
// eslint-disable-next-line global-require -- Only require the bundler when it runs | ||
require('./webpack-bundle-module'); | ||
} |
@@ -6,2 +6,18 @@ # Change Log | ||
# [6.16.0](https://github.com/americanexpress/one-app-cli/compare/@americanexpress/one-app-bundler@6.15.2...@americanexpress/one-app-bundler@6.16.0) (2023-01-05) | ||
### Bug Fixes | ||
* **hash:** use OpenSSL supported hash for webpack ([#488](https://github.com/americanexpress/one-app-cli/issues/488)) ([7c6660a](https://github.com/americanexpress/one-app-cli/commit/7c6660a4a345f075603080a7203b8e84f64bb5d8)) | ||
### Features | ||
* **bundler:** enable dev bundler through flag ([1cc171b](https://github.com/americanexpress/one-app-cli/commit/1cc171bffec3c4f4da8aa3689eb9c3e10dd89870)) | ||
## [6.15.4](https://github.com/americanexpress/one-app-cli/compare/@americanexpress/one-app-bundler@6.15.2...@americanexpress/one-app-bundler@6.15.4) (2022-11-16) | ||
@@ -8,0 +24,0 @@ |
{ | ||
"name": "@americanexpress/one-app-bundler", | ||
"version": "6.15.4", | ||
"version": "6.16.0", | ||
"description": "A command line interface(CLI) tool for bundling One App and its modules.", | ||
@@ -42,2 +42,3 @@ "main": "index.js", | ||
"@americanexpress/eslint-plugin-one-app": "^6.13.2", | ||
"@americanexpress/one-app-dev-bundler": "^1.1.0", | ||
"@americanexpress/one-app-locale-bundler": "^6.5.5", | ||
@@ -101,3 +102,3 @@ "@americanexpress/purgecss-loader": "^2.0.0", | ||
}, | ||
"gitHead": "582365f43a6b7048e364af0c0d26f05e336777b6" | ||
"gitHead": "a8c42bc8db349c9092af6af55a4891e8a9b65c1a" | ||
} |
@@ -43,2 +43,69 @@ # @americanexpress/one-app-bundler | ||
#### Watch Mode | ||
The bundler supports automatically re-building on file changes via the `--watch` flag. You can include an addition script for this: | ||
```json | ||
{ | ||
"scripts": { | ||
"watch:build": "bundle-module --watch" | ||
} | ||
} | ||
``` | ||
Or pass the flag when running the build script: | ||
```bash | ||
npm run build -- --watch | ||
``` | ||
#### Development Bundler | ||
When working on One App modules locally, you can use the Development Bundler. | ||
This bundler aims to provide <500ms build times, and Live Holocron Module Reload. | ||
To enable the development bundler, pass the `--dev` flag, either in your scripts: | ||
```json | ||
{ | ||
"scripts": { | ||
"build": "bundle-module --dev", | ||
"prepare": "npm run build", | ||
"watch:build": "bundle-module --watch --dev" | ||
} | ||
} | ||
``` | ||
or on the command line: | ||
```bash | ||
npm run build -- --dev | ||
``` | ||
The development bundler will only run if `NODE_ENV !== 'production'`. This means you can include the flag for all builds, and for `production` builds the Webpack bundler will be used. | ||
#### Live Holocron Module Reload | ||
When in watch mode, the Development Bundler can automatically re-load changed modules in your browser. | ||
This allows you to see changes made to modules near instantly, with no full page re-load required. | ||
This can be enabled with the `--live` flag. The `--live` flag also implies the `--watch` flag so there is no need to pass both: | ||
```json | ||
{ | ||
"scripts": { | ||
"build": "bundle-module --dev", | ||
"prepare": "npm run build", | ||
"watch:build": "bundle-module --watch --dev", | ||
"live:build": "bundle-module --live --dev" | ||
} | ||
} | ||
``` | ||
```bash | ||
npm run build -- --dev --live | ||
``` | ||
#### `providedExternals` & `requiredExternals` | ||
@@ -45,0 +112,0 @@ |
@@ -18,2 +18,3 @@ /* | ||
const path = require('path'); | ||
const crypto = require('crypto'); | ||
const TerserPlugin = require('terser-webpack-plugin'); | ||
@@ -59,2 +60,7 @@ const coreJsCompat = require('core-js-compat'); | ||
// Monkey Patch for unsupported hash algo. Needed to support Node >=17. | ||
// https://github.com/webpack/webpack/issues/13572#issuecomment-923736472 | ||
const originalCreateHash = crypto.createHash; | ||
crypto.createHash = (algo) => originalCreateHash(algo === 'md4' ? 'sha256' : algo); | ||
module.exports = (babelEnv) => merge( | ||
@@ -61,0 +67,0 @@ common, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104269
32
1475
340
39
17
+ Added@americanexpress/one-app-dev-bundler@1.7.3(transitive)
+ Added@esbuild/android-arm@0.15.18(transitive)
+ Added@esbuild/linux-loong64@0.15.18(transitive)
+ Added@fal-works/esbuild-plugin-global-externals@2.1.2(transitive)
+ Added@fullhuman/postcss-purgecss@3.1.3(transitive)
+ Added@jspm/core@2.1.0(transitive)
+ Added@svgr/babel-plugin-add-jsx-attribute@6.5.1(transitive)
+ Added@svgr/babel-plugin-remove-jsx-attribute@8.0.0(transitive)
+ Added@svgr/babel-plugin-remove-jsx-empty-expression@8.0.0(transitive)
+ Added@svgr/babel-plugin-replace-jsx-attribute-value@6.5.1(transitive)
+ Added@svgr/babel-plugin-svg-dynamic-title@6.5.1(transitive)
+ Added@svgr/babel-plugin-svg-em-dimensions@6.5.1(transitive)
+ Added@svgr/babel-plugin-transform-react-native-svg@6.5.1(transitive)
+ Added@svgr/babel-plugin-transform-svg-component@6.5.1(transitive)
+ Added@svgr/babel-preset@6.5.1(transitive)
+ Added@svgr/core@6.5.1(transitive)
+ Added@svgr/hast-util-to-babel-ast@6.5.1(transitive)
+ Added@svgr/plugin-jsx@6.5.1(transitive)
+ Added@swc/core@1.10.4(transitive)
+ Added@swc/core-darwin-arm64@1.10.4(transitive)
+ Added@swc/core-darwin-x64@1.10.4(transitive)
+ Added@swc/core-linux-arm-gnueabihf@1.10.4(transitive)
+ Added@swc/core-linux-arm64-gnu@1.10.4(transitive)
+ Added@swc/core-linux-arm64-musl@1.10.4(transitive)
+ Added@swc/core-linux-x64-gnu@1.10.4(transitive)
+ Added@swc/core-linux-x64-musl@1.10.4(transitive)
+ Added@swc/core-win32-arm64-msvc@1.10.4(transitive)
+ Added@swc/core-win32-ia32-msvc@1.10.4(transitive)
+ Added@swc/core-win32-x64-msvc@1.10.4(transitive)
+ Added@swc/counter@0.1.3(transitive)
+ Added@swc/types@0.1.17(transitive)
+ Added@trysound/sax@0.2.0(transitive)
+ Added@types/parse-json@4.0.2(transitive)
+ Addedacorn-walk@8.3.4(transitive)
+ Addedbrowserslist@4.24.3(transitive)
+ Addedcamelcase@6.3.0(transitive)
+ Addedcaniuse-api@3.0.0(transitive)
+ Addedcaniuse-lite@1.0.30001690(transitive)
+ Addedcliui@6.0.0(transitive)
+ Addedcolord@2.9.3(transitive)
+ Addedcommander@6.2.17.2.0(transitive)
+ Addedcore-js-compat@3.39.0(transitive)
+ Addedcosmiconfig@7.1.0(transitive)
+ Addedcss-declaration-sorter@7.2.0(transitive)
+ Addedcss-select@5.1.0(transitive)
+ Addedcss-tree@2.2.12.3.1(transitive)
+ Addedcssnano@6.1.2(transitive)
+ Addedcssnano-preset-default@6.1.2(transitive)
+ Addedcssnano-utils@4.0.2(transitive)
+ Addedcsso@5.0.5(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddom-serializer@2.0.0(transitive)
+ Addeddomhandler@5.0.3(transitive)
+ Addeddomutils@3.2.1(transitive)
+ Addedelectron-to-chromium@1.5.76(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedesbuild@0.15.18(transitive)
+ Addedesbuild-android-64@0.15.18(transitive)
+ Addedesbuild-android-arm64@0.15.18(transitive)
+ Addedesbuild-darwin-64@0.15.18(transitive)
+ Addedesbuild-darwin-arm64@0.15.18(transitive)
+ Addedesbuild-freebsd-64@0.15.18(transitive)
+ Addedesbuild-freebsd-arm64@0.15.18(transitive)
+ Addedesbuild-linux-32@0.15.18(transitive)
+ Addedesbuild-linux-64@0.15.18(transitive)
+ Addedesbuild-linux-arm@0.15.18(transitive)
+ Addedesbuild-linux-arm64@0.15.18(transitive)
+ Addedesbuild-linux-mips64le@0.15.18(transitive)
+ Addedesbuild-linux-ppc64le@0.15.18(transitive)
+ Addedesbuild-linux-riscv64@0.15.18(transitive)
+ Addedesbuild-linux-s390x@0.15.18(transitive)
+ Addedesbuild-netbsd-64@0.15.18(transitive)
+ Addedesbuild-openbsd-64@0.15.18(transitive)
+ Addedesbuild-plugin-polyfill-node@0.3.0(transitive)
+ Addedesbuild-plugin-svgr@1.1.0(transitive)
+ Addedesbuild-sunos-64@0.15.18(transitive)
+ Addedesbuild-windows-32@0.15.18(transitive)
+ Addedesbuild-windows-64@0.15.18(transitive)
+ Addedesbuild-windows-arm64@0.15.18(transitive)
+ Addedfast-uri@3.0.3(transitive)
+ Addedfilesize@9.0.11(transitive)
+ Addedfind-up@6.3.0(transitive)
+ Addedgeneric-names@4.0.0(transitive)
+ Addedglob-all@3.3.1(transitive)
+ Addedhosted-git-info@4.1.0(transitive)
+ Addedicss-utils@5.1.0(transitive)
+ Addedimport-meta-resolve@3.1.1(transitive)
+ Addedlilconfig@3.1.3(transitive)
+ Addedloader-utils@3.3.1(transitive)
+ Addedlocate-path@7.2.0(transitive)
+ Addedlodash.camelcase@4.3.0(transitive)
+ Addedlodash.memoize@4.1.2(transitive)
+ Addedlodash.snakecase@4.1.1(transitive)
+ Addedlodash.uniq@4.5.0(transitive)
+ Addedmdn-data@2.0.282.0.30(transitive)
+ Addednanoid@3.3.8(transitive)
+ Addednormalize-package-data@3.0.3(transitive)
+ Addedp-limit@4.0.0(transitive)
+ Addedp-locate@6.0.0(transitive)
+ Addedpath-exists@5.0.0(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpostcss@8.4.49(transitive)
+ Addedpostcss-calc@9.0.1(transitive)
+ Addedpostcss-colormin@6.1.0(transitive)
+ Addedpostcss-convert-values@6.1.0(transitive)
+ Addedpostcss-discard-comments@6.0.2(transitive)
+ Addedpostcss-discard-duplicates@6.0.3(transitive)
+ Addedpostcss-discard-empty@6.0.3(transitive)
+ Addedpostcss-discard-overridden@6.0.2(transitive)
+ Addedpostcss-merge-longhand@6.0.5(transitive)
+ Addedpostcss-merge-rules@6.1.1(transitive)
+ Addedpostcss-minify-font-values@6.1.0(transitive)
+ Addedpostcss-minify-gradients@6.0.3(transitive)
+ Addedpostcss-minify-params@6.1.0(transitive)
+ Addedpostcss-minify-selectors@6.0.4(transitive)
+ Addedpostcss-modules@6.0.1(transitive)
+ Addedpostcss-modules-extract-imports@3.1.0(transitive)
+ Addedpostcss-modules-local-by-default@4.2.0(transitive)
+ Addedpostcss-modules-scope@3.2.1(transitive)
+ Addedpostcss-modules-values@4.0.0(transitive)
+ Addedpostcss-normalize-charset@6.0.2(transitive)
+ Addedpostcss-normalize-display-values@6.0.2(transitive)
+ Addedpostcss-normalize-positions@6.0.2(transitive)
+ Addedpostcss-normalize-repeat-style@6.0.2(transitive)
+ Addedpostcss-normalize-string@6.0.2(transitive)
+ Addedpostcss-normalize-timing-functions@6.0.2(transitive)
+ Addedpostcss-normalize-unicode@6.1.0(transitive)
+ Addedpostcss-normalize-url@6.0.2(transitive)
+ Addedpostcss-normalize-whitespace@6.0.2(transitive)
+ Addedpostcss-ordered-values@6.0.2(transitive)
+ Addedpostcss-reduce-initial@6.1.0(transitive)
+ Addedpostcss-reduce-transforms@6.0.2(transitive)
+ Addedpostcss-selector-parser@7.0.0(transitive)
+ Addedpostcss-svgo@6.0.3(transitive)
+ Addedpostcss-unique-selectors@6.0.4(transitive)
+ Addedpurgecss@3.1.3(transitive)
+ Addedread-pkg@7.1.0(transitive)
+ Addedread-pkg-up@9.1.0(transitive)
+ Addedregenerator-runtime@0.13.11(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedstring-hash@1.1.3(transitive)
+ Addedstylehacks@6.1.1(transitive)
+ Addedsvg-parser@2.0.4(transitive)
+ Addedsvgo@3.3.2(transitive)
+ Addedtype-fest@2.19.0(transitive)
+ Addedupdate-browserslist-db@1.1.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrap-ansi@6.2.0(transitive)
+ Addedws@8.18.0(transitive)
+ Addedyaml@1.10.2(transitive)
+ Addedyargs@15.4.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)
+ Addedyocto-queue@1.1.1(transitive)
- Removedbrowserslist@4.24.4(transitive)
- Removedcaniuse-lite@1.0.30001692(transitive)
- Removedcore-js-compat@3.40.0(transitive)
- Removedelectron-to-chromium@1.5.79(transitive)
- Removedfast-uri@3.0.5(transitive)
- Removedupdate-browserslist-db@1.1.2(transitive)