@nx/storybook 22.4.0-canary.20260113-246d4fd → 22.4.0-canary.20260115-21d1555

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": "22.4.0-canary.20260113-246d4fd",
3
+ "version": "22.4.0-canary.20260115-21d1555",
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": {
@@ -33,16 +33,16 @@
33
33
  "migrations": "./migrations.json"
34
34
  },
35
35
  "dependencies": {
36
- "@nx/devkit": "22.4.0-canary.20260113-246d4fd",
37
- "@phenomnomnominal/tsquery": "~5.0.1",
36
+ "@nx/devkit": "22.4.0-canary.20260115-21d1555",
37
+ "@phenomnomnominal/tsquery": "~6.1.4",
38
38
  "semver": "^7.6.3",
39
39
  "tslib": "^2.3.0",
40
- "@nx/cypress": "22.4.0-canary.20260113-246d4fd",
41
- "@nx/js": "22.4.0-canary.20260113-246d4fd",
42
- "@nx/eslint": "22.4.0-canary.20260113-246d4fd"
40
+ "@nx/cypress": "22.4.0-canary.20260115-21d1555",
41
+ "@nx/js": "22.4.0-canary.20260115-21d1555",
42
+ "@nx/eslint": "22.4.0-canary.20260115-21d1555"
43
43
  },
44
44
  "devDependencies": {
45
- "nx": "22.4.0-canary.20260113-246d4fd",
45
+ "nx": "22.4.0-canary.20260115-21d1555",
46
46
  "storybook": "9.0.6"
47
47
  },
48
48
  "peerDependencies": {
@@ -101,13 +101,11 @@ function handlePropertiesFromTargetOptions(tree, options, defaultConfigDir, proj
101
101
  function moveDocsModeToConfigFile(tree, configDir, projectName, migrationLogs, useConfigValues = true) {
102
102
  const configFilePath = (0, utils_1.getConfigFilePath)(tree, configDir);
103
103
  const configFileContents = tree.read(configFilePath, 'utf-8');
104
- const ast = tsquery_1.tsquery.ast(configFileContents);
104
+ const sourceFile = (0, tsquery_1.ast)(configFileContents);
105
105
  const CONFIG_OBJECT_SELECTOR = 'VariableDeclaration:has(Identifier[name=config]) ObjectLiteralExpression';
106
106
  const DOCS_MODE_SELECTOR = 'PropertyAssignment:has(Identifier[name=docs]) PropertyAssignment:has(Identifier[name=docsMode])';
107
107
  const DOCS_SELECTOR = 'PropertyAssignment:has(Identifier[name=docs])';
108
- const configNodes = (0, tsquery_1.tsquery)(ast, CONFIG_OBJECT_SELECTOR, {
109
- visitAllChildren: true,
110
- });
108
+ const configNodes = (0, tsquery_1.query)(sourceFile, CONFIG_OBJECT_SELECTOR);
111
109
  if (configNodes.length === 0) {
112
110
  // Invalid config file
113
111
  migrationLogs.addLog({
@@ -118,16 +116,13 @@ function moveDocsModeToConfigFile(tree, configDir, projectName, migrationLogs, u
118
116
  return;
119
117
  }
120
118
  const configNode = configNodes[0];
121
- const hasDocsMode = (0, tsquery_1.tsquery)(configNode, DOCS_MODE_SELECTOR, { visitAllChildren: true }).length >
122
- 0;
119
+ const hasDocsMode = (0, tsquery_1.query)(configNode, DOCS_MODE_SELECTOR).length > 0;
123
120
  if (hasDocsMode) {
124
121
  return;
125
122
  }
126
123
  let startPosition = configNode.getStart() + 1;
127
124
  let needsDocObject = true;
128
- const docsNodes = (0, tsquery_1.tsquery)(configNode, DOCS_SELECTOR, {
129
- visitAllChildren: true,
130
- });
125
+ const docsNodes = (0, tsquery_1.query)(configNode, DOCS_SELECTOR);
131
126
  if (docsNodes.length > 0) {
132
127
  needsDocObject = false;
133
128
  startPosition = docsNodes[0].getStart() + 1;
@@ -141,12 +136,10 @@ function moveDocsModeToConfigFile(tree, configDir, projectName, migrationLogs, u
141
136
  function moveStaticDirToConfigFile(tree, configDir, projectName, migrationLogs, useConfigValues = true) {
142
137
  const configFilePath = (0, utils_1.getConfigFilePath)(tree, configDir);
143
138
  const configFileContents = tree.read(configFilePath, 'utf-8');
144
- const ast = tsquery_1.tsquery.ast(configFileContents);
139
+ const sourceFile = (0, tsquery_1.ast)(configFileContents);
145
140
  const CONFIG_OBJECT_SELECTOR = 'VariableDeclaration:has(Identifier[name=config]) ObjectLiteralExpression';
146
141
  const STATIC_DIRS_SELECTOR = 'PropertyAssignment:has(Identifier[name=staticDirs])';
147
- const configNodes = (0, tsquery_1.tsquery)(ast, CONFIG_OBJECT_SELECTOR, {
148
- visitAllChildren: true,
149
- });
142
+ const configNodes = (0, tsquery_1.query)(sourceFile, CONFIG_OBJECT_SELECTOR);
150
143
  if (configNodes.length === 0) {
151
144
  // Invalid config file
152
145
  migrationLogs.addLog({
@@ -157,8 +150,7 @@ function moveStaticDirToConfigFile(tree, configDir, projectName, migrationLogs,
157
150
  return;
158
151
  }
159
152
  const configNode = configNodes[0];
160
- const hasStaticDir = (0, tsquery_1.tsquery)(configNode, STATIC_DIRS_SELECTOR, { visitAllChildren: true })
161
- .length > 0;
153
+ const hasStaticDir = (0, tsquery_1.query)(configNode, STATIC_DIRS_SELECTOR).length > 0;
162
154
  if (hasStaticDir) {
163
155
  return;
164
156
  }
@@ -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,EAA+B,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AACpE,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,QAkCtD;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,QA+E7B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAKf;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM;;;EAIzE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AACpE,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,CAKf;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM;;;EAIzE"}
@@ -23,11 +23,9 @@ function getConfigFilePath(tree, configDir) {
23
23
  function addConfigValuesToConfigFile(tree, configFile, configValues) {
24
24
  const IMPORT_PROPERTY_SELECTOR = 'ImportDeclaration';
25
25
  const configFileContents = tree.read(configFile, 'utf-8');
26
- const ast = tsquery_1.tsquery.ast(configFileContents);
26
+ const sourceFile = (0, tsquery_1.ast)(configFileContents);
27
27
  // AST TO GET SECTION TO APPEND TO
28
- const importNodes = (0, tsquery_1.tsquery)(ast, IMPORT_PROPERTY_SELECTOR, {
29
- visitAllChildren: true,
30
- });
28
+ const importNodes = (0, tsquery_1.query)(sourceFile, IMPORT_PROPERTY_SELECTOR);
31
29
  let startPosition = 0;
32
30
  if (importNodes.length !== 0) {
33
31
  const lastImportNode = importNodes[importNodes.length - 1];
@@ -93,34 +91,23 @@ function ensureViteConfigPathIsRelative(tree, configPath, projectName, projectRo
93
91
  if (configFileContents.includes('viteFinal:')) {
94
92
  return;
95
93
  }
96
- const ast = tsquery_1.tsquery.ast(configFileContents);
94
+ const sourceFile = (0, tsquery_1.ast)(configFileContents);
97
95
  const REACT_FRAMEWORK_SELECTOR_IDENTIFIERS = 'PropertyAssignment:has(Identifier[name=framework]) PropertyAssignment:has(Identifier[name=name]) StringLiteral[value=@storybook/react-vite]';
98
96
  const REACT_FRAMEWORK_SELECTOR_STRING_LITERALS = 'PropertyAssignment:has(StringLiteral[value=framework]) PropertyAssignment:has(StringLiteral[value=name]) StringLiteral[value=@storybook/react-vite]';
99
97
  const VUE_FRAMEWORK_SELECTOR_IDENTIFIERS = 'PropertyAssignment:has(Identifier[name=framework]) PropertyAssignment:has(Identifier[name=name]) StringLiteral[value=@storybook/vue3-vite]';
100
98
  const VUE_FRAMEWORK_SELECTOR_STRING_LITERALS = 'PropertyAssignment:has(StringLiteral[value=framework]) PropertyAssignment:has(StringLiteral[value=name]) StringLiteral[value=@storybook/vue3-vite]';
101
- const isUsingVite = (0, tsquery_1.tsquery)(ast, REACT_FRAMEWORK_SELECTOR_IDENTIFIERS, {
102
- visitAllChildren: true,
103
- }).length > 0 ||
104
- (0, tsquery_1.tsquery)(ast, REACT_FRAMEWORK_SELECTOR_STRING_LITERALS, {
105
- visitAllChildren: true,
106
- }).length > 0 ||
107
- (0, tsquery_1.tsquery)(ast, VUE_FRAMEWORK_SELECTOR_STRING_LITERALS, {
108
- visitAllChildren: true,
109
- }).length > 0 ||
110
- (0, tsquery_1.tsquery)(ast, VUE_FRAMEWORK_SELECTOR_IDENTIFIERS, { visitAllChildren: true })
111
- .length > 0;
99
+ const isUsingVite = (0, tsquery_1.query)(sourceFile, REACT_FRAMEWORK_SELECTOR_IDENTIFIERS).length > 0 ||
100
+ (0, tsquery_1.query)(sourceFile, REACT_FRAMEWORK_SELECTOR_STRING_LITERALS).length > 0 ||
101
+ (0, tsquery_1.query)(sourceFile, VUE_FRAMEWORK_SELECTOR_STRING_LITERALS).length > 0 ||
102
+ (0, tsquery_1.query)(sourceFile, VUE_FRAMEWORK_SELECTOR_IDENTIFIERS).length > 0;
112
103
  if (!isUsingVite) {
113
104
  return;
114
105
  }
115
106
  const VITE_CONFIG_PATH_SELECTOR = 'PropertyAssignment:has(Identifier[name=framework]) PropertyAssignment PropertyAssignment PropertyAssignment:has(Identifier[name=viteConfigPath]) > StringLiteral';
116
- let viteConfigPathNodes = (0, tsquery_1.tsquery)(ast, VITE_CONFIG_PATH_SELECTOR, {
117
- visitAllChildren: true,
118
- });
107
+ let viteConfigPathNodes = (0, tsquery_1.query)(sourceFile, VITE_CONFIG_PATH_SELECTOR);
119
108
  if (viteConfigPathNodes.length === 0) {
120
109
  const VITE_CONFIG_PATH_SELECTOR_STRING_LITERALS = 'PropertyAssignment:has(StringLiteral[value=framework]) PropertyAssignment PropertyAssignment PropertyAssignment:has(StringLiteral[value=viteConfigPath]) > StringLiteral:not(StringLiteral[value=viteConfigPath])';
121
- viteConfigPathNodes = (0, tsquery_1.tsquery)(ast, VITE_CONFIG_PATH_SELECTOR_STRING_LITERALS, {
122
- visitAllChildren: true,
123
- });
110
+ viteConfigPathNodes = (0, tsquery_1.query)(sourceFile, VITE_CONFIG_PATH_SELECTOR_STRING_LITERALS);
124
111
  if (viteConfigPathNodes.length === 0) {
125
112
  migrationLogs.addLog({
126
113
  project: projectName,
@@ -193,30 +193,30 @@ function serveStaticTarget(options, projectRoot) {
193
193
  async function getStorybookFramework(configFilePath, context) {
194
194
  const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
195
195
  const mainTsJs = (0, fs_1.readFileSync)(resolvedPath, 'utf-8');
196
- const importDeclarations = tsquery_1.tsquery.query(mainTsJs, 'ImportDeclaration:has(ImportSpecifier:has([text="StorybookConfig"]))')?.[0];
196
+ const importDeclarations = (0, tsquery_1.query)(mainTsJs, 'ImportDeclaration:has(ImportSpecifier:has([text="StorybookConfig"]))')?.[0];
197
197
  if (!importDeclarations) {
198
198
  return parseFrameworkName(mainTsJs);
199
199
  }
200
- const storybookConfigImportPackage = tsquery_1.tsquery.query(importDeclarations, 'StringLiteral')?.[0];
200
+ const storybookConfigImportPackage = (0, tsquery_1.query)(importDeclarations, 'StringLiteral')?.[0];
201
201
  if (storybookConfigImportPackage?.getText() === `'@storybook/core-common'`) {
202
202
  return parseFrameworkName(mainTsJs);
203
203
  }
204
204
  return storybookConfigImportPackage?.getText();
205
205
  }
206
206
  function parseFrameworkName(mainTsJs) {
207
- const frameworkPropertyAssignment = tsquery_1.tsquery.query(mainTsJs, `PropertyAssignment:has(Identifier:has([text="framework"]))`)?.[0];
207
+ const frameworkPropertyAssignment = (0, tsquery_1.query)(mainTsJs, `PropertyAssignment:has(Identifier:has([text="framework"]))`)?.[0];
208
208
  if (!frameworkPropertyAssignment) {
209
209
  return undefined;
210
210
  }
211
- const propertyAssignments = tsquery_1.tsquery.query(frameworkPropertyAssignment, `PropertyAssignment:has(Identifier:has([text="name"]))`);
211
+ const propertyAssignments = (0, tsquery_1.query)(frameworkPropertyAssignment, `PropertyAssignment:has(Identifier:has([text="name"]))`);
212
212
  const namePropertyAssignment = propertyAssignments?.find((expression) => {
213
213
  return expression.getText().startsWith('name');
214
214
  });
215
215
  if (!namePropertyAssignment) {
216
- const storybookConfigImportPackage = tsquery_1.tsquery.query(frameworkPropertyAssignment, 'StringLiteral')?.[0];
216
+ const storybookConfigImportPackage = (0, tsquery_1.query)(frameworkPropertyAssignment, 'StringLiteral')?.[0];
217
217
  return storybookConfigImportPackage?.getText();
218
218
  }
219
- return tsquery_1.tsquery.query(namePropertyAssignment, `StringLiteral`)?.[0]?.getText();
219
+ return (0, tsquery_1.query)(namePropertyAssignment, `StringLiteral`)?.[0]?.getText();
220
220
  }
221
221
  async function getStorybookFullyResolvedFramework(configFilePath, context) {
222
222
  const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);