@nx/rollup 16.0.0-beta.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 (58) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +63 -0
  4. package/executors.json +16 -0
  5. package/generators.json +33 -0
  6. package/index.d.ts +4 -0
  7. package/index.js +8 -0
  8. package/index.js.map +1 -0
  9. package/migrations.json +17 -0
  10. package/package.json +58 -0
  11. package/src/executors/rollup/compat.d.ts +2 -0
  12. package/src/executors/rollup/compat.js +6 -0
  13. package/src/executors/rollup/compat.js.map +1 -0
  14. package/src/executors/rollup/lib/analyze-plugin.d.ts +4 -0
  15. package/src/executors/rollup/lib/analyze-plugin.js +26 -0
  16. package/src/executors/rollup/lib/analyze-plugin.js.map +1 -0
  17. package/src/executors/rollup/lib/normalize.d.ts +10 -0
  18. package/src/executors/rollup/lib/normalize.js +78 -0
  19. package/src/executors/rollup/lib/normalize.js.map +1 -0
  20. package/src/executors/rollup/lib/run-rollup.d.ts +4 -0
  21. package/src/executors/rollup/lib/run-rollup.js +16 -0
  22. package/src/executors/rollup/lib/run-rollup.js.map +1 -0
  23. package/src/executors/rollup/lib/swc-plugin.d.ts +2 -0
  24. package/src/executors/rollup/lib/swc-plugin.js +21 -0
  25. package/src/executors/rollup/lib/swc-plugin.js.map +1 -0
  26. package/src/executors/rollup/lib/update-package-json.d.ts +6 -0
  27. package/src/executors/rollup/lib/update-package-json.js +46 -0
  28. package/src/executors/rollup/lib/update-package-json.js.map +1 -0
  29. package/src/executors/rollup/lib/validate-types.d.ts +5 -0
  30. package/src/executors/rollup/lib/validate-types.js +21 -0
  31. package/src/executors/rollup/lib/validate-types.js.map +1 -0
  32. package/src/executors/rollup/rollup.impl.d.ts +13 -0
  33. package/src/executors/rollup/rollup.impl.js +250 -0
  34. package/src/executors/rollup/rollup.impl.js.map +1 -0
  35. package/src/executors/rollup/schema.d.ts +35 -0
  36. package/src/executors/rollup/schema.json +172 -0
  37. package/src/generators/init/init.d.ts +5 -0
  38. package/src/generators/init/init.js +35 -0
  39. package/src/generators/init/init.js.map +1 -0
  40. package/src/generators/init/schema.d.ts +4 -0
  41. package/src/generators/init/schema.json +22 -0
  42. package/src/generators/rollup-project/rollup-project.d.ts +5 -0
  43. package/src/generators/rollup-project/rollup-project.js +77 -0
  44. package/src/generators/rollup-project/rollup-project.js.map +1 -0
  45. package/src/generators/rollup-project/schema.d.ts +12 -0
  46. package/src/generators/rollup-project/schema.json +72 -0
  47. package/src/migrations/update-15-0-0/add-babel-inputs.d.ts +2 -0
  48. package/src/migrations/update-15-0-0/add-babel-inputs.js +13 -0
  49. package/src/migrations/update-15-0-0/add-babel-inputs.js.map +1 -0
  50. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  51. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  52. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  53. package/src/utils/fs.d.ts +4 -0
  54. package/src/utils/fs.js +17 -0
  55. package/src/utils/fs.js.map +1 -0
  56. package/src/utils/versions.d.ts +3 -0
  57. package/src/utils/versions.js +7 -0
  58. package/src/utils/versions.js.map +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+
7
+
8
+ **Note:** Version bump only for package @nx/rollup
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2023 Narwhal Technologies Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
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>
2
+
3
+ <div style="text-align: center;">
4
+
5
+ [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
6
+ [![License](https://img.shields.io/npm/l/@nrwl/workspace.svg?style=flat-square)]()
7
+ [![NPM Version](https://badge.fury.io/js/%40nrwl%2Fworkspace.svg)](https://www.npmjs.com/@nrwl/workspace)
8
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
9
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
10
+ [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
11
+ [![Join us @nrwl/community on slack](https://img.shields.io/badge/slack-%40nrwl%2Fcommunity-brightgreen)](https://join.slack.com/t/nrwlcommunity/shared_invite/enQtNzU5MTE4OTQwOTk0LTgxY2E0ZWYzMWE0YzA5ZDA2MWM1NDVhNmI2ZWMyYmZhNWJiODk3MjkxZjY3MzU5ZjRmM2NmNWU1OTgyZmE4Mzc)
12
+
13
+ </div>
14
+
15
+
16
+ <hr>
17
+
18
+ # Nx: Smart, Fast and Extensible Build System
19
+
20
+ Nx is a next generation build system with first class monorepo support and powerful integrations.
21
+
22
+ This package is a [Rollup plugin for Nx](https://nx.dev/packages/rollup).
23
+
24
+ ## Getting Started
25
+
26
+ ### Creating an Nx Workspace
27
+
28
+ **Using `npx`**
29
+
30
+ ```bash
31
+ npx create-nx-workspace
32
+ ```
33
+
34
+ **Using `npm init`**
35
+
36
+ ```bash
37
+ npm init nx-workspace
38
+ ```
39
+
40
+ **Using `yarn create`**
41
+
42
+ ```bash
43
+ yarn create nx-workspace
44
+ ```
45
+
46
+ ### Adding Nx to an Existing Repository
47
+
48
+ Run:
49
+
50
+ ```bash
51
+ npx nx@latest init
52
+ ```
53
+
54
+ ## Documentation & Resources
55
+
56
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
57
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
58
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
59
+ - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
60
+
61
+ <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>
63
+
package/executors.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "builders": {
3
+ "rollup": {
4
+ "implementation": "./src/executors/rollup/compat",
5
+ "schema": "./src/executors/rollup/schema.json",
6
+ "description": "Bundle a package using Rollup."
7
+ }
8
+ },
9
+ "executors": {
10
+ "rollup": {
11
+ "implementation": "./src/executors/rollup/rollup.impl",
12
+ "schema": "./src/executors/rollup/schema.json",
13
+ "description": "Bundle a package using Rollup."
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "Nx rollup",
3
+ "version": "0.1",
4
+ "schematics": {
5
+ "init": {
6
+ "factory": "./src/generators/init/init#rollupInitSchematic",
7
+ "schema": "./src/generators/init/schema.json",
8
+ "description": "Initialize the `@nrwl/rollup` plugin.",
9
+ "hidden": true
10
+ },
11
+ "rollup-project": {
12
+ "factory": "./src/generators/rollup-project/rollup-project#rollupProjectSchematic",
13
+ "schema": "./src/generators/rollup-project/schema.json",
14
+ "description": "Add rollup configuration to a project.",
15
+ "hidden": true
16
+ }
17
+ },
18
+ "generators": {
19
+ "init": {
20
+ "factory": "./src/generators/init/init#rollupInitGenerator",
21
+ "schema": "./src/generators/init/schema.json",
22
+ "description": "Initialize the `@nrwl/rollup` plugin.",
23
+ "aliases": ["ng-add"],
24
+ "hidden": true
25
+ },
26
+ "rollup-project": {
27
+ "factory": "./src/generators/rollup-project/rollup-project#rollupProjectGenerator",
28
+ "schema": "./src/generators/rollup-project/schema.json",
29
+ "description": "Add rollup configuration to a project.",
30
+ "hidden": true
31
+ }
32
+ }
33
+ }
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './src/generators/init/init';
2
+ export * from './src/generators/rollup-project/rollup-project';
3
+ export * from './src/executors/rollup/schema';
4
+ export * from './src/executors/rollup/rollup.impl';
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./src/generators/init/init"), exports);
5
+ tslib_1.__exportStar(require("./src/generators/rollup-project/rollup-project"), exports);
6
+ tslib_1.__exportStar(require("./src/executors/rollup/schema"), exports);
7
+ tslib_1.__exportStar(require("./src/executors/rollup/rollup.impl"), exports);
8
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/rollup/index.ts"],"names":[],"mappings":";;;AAAA,qEAA2C;AAC3C,yFAA+D;AAC/D,wEAA8C;AAC9C,6EAAmD"}
@@ -0,0 +1,17 @@
1
+ {
2
+ "generators": {
3
+ "add-babel-inputs": {
4
+ "cli": "nx",
5
+ "version": "15.0.0-beta.0",
6
+ "description": "Adds babel.config.json to the hash of all tasks",
7
+ "factory": "./src/migrations/update-15-0-0/add-babel-inputs"
8
+ },
9
+ "update-16-0-0-add-nx-packages": {
10
+ "cli": "nx",
11
+ "version": "16.0.0-beta.1",
12
+ "description": "Replace @nrwl/rollup with @nx/rollup",
13
+ "implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
14
+ }
15
+ },
16
+ "packageJsonUpdates": {}
17
+ }
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@nx/rollup",
3
+ "version": "16.0.0-beta.1",
4
+ "private": false,
5
+ "description": "The Nx Plugin for Rollup contains executors and generators that support building applications using Rollup.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/nrwl/nx.git",
9
+ "directory": "packages/rollup"
10
+ },
11
+ "keywords": [
12
+ "Monorepo",
13
+ "Rollup",
14
+ "Web",
15
+ "CLI"
16
+ ],
17
+ "main": "./index",
18
+ "typings": "./index.d.ts",
19
+ "author": "Victor Savkin",
20
+ "license": "MIT",
21
+ "bugs": {
22
+ "url": "https://github.com/nrwl/nx/issues"
23
+ },
24
+ "homepage": "https://nx.dev",
25
+ "schematics": "./generators.json",
26
+ "builders": "./executors.json",
27
+ "ng-update": {
28
+ "requirements": {},
29
+ "migrations": "./migrations.json"
30
+ },
31
+ "dependencies": {
32
+ "@nrwl/rollup": "16.0.0-beta.1",
33
+ "@nx/devkit": "16.0.0-beta.1",
34
+ "@nx/js": "16.0.0-beta.1",
35
+ "@rollup/plugin-babel": "^5.3.0",
36
+ "@rollup/plugin-commonjs": "^20.0.0",
37
+ "@rollup/plugin-image": "^2.1.0",
38
+ "@rollup/plugin-json": "^4.1.0",
39
+ "@rollup/plugin-node-resolve": "^13.0.4",
40
+ "autoprefixer": "^10.4.9",
41
+ "babel-plugin-transform-async-to-promises": "^0.8.15",
42
+ "chalk": "^4.1.0",
43
+ "dotenv": "~10.0.0",
44
+ "postcss": "^8.4.14",
45
+ "rollup": "^2.56.2",
46
+ "rollup-plugin-copy": "^3.4.0",
47
+ "rollup-plugin-peer-deps-external": "^2.2.4",
48
+ "rollup-plugin-postcss": "^4.0.1",
49
+ "rollup-plugin-typescript2": "0.34.1",
50
+ "rxjs": "^6.5.4",
51
+ "tslib": "^2.3.0"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "types": "./index.d.ts",
57
+ "gitHead": "abf534c265f5aa3aac146e55bb31de598ea281d7"
58
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const rollup_impl_1 = require("./rollup.impl");
5
+ exports.default = (0, devkit_1.convertNxExecutor)(rollup_impl_1.default);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/rollup/src/executors/rollup/compat.ts"],"names":[],"mappings":";;AAAA,uCAA+C;AAE/C,+CAA2C;AAE3C,kBAAe,IAAA,0BAAiB,EAAC,qBAAc,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function analyze(): {
2
+ name: string;
3
+ renderChunk(source: any, chunk: any): void;
4
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.analyze = void 0;
4
+ const chalk = require("chalk");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const formatBytes = (bytes) => {
7
+ if (bytes === 0)
8
+ return '0 Byte';
9
+ const k = 1000;
10
+ const dm = 3;
11
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
12
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
13
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
14
+ };
15
+ function analyze() {
16
+ return {
17
+ name: 'rollup-plugin-nx-analyzer',
18
+ renderChunk(source, chunk) {
19
+ const sourceBytes = formatBytes(source.length);
20
+ const fileName = chunk.fileName;
21
+ devkit_1.logger.info(` ${chalk.bold(fileName)} ${chalk.cyan(sourceBytes)}`);
22
+ },
23
+ };
24
+ }
25
+ exports.analyze = analyze;
26
+ //# sourceMappingURL=analyze-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-plugin.js","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/executors/rollup/lib/analyze-plugin.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uCAAoC;AAEpC,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,EAAE;IAC5B,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjC,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,EAAE,GAAG,CAAC,CAAC;IACb,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,SAAgB,OAAO;IACrB,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,WAAW,CAAC,MAAM,EAAE,KAAK;YACvB,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;YAChC,eAAM,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;KACF,CAAC;AACJ,CAAC;AATD,0BASC"}
@@ -0,0 +1,10 @@
1
+ import type { AssetGlobPattern, RollupExecutorOptions } from '../schema';
2
+ export interface NormalizedRollupExecutorOptions extends RollupExecutorOptions {
3
+ entryRoot: string;
4
+ projectRoot: string;
5
+ assets: AssetGlobPattern[];
6
+ rollupConfig: string[];
7
+ }
8
+ export declare function normalizeRollupExecutorOptions(options: RollupExecutorOptions, root: string, sourceRoot: string): NormalizedRollupExecutorOptions;
9
+ export declare function normalizePluginPath(pluginPath: void | string, root: string): string;
10
+ export declare function normalizeAssets(assets: any[], root: string, sourceRoot: string): AssetGlobPattern[];
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeAssets = exports.normalizePluginPath = exports.normalizeRollupExecutorOptions = void 0;
4
+ const path_1 = require("path");
5
+ const fs_1 = require("fs");
6
+ const devkit_1 = require("@nx/devkit");
7
+ function normalizeRollupExecutorOptions(options, root, sourceRoot) {
8
+ const main = `${root}/${options.main}`;
9
+ const entryRoot = (0, path_1.dirname)(main);
10
+ const project = options.project
11
+ ? `${root}/${options.project}`
12
+ : (0, path_1.join)(root, 'package.json');
13
+ const projectRoot = (0, path_1.dirname)(project);
14
+ const outputPath = `${root}/${options.outputPath}`;
15
+ if (options.buildableProjectDepsInPackageJsonType == undefined) {
16
+ options.buildableProjectDepsInPackageJsonType = 'peerDependencies';
17
+ }
18
+ return Object.assign(Object.assign({}, options), {
19
+ // de-dupe formats
20
+ format: Array.from(new Set(options.format)), rollupConfig: []
21
+ .concat(options.rollupConfig)
22
+ .filter(Boolean)
23
+ .map((p) => normalizePluginPath(p, root)), assets: options.assets
24
+ ? normalizeAssets(options.assets, root, sourceRoot)
25
+ : undefined, main,
26
+ entryRoot,
27
+ project,
28
+ projectRoot,
29
+ outputPath });
30
+ }
31
+ exports.normalizeRollupExecutorOptions = normalizeRollupExecutorOptions;
32
+ function normalizePluginPath(pluginPath, root) {
33
+ if (!pluginPath) {
34
+ return '';
35
+ }
36
+ try {
37
+ return require.resolve(pluginPath);
38
+ }
39
+ catch (_a) {
40
+ return (0, path_1.resolve)(root, pluginPath);
41
+ }
42
+ }
43
+ exports.normalizePluginPath = normalizePluginPath;
44
+ function normalizeAssets(assets, root, sourceRoot) {
45
+ return assets.map((asset) => {
46
+ if (typeof asset === 'string') {
47
+ const assetPath = (0, devkit_1.normalizePath)(asset);
48
+ const resolvedAssetPath = (0, path_1.resolve)(root, assetPath);
49
+ const resolvedSourceRoot = (0, path_1.resolve)(root, sourceRoot);
50
+ if (!resolvedAssetPath.startsWith(resolvedSourceRoot)) {
51
+ throw new Error(`The ${resolvedAssetPath} asset path must start with the project source root: ${sourceRoot}`);
52
+ }
53
+ const isDirectory = (0, fs_1.statSync)(resolvedAssetPath).isDirectory();
54
+ const input = isDirectory
55
+ ? resolvedAssetPath
56
+ : (0, path_1.dirname)(resolvedAssetPath);
57
+ const output = (0, path_1.relative)(resolvedSourceRoot, (0, path_1.resolve)(root, input));
58
+ const glob = isDirectory ? '**/*' : (0, path_1.basename)(resolvedAssetPath);
59
+ return {
60
+ input,
61
+ output,
62
+ glob,
63
+ };
64
+ }
65
+ else {
66
+ if (asset.output.startsWith('..')) {
67
+ throw new Error('An asset cannot be written to a location outside of the output path.');
68
+ }
69
+ const assetPath = (0, devkit_1.normalizePath)(asset.input);
70
+ const resolvedAssetPath = (0, path_1.resolve)(root, assetPath);
71
+ return Object.assign(Object.assign({}, asset), { input: resolvedAssetPath,
72
+ // Now we remove starting slash to make Webpack place it from the output root.
73
+ output: asset.output.replace(/^\//, '') });
74
+ }
75
+ });
76
+ }
77
+ exports.normalizeAssets = normalizeAssets;
78
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/executors/rollup/lib/normalize.ts"],"names":[],"mappings":";;;AAAA,+BAAkE;AAClE,2BAA8B;AAC9B,uCAA2C;AAW3C,SAAgB,8BAA8B,CAC5C,OAA8B,EAC9B,IAAY,EACZ,UAAkB;IAElB,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO;QAC7B,CAAC,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE;QAC9B,CAAC,CAAC,IAAA,WAAI,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC/B,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAEnD,IAAI,OAAO,CAAC,qCAAqC,IAAI,SAAS,EAAE;QAC9D,OAAO,CAAC,qCAAqC,GAAG,kBAAkB,CAAC;KACpE;IAED,uCACK,OAAO;QACV,kBAAkB;QAClB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAC3C,YAAY,EAAE,EAAE;aACb,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;aAC5B,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,C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BAAiB,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,IAAA,eAAQ,EAAC,kBAAkB,EAAE,IAAA,cAAO,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YAClE,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,eAAQ,EAAC,iBAAiB,CAAC,CAAC;YAChE,OAAO;gBACL,KAAK;gBACL,MAAM;gBACN,IAAI;aACL,CAAC;SACH;aAAM;YACL,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACjC,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;aACH;YAED,MAAM,SAAS,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7C,MAAM,iBAAiB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACnD,uCACK,KAAK,KACR,KAAK,EAAE,iBAAiB;gBACxB,8EAA8E;gBAC9E,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IACvC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA7CD,0CA6CC"}
@@ -0,0 +1,4 @@
1
+ import * as rollup from 'rollup';
2
+ export declare function runRollup(options: rollup.RollupOptions): import("rxjs").Observable<{
3
+ success: boolean;
4
+ }>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runRollup = void 0;
4
+ const rollup = require("rollup");
5
+ const rxjs_1 = require("rxjs");
6
+ const operators_1 = require("rxjs/operators");
7
+ function runRollup(options) {
8
+ return (0, rxjs_1.from)(rollup.rollup(options)).pipe((0, operators_1.switchMap)((bundle) => {
9
+ const outputOptions = Array.isArray(options.output)
10
+ ? options.output
11
+ : [options.output];
12
+ return (0, rxjs_1.from)(Promise.all(outputOptions.map((o) => bundle.write(o))));
13
+ }), (0, operators_1.map)(() => ({ success: true })));
14
+ }
15
+ exports.runRollup = runRollup;
16
+ //# sourceMappingURL=run-rollup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-rollup.js","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/executors/rollup/lib/run-rollup.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,+BAA4B;AAC5B,8CAAgD;AAEhD,SAAgB,SAAS,CAAC,OAA6B;IACrD,OAAO,IAAA,WAAI,EAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CACtC,IAAA,qBAAS,EAAC,CAAC,MAAM,EAAE,EAAE;QACnB,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;YACjD,CAAC,CAAC,OAAO,CAAC,MAAM;YAChB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,IAAA,WAAI,EACT,OAAO,CAAC,GAAG,CACqB,aAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAChB,CACF,CACF,CAAC;IACJ,CAAC,CAAC,EACF,IAAA,eAAG,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAC/B,CAAC;AACJ,CAAC;AAhBD,8BAgBC"}
@@ -0,0 +1,2 @@
1
+ import { Plugin } from 'rollup';
2
+ export declare function swc(): Plugin;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.swc = void 0;
4
+ function swc() {
5
+ const { transform } = require('@swc/core');
6
+ return {
7
+ name: 'nx-swc',
8
+ transform(code, filename) {
9
+ return transform(code, {
10
+ filename,
11
+ jsc: {
12
+ transform: {
13
+ react: { runtime: 'automatic' },
14
+ },
15
+ },
16
+ });
17
+ },
18
+ };
19
+ }
20
+ exports.swc = swc;
21
+ //# sourceMappingURL=swc-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swc-plugin.js","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/executors/rollup/lib/swc-plugin.ts"],"names":[],"mappings":";;;AAEA,SAAgB,GAAG;IACjB,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,SAAS,CAAC,IAAI,EAAE,QAAQ;YACtB,OAAO,SAAS,CAAC,IAAI,EAAE;gBACrB,QAAQ;gBACR,GAAG,EAAE;oBACH,SAAS,EAAE;wBACT,KAAK,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;qBAChC;iBACF;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAfD,kBAeC"}
@@ -0,0 +1,6 @@
1
+ import { ExecutorContext } from 'nx/src/config/misc-interfaces';
2
+ import { ProjectGraphProjectNode } from 'nx/src/config/project-graph';
3
+ import { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
4
+ import { PackageJson } from 'nx/src/utils/package-json';
5
+ import { NormalizedRollupExecutorOptions } from './normalize';
6
+ export declare function updatePackageJson(options: NormalizedRollupExecutorOptions, context: ExecutorContext, target: ProjectGraphProjectNode, dependencies: DependentBuildableProjectNode[], packageJson: PackageJson): void;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updatePackageJson = void 0;
4
+ const path_1 = require("path");
5
+ const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
6
+ const fileutils_1 = require("nx/src/utils/fileutils");
7
+ function updatePackageJson(options, context, target, dependencies, packageJson) {
8
+ const hasEsmFormat = options.format.includes('esm');
9
+ const hasCjsFormat = options.format.includes('cjs');
10
+ const types = `./${(0, path_1.relative)(options.projectRoot, options.main).replace(/\.[jt]sx?$/, '.d.ts')}`;
11
+ const exports = {
12
+ // TS 4.5+
13
+ '.': {
14
+ types,
15
+ },
16
+ };
17
+ if (hasEsmFormat) {
18
+ // `module` field is used by bundlers like rollup and webpack to detect ESM.
19
+ // May not be required in the future if type is already "module".
20
+ packageJson.module = './index.js';
21
+ exports['.']['import'] = './index.js';
22
+ if (!hasCjsFormat) {
23
+ packageJson.main = './index.js';
24
+ }
25
+ }
26
+ if (hasCjsFormat) {
27
+ packageJson.main = './index.cjs';
28
+ exports['.']['require'] = './index.cjs';
29
+ }
30
+ if (!options.skipTypeField) {
31
+ packageJson.type = options.format.includes('esm') ? 'module' : 'commonjs';
32
+ }
33
+ // Support for older TS versions < 4.5
34
+ packageJson.types = types;
35
+ // TODO(jack): remove this for Nx 16
36
+ if (options.generateExportsField && typeof packageJson.exports !== 'string') {
37
+ packageJson.exports = Object.assign(Object.assign({}, packageJson.exports), exports);
38
+ }
39
+ (0, fileutils_1.writeJsonFile)(`${options.outputPath}/package.json`, packageJson);
40
+ if (dependencies.length > 0 &&
41
+ options.updateBuildableProjectDepsInPackageJson) {
42
+ (0, buildable_libs_utils_1.updateBuildableProjectPackageJsonDependencies)(context.root, context.projectName, context.targetName, context.configurationName, target, dependencies, options.buildableProjectDepsInPackageJsonType);
43
+ }
44
+ }
45
+ exports.updatePackageJson = updatePackageJson;
46
+ //# sourceMappingURL=update-package-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-package-json.js","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/executors/rollup/lib/update-package-json.ts"],"names":[],"mappings":";;;AAAA,+BAAgC;AAGhC,gFAG+C;AAC/C,sDAAuD;AAIvD,SAAgB,iBAAiB,CAC/B,OAAwC,EACxC,OAAwB,EACxB,MAA+B,EAC/B,YAA6C,EAC7C,WAAwB;IAExB,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,OAAO,CAA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,IAAA,oEAA6C,EAC3C,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,iBAAiB,EACzB,MAAM,EACN,YAAY,EACZ,OAAO,CAAC,qCAAqC,CAC9C,CAAC;KACH;AACH,CAAC;AApED,8CAoEC"}
@@ -0,0 +1,5 @@
1
+ export declare function validateTypes(opts: {
2
+ workspaceRoot: string;
3
+ projectRoot: string;
4
+ tsconfig: string;
5
+ }): Promise<void>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateTypes = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const js_1 = require("@nx/js");
6
+ const path_1 = require("path");
7
+ function validateTypes(opts) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const result = yield (0, js_1.runTypeCheck)({
10
+ workspaceRoot: opts.workspaceRoot,
11
+ tsConfigPath: (0, path_1.join)(opts.workspaceRoot, opts.tsconfig),
12
+ mode: 'noEmit',
13
+ });
14
+ yield (0, js_1.printDiagnostics)(result.errors, result.warnings);
15
+ if (result.errors.length > 0) {
16
+ throw new Error('Found type errors. See above.');
17
+ }
18
+ });
19
+ }
20
+ exports.validateTypes = validateTypes;
21
+ //# sourceMappingURL=validate-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-types.js","sourceRoot":"","sources":["../../../../../../../packages/rollup/src/executors/rollup/lib/validate-types.ts"],"names":[],"mappings":";;;;AAAA,+BAAwD;AACxD,+BAA4B;AAE5B,SAAsB,aAAa,CAAC,IAInC;;QACC,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAY,EAAC;YAChC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,YAAY,EAAE,IAAA,WAAI,EAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC;YACrD,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QAEH,MAAM,IAAA,qBAAgB,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEvD,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;SAClD;IACH,CAAC;CAAA;AAhBD,sCAgBC"}
@@ -0,0 +1,13 @@
1
+ import 'dotenv/config';
2
+ import * as rollup from 'rollup';
3
+ import type { ExecutorContext } from '@nx/devkit';
4
+ import { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
5
+ import { RollupExecutorOptions } from './schema';
6
+ import { NormalizedRollupExecutorOptions } from './lib/normalize';
7
+ export type RollupExecutorEvent = {
8
+ success: boolean;
9
+ outfile?: string;
10
+ };
11
+ export declare function rollupExecutor(rawOptions: RollupExecutorOptions, context: ExecutorContext): AsyncGenerator<RollupExecutorEvent, any, undefined>;
12
+ export declare function createRollupOptions(options: NormalizedRollupExecutorOptions, dependencies: DependentBuildableProjectNode[], context: ExecutorContext, packageJson: any, sourceRoot: string, npmDeps: string[]): rollup.InputOptions[];
13
+ export default rollupExecutor;