diff --git a/__snapshots__/components-source--component-with-props-raw.png b/__snapshots__/components-source--component-with-props-raw.png index 696fddb..ec24ca5 100644 Binary files a/__snapshots__/components-source--component-with-props-raw.png and b/__snapshots__/components-source--component-with-props-raw.png differ diff --git a/__snapshots__/components-source.test.js.snap b/__snapshots__/components-source.test.js.snap index 0a5de26..d56e916 100644 --- a/__snapshots__/components-source.test.js.snap +++ b/__snapshots__/components-source.test.js.snap @@ -67,7 +67,7 @@ exports[`Components/Source Component With Props Raw Displayed Source test 1`] = - '@idesigncode/storybook-tools/Component.mjs' + '@idesigncode/storybook-tools/dist/Component.mjs' ; @@ -244,13 +244,6 @@ exports[`Components/Source Component With Props Raw test 1`] = ` - - // The [value] will replace the [key] matched within an import path - - - - - '^' @@ -350,7 +343,7 @@ exports[`Components/Source Component With Props Raw test 1`] = ` - '' + 'dist/' , @@ -358,7 +351,7 @@ exports[`Components/Source Component With Props Raw test 1`] = ` - // Remove "src directory" path segments + // Replace "src/" with "dist/" diff --git a/__snapshots__/configuration-import-path-replacements.test.js.snap b/__snapshots__/configuration-import-path-replacements.test.js.snap index 8de96fb..e6eab6c 100644 --- a/__snapshots__/configuration-import-path-replacements.test.js.snap +++ b/__snapshots__/configuration-import-path-replacements.test.js.snap @@ -135,13 +135,6 @@ exports[`Configuration/Import Path Replacements Env test 1`] = ` - - // The [value] will replace the [key] matched within an import path - - - - - '^' @@ -241,7 +234,7 @@ exports[`Configuration/Import Path Replacements Env test 1`] = ` - '' + 'dist/' , @@ -249,7 +242,7 @@ exports[`Configuration/Import Path Replacements Env test 1`] = ` - // Remove "src directory" path segments + // Replace "src/" with "dist/" diff --git a/stories/ImportPathReplacements.mdx b/stories/ImportPathReplacements.mdx index d0b787b..c7e167f 100644 --- a/stories/ImportPathReplacements.mdx +++ b/stories/ImportPathReplacements.mdx @@ -7,10 +7,23 @@ import * as ImportPathReplacementsStories from './ImportPathReplacements.stories The [Source](/docs/components-source--docs) component can automatically display all [file import paths](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) as they would be used by a consumer of your code. -By default, this functionality is disabled unless `process.env.IMPORT_PATH_REPLACEMENTS` has a value - a stringified "key-value pair" object: - -- `[key]` - a string to match within an import path (also accepts `^` to prepend relative paths). -- `[value]` - a string to replace the matched `[key]` string. +By default, this functionality is disabled unless `process.env.IMPORT_PATH_REPLACEMENTS` has a value - a stringified `{ key: value }` object: + + + + + + + + + + + + +
`key` + A string to match within an import path. Also accepts `^` to prepend + relative paths. +
`value`A string to replace the matched `key` string.
> #### Note: > diff --git a/stories/ImportPathReplacements.stories.mjs b/stories/ImportPathReplacements.stories.mjs index 9b9dfe2..9d406bd 100644 --- a/stories/ImportPathReplacements.stories.mjs +++ b/stories/ImportPathReplacements.stories.mjs @@ -15,11 +15,10 @@ export const Env = { ` env: (config) => ({`, ` ...config,`, ` IMPORT_PATH_REPLACEMENTS: JSON.stringify({`, - ` // The [value] will replace the [key] matched within an import path`, ` '^': \`\${packageJson.name}/\`, // Prepend package name to relative paths`, ` '../': '', // Remove "parent directory" relative path segments`, ` './': '', // Remove "current directory" relative path segments`, - ` 'src/': '', // Remove "src directory" path segments`, + ` 'src/': 'dist/', // Replace "src/" with "dist/"`, ` }),`, ` }),`, ` // ...main.mjs configuration`, diff --git a/stories/Source.mdx b/stories/Source.mdx index 7d5ff31..b5c28f3 100644 --- a/stories/Source.mdx +++ b/stories/Source.mdx @@ -32,10 +32,23 @@ The `Source` component can also display all [file import paths](https://develope Please see [Import Path Replacements](/docs/configuration-import-path-replacements--docs) for setting global (default) configuration of all instances of `Source`. -Alternatively, you can override the global configuration by supplying a stringified "key-value pair" object for `importPathReplacements` directly: - -- `[key]` - a string to match within an import path (also accepts `^` to prepend relative paths). -- `[value]` - a string to replace the matched `[key]` string. +Alternatively, you can override the global configuration by supplying a stringified `{ key: value }` object for `importPathReplacements` directly: + + + + + + + + + + + + +
`key` + A string to match within an import path. Also accepts `^` to prepend + relative paths. +
`value`A string to replace the matched `key` string.
> #### Note: > diff --git a/stories/Source.stories.mjs b/stories/Source.stories.mjs index 6a21a31..8aca665 100644 --- a/stories/Source.stories.mjs +++ b/stories/Source.stories.mjs @@ -85,11 +85,10 @@ export const ComponentWithPropsRaw = { ``, ].join('\n'), @@ -107,7 +106,7 @@ export const ComponentWithPropsRawDisplayedSource = { '^': `${packageJson.name}/`, '../': '', './': '', - 'src/': '', + 'src/': 'dist/', }), }, };