@nx/rollup 22.7.0-pr.35019.f500fd7 → 22.7.0-rc.0

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": "22.7.0-pr.35019.f500fd7",
3
+ "version": "22.7.0-rc.0",
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": {
@@ -15,7 +15,8 @@
15
15
  "CLI"
16
16
  ],
17
17
  "main": "./index.js",
18
- "typings": "./index.d.ts",
18
+ "type": "commonjs",
19
+ "types": "./index.d.ts",
19
20
  "author": "Victor Savkin",
20
21
  "license": "MIT",
21
22
  "bugs": {
@@ -29,8 +30,8 @@
29
30
  "migrations": "./migrations.json"
30
31
  },
31
32
  "dependencies": {
32
- "@nx/devkit": "22.7.0-pr.35019.f500fd7",
33
- "@nx/js": "22.7.0-pr.35019.f500fd7",
33
+ "@nx/devkit": "22.7.0-rc.0",
34
+ "@nx/js": "22.7.0-rc.0",
34
35
  "@rollup/plugin-babel": "^6.0.4",
35
36
  "@rollup/plugin-commonjs": "^25.0.7",
36
37
  "@rollup/plugin-image": "^3.0.3",
@@ -40,7 +41,7 @@
40
41
  "autoprefixer": "^10.4.9",
41
42
  "concat-with-sourcemaps": "^1.1.0",
42
43
  "picocolors": "^1.1.0",
43
- "picomatch": "4.0.2",
44
+ "picomatch": "4.0.4",
44
45
  "postcss": "^8.4.38",
45
46
  "postcss-modules": "^6.0.1",
46
47
  "rollup": "^4.14.0",
@@ -48,12 +49,10 @@
48
49
  "tslib": "^2.3.0"
49
50
  },
50
51
  "devDependencies": {
51
- "nx": "22.7.0-pr.35019.f500fd7",
52
+ "nx": "22.7.0-rc.0",
52
53
  "source-map-js": "^1.2.0"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
56
- },
57
- "types": "./index.d.ts",
58
- "type": "commonjs"
57
+ }
59
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rollup/src/plugins/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,kBAAkB,EAGvB,aAAa,EAOd,MAAM,YAAY,CAAC;AAwBpB;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,mBAAmB,CA8B1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rollup/src/plugins/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,kBAAkB,EAGvB,aAAa,EAOd,MAAM,YAAY,CAAC;AAsBpB;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,mBAAmB,CAkC1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
@@ -11,7 +11,6 @@ const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
11
11
  const file_hasher_1 = require("nx/src/hasher/file-hasher");
12
12
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
13
13
  const util_1 = require("@nx/js/src/plugins/typescript/util");
14
- const pmc = (0, devkit_1.getPackageManagerCommand)();
15
14
  function readTargetsCache(cachePath) {
16
15
  return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
17
16
  }
@@ -34,8 +33,9 @@ exports.createNodes = [
34
33
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `rollup-${optionsHash}.hash`);
35
34
  const targetsCache = readTargetsCache(cachePath);
36
35
  const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
36
+ const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
37
37
  try {
38
- return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache, isTsSolutionSetup), configFilePaths, normalizedOptions, context);
38
+ return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache, isTsSolutionSetup, pmc), configFilePaths, normalizedOptions, context);
39
39
  }
40
40
  finally {
41
41
  writeTargetsToCache(cachePath, targetsCache);
@@ -43,7 +43,7 @@ exports.createNodes = [
43
43
  },
44
44
  ];
45
45
  exports.createNodesV2 = exports.createNodes;
46
- async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup) {
46
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc) {
47
47
  const projectRoot = (0, path_1.dirname)(configFilePath);
48
48
  const fullyQualifiedProjectRoot = (0, path_1.join)(context.workspaceRoot, projectRoot);
49
49
  // Do not create a project if package.json and project.json do not exist
@@ -53,7 +53,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
53
53
  return {};
54
54
  }
55
55
  const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
56
- targetsCache[hash] ??= await buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup);
56
+ targetsCache[hash] ??= await buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc);
57
57
  return {
58
58
  projects: {
59
59
  [projectRoot]: {
@@ -63,7 +63,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
63
63
  },
64
64
  };
65
65
  }
66
- async function buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup) {
66
+ async function buildRollupTarget(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc) {
67
67
  let loadConfigFile;
68
68
  try {
69
69
  // Try to load the workspace version of rollup first (it should already exist).
@@ -1 +1 @@
1
- {"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/with-nx.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,6BAA6B,EAC9B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAQjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AA4B9D,wBAAgB,MAAM,CACpB,UAAU,EAAE,yBAAyB,EACrC,YAAY,GAAE,MAAM,CAAC,aAAkB,EAEvC,YAAY,CAAC,EAAE,6BAA6B,EAAE,GAC7C,MAAM,CAAC,aAAa,CAwRtB"}
1
+ {"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../../../packages/rollup/src/plugins/with-nx/with-nx.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,6BAA6B,EAC9B,MAAM,uCAAuC,CAAC;AAY/C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAQjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AA4B9D,wBAAgB,MAAM,CACpB,UAAU,EAAE,yBAAyB,EACrC,YAAY,GAAE,MAAM,CAAC,aAAkB,EAEvC,YAAY,CAAC,EAAE,6BAA6B,EAAE,GAC7C,MAAM,CAAC,aAAa,CA0RtB"}
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withNx = withNx;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
+ const path_1 = require("path");
6
7
  const type_definitions_1 = require("@nx/js/src/plugins/rollup/type-definitions");
7
8
  const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
8
9
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
+ const ts_config_1 = require("@nx/js/src/utils/typescript/ts-config");
9
11
  const plugin_babel_1 = require("@rollup/plugin-babel");
10
12
  const plugin_node_resolve_1 = tslib_1.__importDefault(require("@rollup/plugin-node-resolve"));
11
13
  const autoprefixer_1 = tslib_1.__importDefault(require("autoprefixer"));
@@ -151,7 +153,8 @@ dependencies) {
151
153
  else {
152
154
  options.generatePackageJson ??= true;
153
155
  }
154
- const compilerOptions = createTsCompilerOptions(projectRoot, tsConfig, options, dependencies);
156
+ const originalTsConfigPath = (0, node_path_1.join)(devkit_1.workspaceRoot, options.tsConfig);
157
+ const compilerOptions = createTsCompilerOptions(projectRoot, tsConfig, originalTsConfigPath, options, dependencies);
155
158
  compilerOptions.outDir = Array.isArray(finalConfig.output)
156
159
  ? finalConfig.output[0].dir
157
160
  : finalConfig.output.dir;
@@ -264,8 +267,20 @@ function createInput(options) {
264
267
  });
265
268
  return input;
266
269
  }
267
- function createTsCompilerOptions(projectRoot, config, options, dependencies) {
270
+ function createTsCompilerOptions(projectRoot, config, tsConfigPath, options, dependencies) {
268
271
  const compilerOptionPaths = (0, buildable_libs_utils_1.computeCompilerOptionsPaths)(config, dependencies ?? []);
272
+ // Resolve paths to absolute so they work without baseUrl and regardless
273
+ // of which tsconfig the plugin reads (project vs workspace root).
274
+ const pathsBase = (0, ts_config_1.resolvePathsBaseUrl)(tsConfigPath);
275
+ for (const key of Object.keys(compilerOptionPaths)) {
276
+ compilerOptionPaths[key] = compilerOptionPaths[key].map((p) => {
277
+ if ((0, path_1.isAbsolute)(p)) {
278
+ return p;
279
+ }
280
+ const stripped = p.startsWith('./') ? p.slice(2) : p;
281
+ return (0, path_1.resolve)(pathsBase, stripped).replace(/\\/g, '/');
282
+ });
283
+ }
269
284
  const compilerOptions = {
270
285
  rootDir: projectRoot,
271
286
  allowJs: options.allowJs,
package/project.json DELETED
@@ -1,52 +0,0 @@
1
- {
2
- "name": "rollup",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/rollup",
5
- "projectType": "library",
6
- "targets": {
7
- "build": {
8
- "outputs": ["{workspaceRoot}/dist/packages/rollup/README.md"],
9
- "command": "node ./scripts/copy-readme.js rollup"
10
- },
11
- "legacy-post-build": {
12
- "executor": "@nx/workspace-plugin:legacy-post-build",
13
- "options": {
14
- "tsConfig": "./tsconfig.lib.json",
15
- "assets": [
16
- {
17
- "input": "packages/rollup",
18
- "glob": "**/files/**",
19
- "output": "/"
20
- },
21
- {
22
- "input": "packages/rollup",
23
- "glob": "**/files/**/.gitkeep",
24
- "output": "/"
25
- },
26
- {
27
- "input": "packages/rollup",
28
- "glob": "**/*.json",
29
- "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
30
- "output": "/"
31
- },
32
- {
33
- "input": "packages/rollup",
34
- "glob": "**/*.js",
35
- "ignore": ["**/jest.config.js"],
36
- "output": "/"
37
- },
38
- {
39
- "input": "packages/rollup",
40
- "glob": "**/*.d.ts",
41
- "output": "/"
42
- },
43
- {
44
- "input": "",
45
- "glob": "LICENSE",
46
- "output": "/"
47
- }
48
- ]
49
- }
50
- }
51
- }
52
- }