@nx/storybook 23.0.0-beta.4 → 23.0.0-beta.6

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/storybook",
3
- "version": "23.0.0-beta.4",
3
+ "version": "23.0.0-beta.6",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Storybook contains executors and generators for allowing your workspace to use the powerful Storybook integration testing & documenting capabilities.",
6
6
  "repository": {
@@ -34,20 +34,20 @@
34
34
  "migrations": "./migrations.json"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "23.0.0-beta.4",
37
+ "@nx/devkit": "23.0.0-beta.6",
38
38
  "@phenomnomnominal/tsquery": "~6.1.4",
39
39
  "semver": "^7.6.3",
40
40
  "tslib": "^2.3.0",
41
- "@nx/cypress": "23.0.0-beta.4",
42
- "@nx/js": "23.0.0-beta.4",
43
- "@nx/eslint": "23.0.0-beta.4"
41
+ "@nx/cypress": "23.0.0-beta.6",
42
+ "@nx/js": "23.0.0-beta.6",
43
+ "@nx/eslint": "23.0.0-beta.6"
44
44
  },
45
45
  "devDependencies": {
46
- "nx": "23.0.0-beta.4",
46
+ "nx": "23.0.0-beta.6",
47
47
  "storybook": "9.0.6"
48
48
  },
49
49
  "peerDependencies": {
50
- "@nx/web": "23.0.0-beta.4",
50
+ "@nx/web": "23.0.0-beta.6",
51
51
  "storybook": ">=7.0.0 <11.0.0"
52
52
  },
53
53
  "peerDependenciesMeta": {
@@ -1 +1 @@
1
- {"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAWpB,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mDAkDlE;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAMpB,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mDAkDlE;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToInferred = convertToInferred;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const aggregate_log_util_1 = require("@nx/devkit/src/generators/plugin-migrations/aggregate-log-util");
6
- const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
7
6
  const build_post_target_transformer_1 = require("./lib/build-post-target-transformer");
8
7
  const serve_post_target_transformer_1 = require("./lib/serve-post-target-transformer");
9
8
  const plugin_1 = require("../../plugins/plugin");
10
9
  const versions_1 = require("../../utils/versions");
11
10
  async function convertToInferred(tree, options) {
12
11
  const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
13
- const migrationLogs = new aggregate_log_util_1.AggregatedLog();
14
- const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/storybook/plugin', plugin_1.createNodesV2, {
12
+ const migrationLogs = new internal_1.AggregatedLog();
13
+ const migratedProjects = await (0, internal_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/storybook/plugin', plugin_1.createNodesV2, {
15
14
  buildStorybookTargetName: 'build-storybook',
16
15
  serveStorybookTargetName: 'storybook',
17
16
  staticStorybookTargetName: 'static-storybook',
@@ -33,7 +32,7 @@ async function convertToInferred(tree, options) {
33
32
  },
34
33
  ], options.project);
35
34
  if (migratedProjects.size === 0) {
36
- throw new executor_to_plugin_migrator_1.NoTargetsToMigrateError();
35
+ throw new internal_1.NoTargetsToMigrateError();
37
36
  }
38
37
  if (!options.skipFormat) {
39
38
  await (0, devkit_1.formatFiles)(tree);
@@ -1,5 +1,5 @@
1
1
  import { TargetConfiguration, Tree } from '@nx/devkit';
2
- import { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
2
+ import { AggregatedLog } from '@nx/devkit/internal';
3
3
  export declare function buildPostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration, tree: Tree, projectDetails: {
4
4
  projectName: string;
5
5
  root: string;
@@ -1 +1 @@
1
- {"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAM1E,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAW/F,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAgHnD"}
1
+ {"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAGL,aAAa,EACd,MAAM,qBAAqB,CAAC;AAY7B,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAgHnD"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildPostTargetTransformer = buildPostTargetTransformer;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
5
+ const internal_1 = require("@nx/devkit/internal");
6
6
  const tsquery_1 = require("@phenomnomnominal/tsquery");
7
7
  const utils_1 = require("./utils");
8
8
  const utils_2 = require("./utils");
@@ -28,7 +28,7 @@ function buildPostTargetTransformer(migrationLogs) {
28
28
  const configuration = target.configurations[configurationName];
29
29
  if (configuration.configDir &&
30
30
  configuration.configDir !==
31
- (0, plugin_migration_utils_1.toProjectRelativePath)(defaultConfigDir, projectDetails.root)) {
31
+ (0, internal_1.toProjectRelativePath)(defaultConfigDir, projectDetails.root)) {
32
32
  const configFilePath = (0, utils_1.getConfigFilePath)(tree, (0, devkit_1.joinPathFragments)(projectDetails.root, configuration.configDir));
33
33
  (0, utils_1.addConfigValuesToConfigFile)(tree, configFilePath, configValues);
34
34
  (0, utils_1.ensureViteConfigPathIsRelative)(tree, configFilePath, projectDetails.projectName, projectDetails.root, '@nx/storybook:build', migrationLogs);
@@ -50,7 +50,7 @@ function buildPostTargetTransformer(migrationLogs) {
50
50
  }
51
51
  }
52
52
  if (target.outputs) {
53
- (0, plugin_migration_utils_1.processTargetOutputs)(target, [{ newName: 'output-dir', oldName: 'outputDir' }], inferredTargetConfiguration, {
53
+ (0, internal_1.processTargetOutputs)(target, [{ newName: 'output-dir', oldName: 'outputDir' }], inferredTargetConfiguration, {
54
54
  projectName: projectDetails.projectName,
55
55
  projectRoot: projectDetails.root,
56
56
  });
@@ -66,10 +66,10 @@ function handlePropertiesFromTargetOptions(tree, options, defaultConfigDir, proj
66
66
  if (options.configDir !== defaultConfigDir) {
67
67
  configDir = options.configDir;
68
68
  }
69
- options.configDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.configDir, projectRoot);
69
+ options.configDir = (0, internal_1.toProjectRelativePath)(options.configDir, projectRoot);
70
70
  }
71
71
  if (options.outputDir) {
72
- options.outputDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.outputDir, projectRoot);
72
+ options.outputDir = (0, internal_1.toProjectRelativePath)(options.outputDir, projectRoot);
73
73
  }
74
74
  if ('styles' in options) {
75
75
  delete options.styles;
@@ -1,5 +1,5 @@
1
1
  import { TargetConfiguration, Tree } from '@nx/devkit';
2
- import { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
2
+ import { AggregatedLog } from '@nx/devkit/internal';
3
3
  export declare function servePostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration, tree: Tree, projectDetails: {
4
4
  projectName: string;
5
5
  root: string;
@@ -1 +1 @@
1
- {"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/serve-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAQ/F,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAyEnD"}
1
+ {"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/serve-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAyB,MAAM,qBAAqB,CAAC;AAO3E,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAyEnD"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.servePostTargetTransformer = servePostTargetTransformer;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
5
+ const internal_1 = require("@nx/devkit/internal");
6
6
  const utils_1 = require("./utils");
7
7
  function servePostTargetTransformer(migrationLogs) {
8
8
  return (target, tree, projectDetails, inferredTargetConfiguration) => {
@@ -39,10 +39,10 @@ function servePostTargetTransformer(migrationLogs) {
39
39
  }
40
40
  function handlePropertiesFromTargetOptions(tree, options, projectName, projectRoot, migrationLogs) {
41
41
  if ('configDir' in options) {
42
- options.configDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.configDir, projectRoot);
42
+ options.configDir = (0, internal_1.toProjectRelativePath)(options.configDir, projectRoot);
43
43
  }
44
44
  if (options.outputDir) {
45
- options.outputDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.outputDir, projectRoot);
45
+ options.outputDir = (0, internal_1.toProjectRelativePath)(options.outputDir, projectRoot);
46
46
  }
47
47
  if ('uiFramework' in options) {
48
48
  delete options.uiFramework;
@@ -1,5 +1,5 @@
1
1
  import { type Tree } from '@nx/devkit';
2
- import { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
2
+ import { AggregatedLog } from '@nx/devkit/internal';
3
3
  export declare function getConfigFilePath(tree: Tree, configDir: string): string;
4
4
  export declare function addConfigValuesToConfigFile(tree: Tree, configFile: string, configValues: Record<string, Record<string, unknown>>): void;
5
5
  export declare const STORYBOOK_PROP_MAPPINGS: {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAK/F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAS9D;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QAgCtD;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCnC,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,aAAa,QAmE7B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAGf;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM;;;EAKzE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAyB,MAAM,qBAAqB,CAAC;AAI3E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAS9D;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QAgCtD;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCnC,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,aAAa,QAmE7B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAGf;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM;;;EAKzE"}
@@ -8,7 +8,7 @@ exports.getInstalledPackageVersion = getInstalledPackageVersion;
8
8
  exports.getInstalledPackageVersionInfo = getInstalledPackageVersionInfo;
9
9
  const tsquery_1 = require("@phenomnomnominal/tsquery");
10
10
  const devkit_1 = require("@nx/devkit");
11
- const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
11
+ const internal_1 = require("@nx/devkit/internal");
12
12
  const semver_1 = require("semver");
13
13
  function getConfigFilePath(tree, configDir) {
14
14
  return [
@@ -122,7 +122,7 @@ function ensureViteConfigPathIsRelative(tree, configPath, projectName, projectRo
122
122
  if (pathToViteConfig.match(/^(\.\.\/|\.\/)/)) {
123
123
  return;
124
124
  }
125
- const relativePathToViteConfig = (0, plugin_migration_utils_1.toProjectRelativePath)(pathToViteConfig, projectRoot);
125
+ const relativePathToViteConfig = (0, internal_1.toProjectRelativePath)(pathToViteConfig, projectRoot);
126
126
  tree.write(configPath, `${configFileContents.slice(0, viteConfigPathNode.getStart() + 1)}${relativePathToViteConfig}${configFileContents.slice(viteConfigPathNode.getEnd() - 1)}`);
127
127
  }
128
128
  function getInstalledPackageVersion(tree, pkgName) {
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAUpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA8DlC,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAEvD;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAiErE;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA8DlC,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAEvD;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAiErE;AAED,eAAe,aAAa,CAAC"}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initGenerator = initGenerator;
4
4
  exports.initGeneratorInternal = initGeneratorInternal;
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
- const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
7
7
  const plugin_1 = require("../../plugins/plugin");
8
8
  const utilities_1 = require("../../utils/utilities");
9
9
  const versions_1 = require("../../utils/versions");
@@ -52,7 +52,7 @@ async function initGeneratorInternal(tree, schema) {
52
52
  nxJson.useInferencePlugins !== false;
53
53
  schema.addPlugin ??= addPluginDefault;
54
54
  if (schema.addPlugin) {
55
- await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/storybook/plugin', plugin_1.createNodesV2, {
55
+ await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/storybook/plugin', plugin_1.createNodesV2, {
56
56
  serveStorybookTargetName: [
57
57
  'storybook',
58
58
  'serve:storybook',
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/storybook/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAQd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,sBAAsB;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAeD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,sBAAsB,CAgC7D,CAAC;AAEF,eAAO,MAAM,aAAa,uCAAc,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/storybook/src/plugins/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAMd,MAAM,YAAY,CAAC;AAUpB,MAAM,WAAW,sBAAsB;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,sBAAsB,CAiC7D,CAAC;AAEF,eAAO,MAAM,aAAa,uCAAc,CAAC"}
@@ -1,23 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNodesV2 = exports.createNodes = exports.createDependencies = void 0;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const path_1 = require("path");
6
- const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
7
7
  const fs_1 = require("fs");
8
- const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
9
8
  const cache_directory_1 = require("nx/src/utils/cache-directory");
10
9
  const js_1 = require("@nx/js");
11
- const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
12
10
  const file_hasher_1 = require("nx/src/hasher/file-hasher");
13
11
  const tsquery_1 = require("@phenomnomnominal/tsquery");
14
12
  const util_1 = require("@nx/js/src/plugins/typescript/util");
15
- function readTargetsCache(cachePath) {
16
- return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
17
- }
18
- function writeTargetsToCache(cachePath, results) {
19
- (0, devkit_1.writeJsonFile)(cachePath, results);
20
- }
21
13
  /**
22
14
  * @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
23
15
  */
@@ -32,18 +24,20 @@ exports.createNodes = [
32
24
  const normalizedOptions = normalizeOptions(options);
33
25
  const optionsHash = (0, file_hasher_1.hashObject)(normalizedOptions);
34
26
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `storybook-${optionsHash}.hash`);
35
- const targetsCache = readTargetsCache(cachePath);
36
- const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
27
+ const targetsCache = new internal_1.PluginCache(cachePath);
28
+ const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
29
+ const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
30
+ const lockFileName = (0, js_1.getLockFileName)(packageManager);
37
31
  try {
38
- return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache, pmc), configFilePaths, normalizedOptions, context);
32
+ return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache, pmc, lockFileName), configFilePaths, normalizedOptions, context);
39
33
  }
40
34
  finally {
41
- writeTargetsToCache(cachePath, targetsCache);
35
+ targetsCache.writeToDisk();
42
36
  }
43
37
  },
44
38
  ];
45
39
  exports.createNodesV2 = exports.createNodes;
46
- async function createNodesInternal(configFilePath, options, context, targetsCache, pmc) {
40
+ async function createNodesInternal(configFilePath, options, context, targetsCache, pmc, lockFileName) {
47
41
  let projectRoot = '';
48
42
  if (configFilePath.includes('/.storybook')) {
49
43
  projectRoot = (0, path_1.dirname)(configFilePath).replace('/.storybook', '');
@@ -60,14 +54,16 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
60
54
  !siblingFiles.includes('project.json')) {
61
55
  return {};
62
56
  }
63
- const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
57
+ const hash = await (0, internal_1.calculateHashForCreateNodes)(projectRoot, options, context, [lockFileName]);
64
58
  const projectName = buildProjectName(projectRoot, context.workspaceRoot);
65
- targetsCache[hash] ??= await buildStorybookTargets(configFilePath, projectRoot, options, context, projectName, pmc);
59
+ if (!targetsCache.has(hash)) {
60
+ targetsCache.set(hash, await buildStorybookTargets(configFilePath, projectRoot, options, context, projectName, pmc));
61
+ }
66
62
  const result = {
67
63
  projects: {
68
64
  [projectRoot]: {
69
65
  root: projectRoot,
70
- targets: targetsCache[hash],
66
+ targets: targetsCache.get(hash),
71
67
  },
72
68
  },
73
69
  };
@@ -75,7 +71,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
75
71
  }
76
72
  async function buildStorybookTargets(configFilePath, projectRoot, options, context, projectName, pmc) {
77
73
  const buildOutputs = getOutputs();
78
- const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
74
+ const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
79
75
  // First attempt to do a very fast lookup for the framework
80
76
  // If that fails, the framework might be inherited, so do a very heavyweight lookup
81
77
  const storybookFramework = (await getStorybookFramework(configFilePath, context)) ||
@@ -220,7 +216,7 @@ function parseFrameworkName(mainTsJs) {
220
216
  }
221
217
  async function getStorybookFullyResolvedFramework(configFilePath, context) {
222
218
  const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
223
- const { framework } = await (0, config_utils_1.loadConfigFile)(resolvedPath);
219
+ const { framework } = await (0, internal_1.loadConfigFile)(resolvedPath);
224
220
  return typeof framework === 'string' ? framework : framework.name;
225
221
  }
226
222
  function getOutputs() {