@nx/rollup 19.3.0-beta.0 → 19.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/rollup",
3
- "version": "19.3.0-beta.0",
3
+ "version": "19.3.0-beta.1",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Rollup contains executors and generators that support building applications using Rollup.",
6
6
  "repository": {
@@ -43,9 +43,9 @@
43
43
  "rollup-plugin-postcss": "^4.0.2",
44
44
  "rollup-plugin-typescript2": "^0.36.0",
45
45
  "tslib": "^2.3.0",
46
- "@nx/devkit": "19.3.0-beta.0",
47
- "@nx/js": "19.3.0-beta.0",
48
- "@nrwl/rollup": "19.3.0-beta.0"
46
+ "@nx/devkit": "19.3.0-beta.1",
47
+ "@nx/js": "19.3.0-beta.1",
48
+ "@nrwl/rollup": "19.3.0-beta.1"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"
@@ -8,9 +8,6 @@ const devkit_1 = require("@nx/devkit");
8
8
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
9
9
  const js_1 = require("@nx/js");
10
10
  const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
11
- // This import causes an error due to the module resolution used. If we switch to bundler or nodenext in the future we remove this ignore.
12
- // @ts-ignore
13
- const loadConfigFile_1 = require("rollup/loadConfigFile");
14
11
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'rollup.hash');
15
12
  const targetsCache = readTargetsCache();
16
13
  function readTargetsCache() {
@@ -53,8 +50,24 @@ exports.createNodes = [
53
50
  },
54
51
  ];
55
52
  async function buildRollupTarget(configFilePath, projectRoot, options, context) {
53
+ let loadConfigFile;
54
+ try {
55
+ // Try to load the workspace version of rollup first (it should already exist).
56
+ // Using the workspace rollup ensures that the config file is compatible with the `loadConfigFile` function.
57
+ // e.g. rollup@2 supports having `require` calls in rollup config, but rollup@4 does not.
58
+ const m = require(require.resolve('rollup/loadConfigFile', {
59
+ paths: [(0, path_1.dirname)(configFilePath)],
60
+ }));
61
+ // Rollup 2 has this has default export, but it is named in 3 and 4.
62
+ // See: https://www.unpkg.com/browse/rollup@2.79.1/dist/loadConfigFile.js
63
+ loadConfigFile = typeof m === 'function' ? m : m.loadConfigFile;
64
+ }
65
+ catch {
66
+ // Fallback to our own if needed.
67
+ loadConfigFile = require('rollup/loadConfigFile').loadConfigFile;
68
+ }
56
69
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
57
- const rollupConfig = (await (0, loadConfigFile_1.loadConfigFile)((0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath), {}, true // Enable watch mode so that rollup properly reloads config files without reusing a cached version
70
+ const rollupConfig = (await loadConfigFile((0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath), {}, true // Enable watch mode so that rollup properly reloads config files without reusing a cached version
58
71
  )).options;
59
72
  const outputs = getOutputs(rollupConfig, projectRoot);
60
73
  const targets = {};