Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

@americanexpress/one-app-bundler

Package Overview
Dependencies
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@americanexpress/one-app-bundler - npm Package Compare versions

Comparing version 6.15.4 to 6.16.0

bin/webpack-bundle-module.js

41

bin/bundle-module.js
#! /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,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc