@nx/esbuild 17.0.2 → 17.0.4

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2023 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2024 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -1,4 +1,9 @@
1
- <p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
1
+ <p style="text-align: center;">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
+ <img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
+ </picture>
6
+ </p>
2
7
 
3
8
  <div style="text-align: center;">
4
9
 
@@ -15,9 +20,9 @@
15
20
 
16
21
  <hr>
17
22
 
18
- # Nx: Smart, Fast and Extensible Build System
23
+ # Nx: Smart Monorepos · Fast CI
19
24
 
20
- Nx is a next generation build system with first class monorepo support and powerful integrations.
25
+ Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
21
26
 
22
27
  This package is a [EsBuild plugin for Nx](https://nx.dev/packages/esbuild).
23
28
 
@@ -59,5 +64,5 @@ npx nx@latest init
59
64
  - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
60
65
 
61
66
  <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
62
- width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
67
+ width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
63
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/esbuild",
3
- "version": "17.0.2",
3
+ "version": "17.0.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for esbuild contains executors and generators that support building applications using esbuild",
6
6
  "repository": {
@@ -34,9 +34,9 @@
34
34
  "fs-extra": "^11.1.0",
35
35
  "tslib": "^2.3.0",
36
36
  "tsconfig-paths": "^4.1.2",
37
- "@nx/devkit": "17.0.2",
38
- "@nx/js": "17.0.2",
39
- "@nrwl/esbuild": "17.0.2"
37
+ "@nx/devkit": "17.0.4",
38
+ "@nx/js": "17.0.4",
39
+ "@nrwl/esbuild": "17.0.4"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "esbuild": "~0.19.2"
@@ -8,7 +8,6 @@ export interface EsBuildExecutorOptions {
8
8
  assets: (AssetGlob | string)[];
9
9
  bundle?: boolean;
10
10
  deleteOutputPath?: boolean;
11
- dependenciesFieldType?: boolean;
12
11
  esbuildOptions?: Record<string, any>;
13
12
  esbuildConfig?: string;
14
13
  external?: string[];
@@ -130,12 +130,6 @@
130
130
  "type": "boolean",
131
131
  "description": "Includes third-party packages in the bundle (i.e. npm packages)."
132
132
  },
133
- "dependenciesFieldType": {
134
- "type": "string",
135
- "description": "When `bundleInternalProjectsOnly` is true, this option determines whether external packages should be in 'dependencies' or 'peerDependencies' field in the generated package.json file.",
136
- "enum": ["dependencies", "peerDependencies"],
137
- "default": "dependencies"
138
- },
139
133
  "esbuildOptions": {
140
134
  "type": "object",
141
135
  "description": "Additional options to pass to esbuild. See https://esbuild.github.io/api/. Cannot be used with 'esbuildConfig' option.",
@@ -1,4 +1,4 @@
1
- import type { Tree } from '@nx/devkit';
1
+ import { Tree } from '@nx/devkit';
2
2
  import { EsBuildProjectSchema } from './schema';
3
3
  export declare function configurationGenerator(tree: Tree, options: EsBuildProjectSchema): Promise<import("@nx/devkit").GeneratorCallback>;
4
4
  export default configurationGenerator;
@@ -4,6 +4,7 @@ exports.configurationGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
6
6
  const init_1 = require("../init/init");
7
+ const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
7
8
  async function configurationGenerator(tree, options) {
8
9
  const task = await (0, init_1.esbuildInitGenerator)(tree, {
9
10
  ...options,
@@ -25,6 +26,7 @@ function checkForTargetConflicts(tree, options) {
25
26
  }
26
27
  }
27
28
  function addBuildTarget(tree, options) {
29
+ (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, '@nx/esbuild:esbuild', options.buildTarget);
28
30
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
29
31
  const packageJsonPath = (0, devkit_1.joinPathFragments)(project.root, 'package.json');
30
32
  if (!tree.exists(packageJsonPath)) {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxEsBuildProject",
4
4
  "cli": "nx",
5
5
  "title": "Add esbuild configuration to a project",
@@ -1,4 +1,4 @@
1
- import { Tree } from '@nx/devkit';
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
- export declare function esbuildInitGenerator(tree: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
3
+ export declare function esbuildInitGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
4
  export default esbuildInitGenerator;
@@ -5,14 +5,17 @@ const devkit_1 = require("@nx/devkit");
5
5
  const versions_1 = require("@nx/js/src/utils/versions");
6
6
  const versions_2 = require("../../utils/versions");
7
7
  async function esbuildInitGenerator(tree, schema) {
8
- const task = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
9
- '@nx/esbuild': versions_2.nxVersion,
10
- esbuild: versions_1.esbuildVersion,
11
- });
8
+ let installTask = () => { };
9
+ if (!schema.skipPackageJson) {
10
+ installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
11
+ '@nx/esbuild': versions_2.nxVersion,
12
+ esbuild: versions_1.esbuildVersion,
13
+ }, undefined, schema.keepExistingVersions);
14
+ }
12
15
  if (!schema.skipFormat) {
13
16
  await (0, devkit_1.formatFiles)(tree);
14
17
  }
15
- return task;
18
+ return installTask;
16
19
  }
17
20
  exports.esbuildInitGenerator = esbuildInitGenerator;
18
21
  exports.default = esbuildInitGenerator;
@@ -1,4 +1,5 @@
1
1
  export interface Schema {
2
- compiler?: 'babel' | 'swc' | 'tsc';
3
2
  skipFormat?: boolean;
3
+ skipPackageJson?: boolean;
4
+ keepExistingVersions?: boolean;
4
5
  }
@@ -1,21 +1,26 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "NxWebpackInit",
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "NxEsbuildInit",
4
4
  "cli": "nx",
5
- "title": "Init Webpack Plugin",
6
- "description": "Init Webpack Plugin.",
5
+ "title": "Init Esbuild Plugin",
6
+ "description": "Init Esbuild Plugin.",
7
7
  "type": "object",
8
8
  "properties": {
9
- "compiler": {
10
- "type": "string",
11
- "enum": ["babel", "swc", "tsc"],
12
- "description": "The compiler to initialize for.",
13
- "default": "babel"
14
- },
15
9
  "skipFormat": {
16
10
  "description": "Skip formatting files.",
17
11
  "type": "boolean",
18
12
  "default": false
13
+ },
14
+ "skipPackageJson": {
15
+ "description": "Do not add dependencies to `package.json`.",
16
+ "type": "boolean",
17
+ "default": false
18
+ },
19
+ "keepExistingVersions": {
20
+ "type": "boolean",
21
+ "x-priority": "internal",
22
+ "description": "Keep existing dependencies versions",
23
+ "default": false
19
24
  }
20
25
  },
21
26
  "required": []
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getClientEnvironment = void 0;
4
+ // Prevent sensitive keys from being bundled when source code uses entire `process.env` object rather than individual keys (e.g. `process.env.NX_FOO`).
5
+ // TODO(v19): Only env vars prefixed with NX_PUBLIC should be bundled. This is a breaking change so we won't do it in v18.
6
+ const excludedKeys = ['NX_CLOUD_ACCESS_TOKEN', 'NX_CLOUD_ENCRYPTION_KEY'];
4
7
  function getClientEnvironment() {
5
8
  const NX_APP = /^NX_/i;
6
9
  return Object.keys(process.env)
7
- .filter((key) => NX_APP.test(key) || key === 'NODE_ENV')
10
+ .filter((key) => !excludedKeys.includes(key) && (NX_APP.test(key) || key === 'NODE_ENV'))
8
11
  .reduce((env, key) => {
9
12
  env[`process.env.${key}`] = JSON.stringify(process.env[key]);
10
13
  return env;