@ms-cloudpack/storybook-builder 0.6.33 → 0.6.35

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.
@@ -1 +1 @@
1
- {"version":3,"file":"generateAddonSetupCode.d.ts","sourceRoot":"","sources":["../src/generateAddonSetupCode.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,WAarC"}
1
+ {"version":3,"file":"generateAddonSetupCode.d.ts","sourceRoot":"","sources":["../src/generateAddonSetupCode.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,IAAI,MAAM,CAa/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"generateAddonSetupCode.js","sourceRoot":"","sources":["../src/generateAddonSetupCode.ts"],"names":[],"mappings":"AAAA,4HAA4H;AAE5H,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,UAAU,sBAAsB;IACpC,OAAO,MAAM,CAAA;;;;;;;;;;;GAWZ,CAAC;AACJ,CAAC","sourcesContent":["// based on https://github.com/storybookjs/storybook/blob/v7.6.5/code/builders/builder-vite/src/codegen-set-addon-channel.ts\n\nimport { dedent } from 'ts-dedent';\n\nexport function generateAddonSetupCode() {\n return dedent`\n import { createBrowserChannel } from '@storybook/channels';\n import { addons } from '@storybook/preview-api';\n\n const channel = createBrowserChannel({ page: 'preview' });\n addons.setChannel(channel);\n window.__STORYBOOK_ADDONS_CHANNEL__ = channel;\n\n if (window.CONFIG_TYPE === 'DEVELOPMENT'){\n window.__STORYBOOK_SERVER_CHANNEL__ = channel;\n }\n `;\n}\n"]}
1
+ {"version":3,"file":"generateAddonSetupCode.js","sourceRoot":"","sources":["../src/generateAddonSetupCode.ts"],"names":[],"mappings":"AAAA,4HAA4H;AAE5H,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,UAAU,sBAAsB;IACpC,OAAO,MAAM,CAAA;;;;;;;;;;;GAWZ,CAAC;AACJ,CAAC","sourcesContent":["// based on https://github.com/storybookjs/storybook/blob/v7.6.5/code/builders/builder-vite/src/codegen-set-addon-channel.ts\n\nimport { dedent } from 'ts-dedent';\n\nexport function generateAddonSetupCode(): string {\n return dedent`\n import { createBrowserChannel } from '@storybook/channels';\n import { addons } from '@storybook/preview-api';\n\n const channel = createBrowserChannel({ page: 'preview' });\n addons.setChannel(channel);\n window.__STORYBOOK_ADDONS_CHANNEL__ = channel;\n\n if (window.CONFIG_TYPE === 'DEVELOPMENT'){\n window.__STORYBOOK_SERVER_CHANNEL__ = channel;\n }\n `;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"processPreviewAnnotation.d.ts","sourceRoot":"","sources":["../../src/utils/processPreviewAnnotation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE;IACP,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,EAAE,WAAW,CAAC;CAC5B,EACD,OAAO,EAAE,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,mBA8C9C"}
1
+ {"version":3,"file":"processPreviewAnnotation.d.ts","sourceRoot":"","sources":["../../src/utils/processPreviewAnnotation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE;IACP,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,EAAE,WAAW,CAAC;CAC5B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AC,CAAC,wBAAwB,CAAC,OAAO,EAAE,WAAW,CAAC;QAChD,CAAC,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAEvC,IAAI,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,2DAA2D;QAC3D,OAAO,KAAK,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,4FAA4F;IAC5F,oDAAoD;IACpD,0EAA0E;IAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["// based on https://github.com/storybookjs/storybook/blob/v7.6.5/code/builders/builder-vite/src/utils/process-preview-annotation.ts\n\nimport type { PartialContext } from '@ms-cloudpack/api-server';\nimport type { PackageJson } from '@ms-cloudpack/common-types';\nimport { normalizeRelativePath, slash } from '@ms-cloudpack/path-string-parsing';\nimport { findPackageRoot, normalizedPathRelativeTo } from '@ms-cloudpack/path-utilities';\nimport { stripAbsNodeModulesPath } from '@storybook/core-common';\nimport type { PreviewAnnotation } from '@storybook/types';\nimport path from 'path';\n\n/**\n * Preview annotations can take several forms, and cloudpack needs them to be\n * a bit more restrained.\n *\n * For node_modules, we want bare imports (so cloudpack can process them),\n * and for files in the user's source, we want URLs absolute relative to project root.\n */\nexport async function processPreviewAnnotation(\n options: {\n previewPath: PreviewAnnotation;\n appDefinition: PackageJson;\n },\n context: PartialContext<'packages', 'config'>,\n) {\n let { previewPath } = options;\n const { packages, session } = context;\n const { appPath } = session.config;\n\n // If entry is an object, take the first, which is the bare (non-absolute) specifier.\n // This is so that webpack can use an absolute path, and continue supporting super-addons in\n // pnp/pnpm without requiring them to re-export their sub-addons as we do in addon-essentials.\n if (typeof previewPath === 'object') {\n return previewPath.bare;\n }\n\n // Get rid of any extra segments\n previewPath = path.normalize(previewPath);\n\n // For addon dependencies that use require.resolve(), we need to convert to a bare path\n // so that cloudpack will process it as a dependency (cjs -> esm, etc).\n\n // If this is a dependency in a standard (non-store) layout, take the path after the last\n // node_modules segment.\n // TODO: Evaluate if searching for node_modules in a yarn pnp environment is correct\n if (previewPath.includes('node_modules') && !previewPath.includes('.store')) {\n return stripAbsNodeModulesPath(previewPath);\n }\n\n // Resolve absolute paths relative to the project root, and normalize to start with ./\n const normalizedPath = path.isAbsolute(previewPath)\n ? normalizedPathRelativeTo(appPath, previewPath)\n : normalizeRelativePath(previewPath);\n\n if (normalizedPath.startsWith('./')) {\n // For a path within the app package, add the package name.\n return slash(`${options.appDefinition.name}/${normalizedPath.slice(2)}`);\n }\n\n // For paths outside the app package, find which package it's in, and add that package name.\n // This can happen with a store installation layout:\n // /<repo>/node_modules/.store/@storybook-react-virtual-acd5c7bee4/package\n const absPath = path.resolve(appPath, normalizedPath);\n const packagePath = findPackageRoot(absPath);\n if (!packagePath) {\n throw new Error(`Could not find package root for ${absPath}`);\n }\n const definition = await packages.get(packagePath);\n return slash(`${definition.name}/${path.relative(packagePath, absPath)}`);\n}\n"]}
1
+ {"version":3,"file":"processPreviewAnnotation.js","sourceRoot":"","sources":["../../src/utils/processPreviewAnnotation.ts"],"names":[],"mappings":"AAAA,mIAAmI;AAInI,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AACjF,O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AAC,CAAC;IAC3E,CAAC;IAED,4FAA4F;IAC5F,oDAAoD;IACpD,0EAA0E;IAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["// based on https://github.com/storybookjs/storybook/blob/v7.6.5/code/builders/builder-vite/src/utils/process-preview-annotation.ts\n\nimport type { PartialContext } from '@ms-cloudpack/api-server';\nimport type { PackageJson } from '@ms-cloudpack/common-types';\nimport { normalizeRelativePath, slash } from '@ms-cloudpack/path-string-parsing';\nimport { findPackageRoot, normalizedPathRelativeTo } from '@ms-cloudpack/path-utilities';\nimport { stripAbsNodeModulesPath } from '@storybook/core-common';\nimport type { PreviewAnnotation } from '@storybook/types';\nimport path from 'path';\n\n/**\n * Preview annotations can take several forms, and cloudpack needs them to be\n * a bit more restrained.\n *\n * For node_modules, we want bare imports (so cloudpack can process them),\n * and for files in the user's source, we want URLs absolute relative to project root.\n */\nexport async function processPreviewAnnotation(\n options: {\n previewPath: PreviewAnnotation;\n appDefinition: PackageJson;\n },\n context: PartialContext<'packages', 'config'>,\n): Promise<string> {\n let { previewPath } = options;\n const { packages, session } = context;\n const { appPath } = session.config;\n\n // If entry is an object, take the first, which is the bare (non-absolute) specifier.\n // This is so that webpack can use an absolute path, and continue supporting super-addons in\n // pnp/pnpm without requiring them to re-export their sub-addons as we do in addon-essentials.\n if (typeof previewPath === 'object') {\n return previewPath.bare;\n }\n\n // Get rid of any extra segments\n previewPath = path.normalize(previewPath);\n\n // For addon dependencies that use require.resolve(), we need to convert to a bare path\n // so that cloudpack will process it as a dependency (cjs -> esm, etc).\n\n // If this is a dependency in a standard (non-store) layout, take the path after the last\n // node_modules segment.\n // TODO: Evaluate if searching for node_modules in a yarn pnp environment is correct\n if (previewPath.includes('node_modules') && !previewPath.includes('.store')) {\n return stripAbsNodeModulesPath(previewPath);\n }\n\n // Resolve absolute paths relative to the project root, and normalize to start with ./\n const normalizedPath = path.isAbsolute(previewPath)\n ? normalizedPathRelativeTo(appPath, previewPath)\n : normalizeRelativePath(previewPath);\n\n if (normalizedPath.startsWith('./')) {\n // For a path within the app package, add the package name.\n return slash(`${options.appDefinition.name}/${normalizedPath.slice(2)}`);\n }\n\n // For paths outside the app package, find which package it's in, and add that package name.\n // This can happen with a store installation layout:\n // /<repo>/node_modules/.store/@storybook-react-virtual-acd5c7bee4/package\n const absPath = path.resolve(appPath, normalizedPath);\n const packagePath = findPackageRoot(absPath);\n if (!packagePath) {\n throw new Error(`Could not find package root for ${absPath}`);\n }\n const definition = await packages.get(packagePath);\n return slash(`${definition.name}/${path.relative(packagePath, absPath)}`);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/storybook-builder",
3
- "version": "0.6.33",
3
+ "version": "0.6.35",
4
4
  "description": "A tool for building storybook bundles for the cloudpack ecosystem.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,18 +22,18 @@
22
22
  "lint": "cloudpack-scripts lint"
23
23
  },
24
24
  "dependencies": {
25
- "@ms-cloudpack/api-server": "^0.56.17",
26
- "@ms-cloudpack/app-server": "^0.17.24",
27
- "@ms-cloudpack/common-types": "^0.23.7",
28
- "@ms-cloudpack/config": "^0.33.4",
29
- "@ms-cloudpack/create-express-app": "^1.10.10",
25
+ "@ms-cloudpack/api-server": "^0.57.0",
26
+ "@ms-cloudpack/app-server": "^0.17.26",
27
+ "@ms-cloudpack/common-types": "^0.24.0",
28
+ "@ms-cloudpack/config": "^0.33.6",
29
+ "@ms-cloudpack/create-express-app": "^1.10.11",
30
30
  "@ms-cloudpack/environment": "^0.1.1",
31
- "@ms-cloudpack/overlay": "^0.17.105",
32
- "@ms-cloudpack/package-utilities": "^11.0.0",
31
+ "@ms-cloudpack/overlay": "^0.17.107",
32
+ "@ms-cloudpack/package-utilities": "^11.1.0",
33
33
  "@ms-cloudpack/path-string-parsing": "^1.2.6",
34
- "@ms-cloudpack/path-utilities": "^2.8.0",
35
- "@ms-cloudpack/task-reporter": "^0.14.7",
36
- "@ms-cloudpack/telemetry": "^0.10.3",
34
+ "@ms-cloudpack/path-utilities": "^2.8.1",
35
+ "@ms-cloudpack/task-reporter": "^0.14.8",
36
+ "@ms-cloudpack/telemetry": "^0.10.5",
37
37
  "@storybook/core-common": "^7.0.0",
38
38
  "@storybook/node-logger": "^7.0.0",
39
39
  "@storybook/preview": "^7.0.0",
@@ -42,7 +42,7 @@
42
42
  "ts-dedent": "^2.2.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@ms-cloudpack/common-types": "^0.23.7",
45
+ "@ms-cloudpack/common-types": "^0.24.0",
46
46
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
47
47
  "@ms-cloudpack/scripts": "^0.0.1",
48
48
  "@storybook/types": "^7.0.0"