diff --git a/package.json b/package.json index df16965..77b663f 100644 --- a/package.json +++ b/package.json @@ -13,15 +13,6 @@ }, "license": "MIT", "type": "module", - "imports": { - "#tests/*": { - "development": "./tests/*.ts" - }, - "#*": { - "development": "./src/*.ts", - "default": "./dist/*.js" - } - }, "exports": { ".": { "types": "./dist/index.d.ts", @@ -44,7 +35,7 @@ "README.md" ], "scripts": { - "build": "svelte-package --input ./src --types", + "build": "svelte-package --types", "build-storybook": "storybook build", "check": "svelte-check", "chromatic": "chromatic --exit-zero-on-changes", @@ -54,7 +45,7 @@ "lint": "eslint --cache --cache-location=.cache/eslint --ext .js,.json,.html,.svelte,.ts --report-unused-disable-directives", "prepublish": "pnpm run clean && pnpm run build", "release": "pnpm run build && auto shipit", - "start": "concurrently \"pnpm run storybook --quiet\" \"pnpm run build --watch\"", + "start": "pnpm run build && concurrently \"pnpm run build --watch\" \"pnpm run storybook --quiet\"", "storybook": "storybook dev --port 6006 --no-open", "test": "vitest run", "test:watch": "vitest watch" diff --git a/src/compiler/plugins.ts b/src/compiler/plugins.ts index 503dd69..5215300 100644 --- a/src/compiler/plugins.ts +++ b/src/compiler/plugins.ts @@ -14,11 +14,11 @@ import MagicString from 'magic-string'; import { preprocess } from 'svelte/compiler'; import type { Plugin } from 'vite'; -import { codemodLegacyNodes } from '#compiler/pre-transform/index'; -import { transformStoriesCode } from '#compiler/post-transform/index'; -import { getSvelteAST } from '#parser/ast'; -import { extractCompiledASTNodes } from '#parser/extract/compiled/nodes'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; +import { codemodLegacyNodes } from '$lib/compiler/pre-transform/index.js'; +import { transformStoriesCode } from '$lib/compiler/post-transform/index.js'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractCompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; export async function preTransformPlugin(): Promise { const [{ createFilter }, { print }] = await Promise.all([ diff --git a/src/compiler/post-transform/appendix/create-export-default.test.ts b/src/compiler/post-transform/appendix/create-export-default.test.ts index cd1531c..b9dcbbe 100644 --- a/src/compiler/post-transform/appendix/create-export-default.test.ts +++ b/src/compiler/post-transform/appendix/create-export-default.test.ts @@ -1,9 +1,9 @@ import { print } from 'esrap'; import { describe, it } from 'vitest'; -import { createExportDefaultMeta } from './create-export-default'; +import { createExportDefaultMeta } from './create-export-default.js'; -import type { ESTreeAST } from '#parser/ast'; +import type { ESTreeAST } from '$lib/parser/ast.js'; describe(createExportDefaultMeta.name, () => { it('creates a new export default correctly', ({ expect }) => { diff --git a/src/compiler/post-transform/appendix/create-export-default.ts b/src/compiler/post-transform/appendix/create-export-default.ts index c01de2b..b3c5e03 100644 --- a/src/compiler/post-transform/appendix/create-export-default.ts +++ b/src/compiler/post-transform/appendix/create-export-default.ts @@ -1,5 +1,5 @@ -import type { getMetaIdentifier } from '#parser/analyse/define-meta/meta-identifier'; -import type { ESTreeAST } from '#parser/ast'; +import type { getMetaIdentifier } from '$lib/parser/analyse/define-meta/meta-identifier.js'; +import type { ESTreeAST } from '$lib/parser/ast.js'; interface Params { metaIdentifier: ReturnType; diff --git a/src/compiler/post-transform/appendix/create-export-order.test.ts b/src/compiler/post-transform/appendix/create-export-order.test.ts index de84531..c8b2a10 100644 --- a/src/compiler/post-transform/appendix/create-export-order.test.ts +++ b/src/compiler/post-transform/appendix/create-export-order.test.ts @@ -1,7 +1,7 @@ import { print } from 'esrap'; import { describe, it } from 'vitest'; -import { createExportOrderVariable } from './create-export-order'; +import { createExportOrderVariable } from './create-export-order.js'; describe(createExportOrderVariable.name, () => { it('correctly creates a variable with named exports order', ({ expect }) => { diff --git a/src/compiler/post-transform/appendix/create-export-order.ts b/src/compiler/post-transform/appendix/create-export-order.ts index 3351311..52a8f5f 100644 --- a/src/compiler/post-transform/appendix/create-export-order.ts +++ b/src/compiler/post-transform/appendix/create-export-order.ts @@ -1,5 +1,5 @@ -import type { getStoriesIdentifiers } from '#parser/analyse/story/attributes/identifiers'; -import type { ESTreeAST } from '#parser/ast'; +import type { getStoriesIdentifiers } from '$lib/parser/analyse/story/attributes/identifiers.js'; +import type { ESTreeAST } from '$lib/parser/ast.js'; interface Params { storyIdentifiers: ReturnType; diff --git a/src/compiler/post-transform/appendix/create-import.test.ts b/src/compiler/post-transform/appendix/create-import.test.ts index b22fbbe..eb0dea7 100644 --- a/src/compiler/post-transform/appendix/create-import.test.ts +++ b/src/compiler/post-transform/appendix/create-import.test.ts @@ -1,7 +1,7 @@ import { print } from 'esrap'; import { describe, it } from 'vitest'; -import { createRuntimeStoriesImport } from './create-import'; +import { createRuntimeStoriesImport } from './create-import.js'; describe(createRuntimeStoriesImport.name, () => { it('creates import correctly', ({ expect }) => { diff --git a/src/compiler/post-transform/appendix/create-import.ts b/src/compiler/post-transform/appendix/create-import.ts index 736fb1b..9bfaa1c 100644 --- a/src/compiler/post-transform/appendix/create-import.ts +++ b/src/compiler/post-transform/appendix/create-import.ts @@ -1,6 +1,6 @@ import pkg from '@storybook/addon-svelte-csf/package.json' with { type: 'json' }; -import type { ESTreeAST } from '#parser/ast'; +import type { ESTreeAST } from '$lib/parser/ast.js'; /** * The export is defined in the `package.json` export map diff --git a/src/compiler/post-transform/appendix/create-named-export-story.test.ts b/src/compiler/post-transform/appendix/create-named-export-story.test.ts index e50cc4b..0210c19 100644 --- a/src/compiler/post-transform/appendix/create-named-export-story.test.ts +++ b/src/compiler/post-transform/appendix/create-named-export-story.test.ts @@ -1,10 +1,10 @@ import { print } from 'esrap'; import { describe, it } from 'vitest'; -import { createNamedExportStory } from './create-named-export-story'; -import { createVariableFromRuntimeStoriesCall } from './create-variable-from-runtime-stories-call'; +import { createNamedExportStory } from './create-named-export-story.js'; +import { createVariableFromRuntimeStoriesCall } from './create-variable-from-runtime-stories-call.js'; -import type { ESTreeAST } from '#parser/ast'; +import type { ESTreeAST } from '$lib/parser/ast.js'; describe(createNamedExportStory.name, () => { it('correctly creates a variable with named exports order', ({ expect }) => { diff --git a/src/compiler/post-transform/appendix/create-named-export-story.ts b/src/compiler/post-transform/appendix/create-named-export-story.ts index 1f79458..a63db50 100644 --- a/src/compiler/post-transform/appendix/create-named-export-story.ts +++ b/src/compiler/post-transform/appendix/create-named-export-story.ts @@ -1,6 +1,6 @@ -import type { createVariableFromRuntimeStoriesCall } from './create-variable-from-runtime-stories-call'; +import type { createVariableFromRuntimeStoriesCall } from './create-variable-from-runtime-stories-call.js'; -import type { ESTreeAST } from '#parser/ast'; +import type { ESTreeAST } from '$lib/parser/ast.js'; interface Params { exportName: string; diff --git a/src/compiler/post-transform/appendix/create-variable-from-runtime-stories-call.test.ts b/src/compiler/post-transform/appendix/create-variable-from-runtime-stories-call.test.ts index fc70bea..38ad707 100644 --- a/src/compiler/post-transform/appendix/create-variable-from-runtime-stories-call.test.ts +++ b/src/compiler/post-transform/appendix/create-variable-from-runtime-stories-call.test.ts @@ -1,7 +1,7 @@ import { print } from 'esrap'; import { describe, it } from 'vitest'; -import { createVariableFromRuntimeStoriesCall } from './create-variable-from-runtime-stories-call'; +import { createVariableFromRuntimeStoriesCall } from './create-variable-from-runtime-stories-call.js'; describe(createVariableFromRuntimeStoriesCall.name, () => { it('creates a variable correctly', ({ expect }) => { diff --git a/src/compiler/post-transform/appendix/create-variable-from-runtime-stories-call.ts b/src/compiler/post-transform/appendix/create-variable-from-runtime-stories-call.ts index 386518e..a9d1de2 100644 --- a/src/compiler/post-transform/appendix/create-variable-from-runtime-stories-call.ts +++ b/src/compiler/post-transform/appendix/create-variable-from-runtime-stories-call.ts @@ -1,5 +1,5 @@ -import type { getMetaIdentifier } from '#parser/analyse/define-meta/meta-identifier'; -import type { ESTreeAST } from '#parser/ast'; +import type { getMetaIdentifier } from '$lib/parser/analyse/define-meta/meta-identifier.js'; +import type { ESTreeAST } from '$lib/parser/ast.js'; interface Params { storiesFunctionDeclaration: ESTreeAST.FunctionDeclaration; diff --git a/src/compiler/post-transform/create-appendix.ts b/src/compiler/post-transform/create-appendix.ts index ad5f0f4..d49de35 100644 --- a/src/compiler/post-transform/create-appendix.ts +++ b/src/compiler/post-transform/create-appendix.ts @@ -1,16 +1,16 @@ import { print } from 'esrap'; import MagicString from 'magic-string'; -import { createExportDefaultMeta } from './appendix/create-export-default'; -import { createExportOrderVariable } from './appendix/create-export-order'; -import { createRuntimeStoriesImport } from './appendix/create-import'; -import { createVariableFromRuntimeStoriesCall } from './appendix/create-variable-from-runtime-stories-call'; -import { createNamedExportStory } from './appendix/create-named-export-story'; +import { createExportDefaultMeta } from './appendix/create-export-default.js'; +import { createExportOrderVariable } from './appendix/create-export-order.js'; +import { createRuntimeStoriesImport } from './appendix/create-import.js'; +import { createVariableFromRuntimeStoriesCall } from './appendix/create-variable-from-runtime-stories-call.js'; +import { createNamedExportStory } from './appendix/create-named-export-story.js'; -import { getMetaIdentifier } from '#parser/analyse/define-meta/meta-identifier'; -import type { CompiledASTNodes } from '#parser/extract/compiled/nodes'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { getStoriesIdentifiers } from '#parser/analyse/story/attributes/identifiers'; +import { getMetaIdentifier } from '$lib/parser/analyse/define-meta/meta-identifier.js'; +import type { CompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { getStoriesIdentifiers } from '$lib/parser/analyse/story/attributes/identifiers.js'; interface Params { code: MagicString; diff --git a/src/compiler/post-transform/define-meta/destructure-meta.ts b/src/compiler/post-transform/define-meta/destructure-meta.ts index 7fdd0e5..82d8341 100644 --- a/src/compiler/post-transform/define-meta/destructure-meta.ts +++ b/src/compiler/post-transform/define-meta/destructure-meta.ts @@ -1,5 +1,5 @@ -import type { CompiledASTNodes } from '#parser/extract/compiled/nodes'; -import { NoDestructuredDefineMetaCallError } from '#utils/error/parser/analyse/define-meta'; +import type { CompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; +import { NoDestructuredDefineMetaCallError } from '$lib/utils/error/parser/analyse/define-meta.js'; interface Params { nodes: CompiledASTNodes; diff --git a/src/compiler/post-transform/define-meta/index.test.ts b/src/compiler/post-transform/define-meta/index.test.ts index 57b15a4..db4ad25 100644 --- a/src/compiler/post-transform/define-meta/index.test.ts +++ b/src/compiler/post-transform/define-meta/index.test.ts @@ -9,9 +9,9 @@ import { describe, it } from 'vitest'; import { transformDefineMeta } from '.'; -import { getSvelteAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { extractCompiledASTNodes } from '#parser/extract/compiled/nodes'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { extractCompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); diff --git a/src/compiler/post-transform/define-meta/index.ts b/src/compiler/post-transform/define-meta/index.ts index bc20527..c88f61a 100644 --- a/src/compiler/post-transform/define-meta/index.ts +++ b/src/compiler/post-transform/define-meta/index.ts @@ -1,11 +1,11 @@ import { print } from 'esrap'; import type MagicString from 'magic-string'; -import { destructureMetaFromDefineMeta } from './destructure-meta'; -import { insertDefineMetaJSDocCommentAsDescription } from './insert-description'; +import { destructureMetaFromDefineMeta } from './destructure-meta.js'; +import { insertDefineMetaJSDocCommentAsDescription } from './insert-description.js'; -import type { CompiledASTNodes } from '#parser/extract/compiled/nodes'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; +import type { CompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; interface Params { code: MagicString; diff --git a/src/compiler/post-transform/define-meta/insert-description.ts b/src/compiler/post-transform/define-meta/insert-description.ts index 085e7f1..fc2a22c 100644 --- a/src/compiler/post-transform/define-meta/insert-description.ts +++ b/src/compiler/post-transform/define-meta/insert-description.ts @@ -8,11 +8,11 @@ import { getDescriptionPropertyValue, getDocsPropertyValue, getParametersPropertyValue, -} from '#compiler/post-transform/shared/description'; -import { createASTObjectExpression, createASTProperty, type ESTreeAST } from '#parser/ast'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; -import type { CompiledASTNodes } from '#parser/extract/compiled/nodes'; -import { getDefineMetaFirstArgumentObjectExpression } from '#parser/extract/svelte/define-meta'; +} from '$lib/compiler/post-transform/shared/description.js'; +import { createASTObjectExpression, createASTProperty, type ESTreeAST } from '$lib/parser/ast.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import type { CompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; +import { getDefineMetaFirstArgumentObjectExpression } from '$lib/parser/extract/svelte/define-meta.js'; interface Params { nodes: { diff --git a/src/compiler/post-transform/index.test.ts b/src/compiler/post-transform/index.test.ts index 1d00c26..1d8eb9f 100644 --- a/src/compiler/post-transform/index.test.ts +++ b/src/compiler/post-transform/index.test.ts @@ -8,9 +8,9 @@ import { describe, it } from 'vitest'; import { transformStoriesCode } from '.'; -import { getSvelteAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { extractCompiledASTNodes } from '#parser/extract/compiled/nodes'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { extractCompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); diff --git a/src/compiler/post-transform/index.ts b/src/compiler/post-transform/index.ts index d19a796..bdcee4f 100644 --- a/src/compiler/post-transform/index.ts +++ b/src/compiler/post-transform/index.ts @@ -1,13 +1,13 @@ import type MagicString from 'magic-string'; -import { transformStory } from './story'; -import { transformDefineMeta } from './define-meta'; -import { removeExportDefault } from './remove-export-default'; -import { createAppendix } from './create-appendix'; +import { transformStory } from './story/index.js'; +import { transformDefineMeta } from './define-meta/index.js'; +import { removeExportDefault } from './remove-export-default.js'; +import { createAppendix } from './create-appendix.js'; -import type { CompiledASTNodes } from '#parser/extract/compiled/nodes'; -import { extractStoriesNodesFromExportDefaultFn } from '#parser/extract/compiled/stories'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; +import type { CompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; +import { extractStoriesNodesFromExportDefaultFn } from '$lib/parser/extract/compiled/stories.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; interface Params { code: MagicString; diff --git a/src/compiler/post-transform/remove-export-default.test.ts b/src/compiler/post-transform/remove-export-default.test.ts index 78fd6b8..f35b85b 100644 --- a/src/compiler/post-transform/remove-export-default.test.ts +++ b/src/compiler/post-transform/remove-export-default.test.ts @@ -6,10 +6,10 @@ import MagicString from 'magic-string'; import { parseAst } from 'rollup/parseAst'; import { describe, it } from 'vitest'; -import { removeExportDefault } from './remove-export-default'; +import { removeExportDefault } from './remove-export-default.js'; -import { extractCompiledASTNodes } from '#parser/extract/compiled/nodes'; -import { StorybookSvelteCSFError } from '#utils/error'; +import { extractCompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; +import { StorybookSvelteCSFError } from '$lib/utils/error.js'; const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); diff --git a/src/compiler/post-transform/remove-export-default.ts b/src/compiler/post-transform/remove-export-default.ts index 2eae373..30a50a7 100644 --- a/src/compiler/post-transform/remove-export-default.ts +++ b/src/compiler/post-transform/remove-export-default.ts @@ -1,7 +1,7 @@ import { print } from 'esrap'; import type MagicString from 'magic-string'; -import type { CompiledASTNodes } from '#parser/extract/compiled/nodes'; +import type { CompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; interface Params { code: MagicString; diff --git a/src/compiler/post-transform/shared/description.ts b/src/compiler/post-transform/shared/description.ts index dce4ab8..7040a8b 100644 --- a/src/compiler/post-transform/shared/description.ts +++ b/src/compiler/post-transform/shared/description.ts @@ -1,9 +1,9 @@ import { logger } from '@storybook/node-logger'; import dedent from 'dedent'; -import type { ESTreeAST, SvelteAST } from '#parser/ast'; +import type { ESTreeAST, SvelteAST } from '$lib/parser/ast.js'; -import { createASTObjectExpression } from '#parser/ast'; +import { createASTObjectExpression } from '$lib/parser/ast.js'; interface FindPropertyOptions { name: string; diff --git a/src/compiler/post-transform/story/index.test.ts b/src/compiler/post-transform/story/index.test.ts index b279e4f..d789418 100644 --- a/src/compiler/post-transform/story/index.test.ts +++ b/src/compiler/post-transform/story/index.test.ts @@ -9,10 +9,10 @@ import { describe, it } from 'vitest'; import { transformStory } from '.'; -import { getSvelteAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { extractCompiledASTNodes } from '#parser/extract/compiled/nodes'; -import { extractStoriesNodesFromExportDefaultFn } from '#parser/extract/compiled/stories'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { extractCompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; +import { extractStoriesNodesFromExportDefaultFn } from '$lib/parser/extract/compiled/stories.js'; const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); diff --git a/src/compiler/post-transform/story/index.ts b/src/compiler/post-transform/story/index.ts index 4b9fb66..3252e71 100644 --- a/src/compiler/post-transform/story/index.ts +++ b/src/compiler/post-transform/story/index.ts @@ -1,11 +1,11 @@ import { print } from 'esrap'; import type MagicString from 'magic-string'; -import { insertStoryHTMLCommentAsDescription } from './insert-description'; -import { insertSvelteCSFToStoryParameters } from './insert-svelte-csf'; +import { insertStoryHTMLCommentAsDescription } from './insert-description.js'; +import { insertSvelteCSFToStoryParameters } from './insert-svelte-csf.js'; -import type { extractStoriesNodesFromExportDefaultFn } from '#parser/extract/compiled/stories'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; +import type { extractStoriesNodesFromExportDefaultFn } from '$lib/parser/extract/compiled/stories.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; interface Params { code: MagicString; diff --git a/src/compiler/post-transform/story/insert-description.ts b/src/compiler/post-transform/story/insert-description.ts index adc5b94..d0c4e8f 100644 --- a/src/compiler/post-transform/story/insert-description.ts +++ b/src/compiler/post-transform/story/insert-description.ts @@ -9,13 +9,13 @@ import { getParametersPropertyValue, getDocsPropertyValue, getDescriptionPropertyValue, -} from '#compiler/post-transform/shared/description'; -import { createASTObjectExpression, createASTProperty } from '#parser/ast'; +} from '$lib/compiler/post-transform/shared/description.js'; +import { createASTObjectExpression, createASTProperty } from '$lib/parser/ast.js'; -import type { ESTreeAST } from '#parser/ast'; -import type { extractStoriesNodesFromExportDefaultFn } from '#parser/extract/compiled/stories'; -import { getStoryPropsObjectExpression } from '#parser/extract/compiled/story'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; +import type { ESTreeAST } from '$lib/parser/ast.js'; +import type { extractStoriesNodesFromExportDefaultFn } from '$lib/parser/extract/compiled/stories.js'; +import { getStoryPropsObjectExpression } from '$lib/parser/extract/compiled/story.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; interface Params { nodes: { diff --git a/src/compiler/post-transform/story/insert-svelte-csf.ts b/src/compiler/post-transform/story/insert-svelte-csf.ts index 6ee2ffe..f1ea6b1 100644 --- a/src/compiler/post-transform/story/insert-svelte-csf.ts +++ b/src/compiler/post-transform/story/insert-svelte-csf.ts @@ -1,13 +1,13 @@ import { findPropertyParametersIndex, getParametersPropertyValue, -} from '#compiler/post-transform/shared/description'; +} from '$lib/compiler/post-transform/shared/description.js'; -import type { extractStoriesNodesFromExportDefaultFn } from '#parser/extract/compiled/stories'; -import { getStoryPropsObjectExpression } from '#parser/extract/compiled/story'; -import type { SvelteASTNodes, extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { getStoryChildrenRawCode } from '#parser/analyse/story/children'; -import { createASTObjectExpression, createASTProperty } from '#parser/ast'; +import type { extractStoriesNodesFromExportDefaultFn } from '$lib/parser/extract/compiled/stories.js'; +import { getStoryPropsObjectExpression } from '$lib/parser/extract/compiled/story.js'; +import type { SvelteASTNodes, extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { getStoryChildrenRawCode } from '$lib/parser/analyse/story/children.js'; +import { createASTObjectExpression, createASTProperty } from '$lib/parser/ast.js'; interface Params { nodes: { diff --git a/src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts b/src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts index a2bb80c..493841e 100644 --- a/src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts +++ b/src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts @@ -1,10 +1,10 @@ import { print } from 'svelte-ast-print'; import { describe, it } from 'vitest'; -import { transformComponentMetaToDefineMeta } from './component-meta-to-define-meta'; +import { transformComponentMetaToDefineMeta } from './component-meta-to-define-meta.js'; -import type { SvelteAST } from '#parser/ast'; -import { parseAndExtractSvelteNode } from '#tests/extractor'; +import type { SvelteAST } from '$lib/parser/ast.js'; +import { parseAndExtractSvelteNode } from '../../../../tests/extractor.js'; describe(transformComponentMetaToDefineMeta.name, () => { it('works with a simple example', async ({ expect }) => { diff --git a/src/compiler/pre-transform/codemods/component-meta-to-define-meta.ts b/src/compiler/pre-transform/codemods/component-meta-to-define-meta.ts index dfd4f68..0bf95d8 100644 --- a/src/compiler/pre-transform/codemods/component-meta-to-define-meta.ts +++ b/src/compiler/pre-transform/codemods/component-meta-to-define-meta.ts @@ -3,7 +3,7 @@ import { createASTExpressionTag, type ESTreeAST, type SvelteAST, -} from '#parser/ast'; +} from '$lib/parser/ast.js'; interface Params { component: SvelteAST.Component; diff --git a/src/compiler/pre-transform/codemods/export-const-to-define-meta.test.ts b/src/compiler/pre-transform/codemods/export-const-to-define-meta.test.ts index 8b30877..f1dafe8 100644 --- a/src/compiler/pre-transform/codemods/export-const-to-define-meta.test.ts +++ b/src/compiler/pre-transform/codemods/export-const-to-define-meta.test.ts @@ -2,10 +2,10 @@ import pkg from '@storybook/addon-svelte-csf/package.json' with { type: 'json' } import { print } from 'svelte-ast-print'; import { describe, it } from 'vitest'; -import { transformExportMetaToDefineMeta } from './export-const-to-define-meta'; +import { transformExportMetaToDefineMeta } from './export-const-to-define-meta.js'; -import type { ESTreeAST } from '#parser/ast'; -import { parseAndExtractSvelteNode } from '#tests/extractor'; +import type { ESTreeAST } from '$lib/parser/ast.js'; +import { parseAndExtractSvelteNode } from '../../../../tests/extractor.js'; describe(transformExportMetaToDefineMeta.name, () => { it('works with advanced example', async ({ expect }) => { diff --git a/src/compiler/pre-transform/codemods/export-const-to-define-meta.ts b/src/compiler/pre-transform/codemods/export-const-to-define-meta.ts index e3c66cc..09f37ee 100644 --- a/src/compiler/pre-transform/codemods/export-const-to-define-meta.ts +++ b/src/compiler/pre-transform/codemods/export-const-to-define-meta.ts @@ -1,4 +1,4 @@ -import type { ESTreeAST } from '#parser/ast'; +import type { ESTreeAST } from '$lib/parser/ast.js'; /** * Codemod to transform AST node of `export const meta` export named declaration to `defineMeta` variable declaration. diff --git a/src/compiler/pre-transform/codemods/import-declaration.test.ts b/src/compiler/pre-transform/codemods/import-declaration.test.ts index 3a2fa81..fe73610 100644 --- a/src/compiler/pre-transform/codemods/import-declaration.test.ts +++ b/src/compiler/pre-transform/codemods/import-declaration.test.ts @@ -1,10 +1,10 @@ import { print } from 'svelte-ast-print'; import { describe, it } from 'vitest'; -import { transformImportDeclaration } from './import-declaration'; +import { transformImportDeclaration } from './import-declaration.js'; -import type { ESTreeAST } from '#parser/ast'; -import { parseAndExtractSvelteNode } from '#tests/extractor'; +import type { ESTreeAST } from '$lib/parser/ast.js'; +import { parseAndExtractSvelteNode } from '../../../../tests/extractor.js'; describe(transformImportDeclaration.name, () => { it("removes legacy components and add 'defineMeta'", async ({ expect }) => { diff --git a/src/compiler/pre-transform/codemods/import-declaration.ts b/src/compiler/pre-transform/codemods/import-declaration.ts index d1c8597..eff79b8 100644 --- a/src/compiler/pre-transform/codemods/import-declaration.ts +++ b/src/compiler/pre-transform/codemods/import-declaration.ts @@ -1,5 +1,5 @@ -import type { ESTreeAST } from '#parser/ast'; -import { DefaultOrNamespaceImportUsedError } from '#utils/error/parser/extract/svelte'; +import type { ESTreeAST } from '$lib/parser/ast.js'; +import { DefaultOrNamespaceImportUsedError } from '$lib/utils/error/parser/extract/svelte.js'; interface Params { node: ESTreeAST.ImportDeclaration; diff --git a/src/compiler/pre-transform/codemods/legacy-story.test.ts b/src/compiler/pre-transform/codemods/legacy-story.test.ts index cb140d8..07b98c1 100644 --- a/src/compiler/pre-transform/codemods/legacy-story.test.ts +++ b/src/compiler/pre-transform/codemods/legacy-story.test.ts @@ -1,10 +1,10 @@ import { print } from 'svelte-ast-print'; import { describe, it } from 'vitest'; -import { transformLegacyStory } from './legacy-story'; +import { transformLegacyStory } from './legacy-story.js'; -import type { SvelteAST } from '#parser/ast'; -import { parseAndExtractSvelteNode } from '#tests/extractor'; +import type { SvelteAST } from '$lib/parser/ast.js'; +import { parseAndExtractSvelteNode } from '../../../../tests/extractor.js'; describe(transformLegacyStory.name, () => { it("it moves 'autodocs' prop to 'tags' correctly", async ({ expect }) => { diff --git a/src/compiler/pre-transform/codemods/legacy-story.ts b/src/compiler/pre-transform/codemods/legacy-story.ts index 13c2d31..7280267 100644 --- a/src/compiler/pre-transform/codemods/legacy-story.ts +++ b/src/compiler/pre-transform/codemods/legacy-story.ts @@ -8,8 +8,8 @@ import { createASTProperty, type ESTreeAST, type SvelteAST, -} from '#parser/ast'; -import { InvalidTemplateAttribute } from '#utils/error/legacy-api/index'; +} from '$lib/parser/ast.js'; +import { InvalidTemplateAttribute } from '$lib/utils/error/legacy-api/index.js'; import type { State } from '..'; diff --git a/src/compiler/pre-transform/codemods/template-to-snippet.test.ts b/src/compiler/pre-transform/codemods/template-to-snippet.test.ts index b100c02..4955122 100644 --- a/src/compiler/pre-transform/codemods/template-to-snippet.test.ts +++ b/src/compiler/pre-transform/codemods/template-to-snippet.test.ts @@ -2,10 +2,10 @@ import pkg from '@storybook/addon-svelte-csf/package.json' with { type: 'json' } import { print } from 'svelte-ast-print'; import { describe, it } from 'vitest'; -import { transformTemplateToSnippet } from './template-to-snippet'; +import { transformTemplateToSnippet } from './template-to-snippet.js'; -import type { SvelteAST } from '#parser/ast'; -import { parseAndExtractSvelteNode } from '#tests/extractor'; +import type { SvelteAST } from '$lib/parser/ast.js'; +import { parseAndExtractSvelteNode } from '../../../../tests/extractor.js'; describe(transformTemplateToSnippet.name, () => { it("covers a case without provided prop 'id'", async ({ expect }) => { diff --git a/src/compiler/pre-transform/codemods/template-to-snippet.ts b/src/compiler/pre-transform/codemods/template-to-snippet.ts index 93a5e6d..78f071c 100644 --- a/src/compiler/pre-transform/codemods/template-to-snippet.ts +++ b/src/compiler/pre-transform/codemods/template-to-snippet.ts @@ -1,5 +1,5 @@ -import { getStringValueFromAttribute } from '#parser/analyse/story/attributes'; -import type { SvelteAST } from '#parser/ast'; +import { getStringValueFromAttribute } from '$lib/parser/analyse/story/attributes.js'; +import type { SvelteAST } from '$lib/parser/ast.js'; interface Params { component: SvelteAST.Component; diff --git a/src/compiler/pre-transform/index.test.ts b/src/compiler/pre-transform/index.test.ts index 592ff11..cde0780 100644 --- a/src/compiler/pre-transform/index.test.ts +++ b/src/compiler/pre-transform/index.test.ts @@ -3,9 +3,9 @@ import dedent from 'dedent'; import { print } from 'svelte-ast-print'; import { describe, it } from 'vitest'; -import { codemodLegacyNodes } from './index'; +import { codemodLegacyNodes } from './index.js'; -import { getSvelteAST } from '#parser/ast'; +import { getSvelteAST } from '$lib/parser/ast.js'; describe(codemodLegacyNodes.name, () => { it("replaces 'export const meta' with 'defineMeta'", async ({ expect }) => { diff --git a/src/compiler/pre-transform/index.ts b/src/compiler/pre-transform/index.ts index 72216a4..b11a6ac 100644 --- a/src/compiler/pre-transform/index.ts +++ b/src/compiler/pre-transform/index.ts @@ -1,12 +1,12 @@ import pkg from '@storybook/addon-svelte-csf/package.json' with { type: 'json' }; -import { transformComponentMetaToDefineMeta } from '#compiler/pre-transform/codemods/component-meta-to-define-meta'; -import { transformExportMetaToDefineMeta } from '#compiler/pre-transform/codemods/export-const-to-define-meta'; -import { transformImportDeclaration } from '#compiler/pre-transform/codemods/import-declaration'; -import { transformLegacyStory } from '#compiler/pre-transform/codemods/legacy-story'; -import { transformTemplateToSnippet } from '#compiler/pre-transform/codemods/template-to-snippet'; -import { createASTScript, type ESTreeAST, type SvelteAST } from '#parser/ast'; -import { DuplicatedUnidentifiedTemplateError } from '#utils/error/legacy-api/index'; +import { transformComponentMetaToDefineMeta } from '$lib/compiler/pre-transform/codemods/component-meta-to-define-meta.js'; +import { transformExportMetaToDefineMeta } from '$lib/compiler/pre-transform/codemods/export-const-to-define-meta.js'; +import { transformImportDeclaration } from '$lib/compiler/pre-transform/codemods/import-declaration.js'; +import { transformLegacyStory } from '$lib/compiler/pre-transform/codemods/legacy-story.js'; +import { transformTemplateToSnippet } from '$lib/compiler/pre-transform/codemods/template-to-snippet.js'; +import { createASTScript, type ESTreeAST, type SvelteAST } from '$lib/parser/ast.js'; +import { DuplicatedUnidentifiedTemplateError } from '$lib/utils/error/legacy-api/index.js'; interface Params { ast: SvelteAST.Root; diff --git a/src/index.test.ts b/src/index.test.ts index d4be01e..4f91a9a 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -5,13 +5,13 @@ import { describe, expectTypeOf, it } from 'vitest'; import StoryComponent from './runtime/Story.svelte'; -import { defineMeta, type Args, type StoryContext } from './index'; +import { defineMeta, type Args, type StoryContext } from './index.js'; import type { Meta, StoryAnnotations, StoryContext as BaseStoryContext, SvelteRenderer, -} from '#types'; +} from '$lib/types.js'; import Button from '../examples/components/Button.svelte'; diff --git a/src/index.ts b/src/index.ts index 668fa64..625e054 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,7 @@ import type { StoryContext as BaseStoryContext, StoryAnnotations, Cmp, -} from './types'; +} from './types.js'; export function defineMeta(meta: MetaType) { return { diff --git a/src/indexer/index.ts b/src/indexer/index.ts index 9913260..7e2dcca 100644 --- a/src/indexer/index.ts +++ b/src/indexer/index.ts @@ -1,15 +1,15 @@ import type { IndexInput, Indexer } from '@storybook/types'; -import { parseForIndexer } from '#indexer/parser'; +import { parseForIndexer } from '$lib/indexer/parser.js'; import { GetDefineMetaFirstArgumentError, IndexerParseError, MissingModuleTagError, NoStoryComponentDestructuredError, -} from '#utils/error/parser/extract/svelte'; -import { LegacyTemplateNotEnabledError } from '#utils/error/legacy-api/index'; -import { NoDestructuredDefineMetaCallError } from '#utils/error/parser/analyse/define-meta'; -import { isStorybookSvelteCSFError } from '#utils/error'; +} from '$lib/utils/error/parser/extract/svelte.js'; +import { LegacyTemplateNotEnabledError } from '$lib/utils/error/legacy-api/index.js'; +import { NoDestructuredDefineMetaCallError } from '$lib/utils/error/parser/analyse/define-meta.js'; +import { isStorybookSvelteCSFError } from '$lib/utils/error.js'; export const createIndexer = (legacyTemplate: boolean): Indexer => ({ test: /\.svelte$/, diff --git a/src/indexer/parser.ts b/src/indexer/parser.ts index c6f1ae7..e1f5192 100644 --- a/src/indexer/parser.ts +++ b/src/indexer/parser.ts @@ -4,25 +4,25 @@ import pkg from '@storybook/addon-svelte-csf/package.json' with { type: 'json' } import { preprocess } from 'svelte/compiler'; import type { IndexInput } from '@storybook/types'; -import { getSvelteAST, type ESTreeAST, type SvelteAST } from '#parser/ast'; -import { extractStoryAttributesNodes } from '#parser/extract/svelte/story/attributes'; -import { getStoryIdentifiers } from '#parser/analyse/story/attributes/identifiers'; +import { getSvelteAST, type ESTreeAST, type SvelteAST } from '$lib/parser/ast.js'; +import { extractStoryAttributesNodes } from '$lib/parser/extract/svelte/story/attributes.js'; +import { getStoryIdentifiers } from '$lib/parser/analyse/story/attributes/identifiers.js'; import { getArrayOfStringsValueFromAttribute, getStringValueFromAttribute, -} from '#parser/analyse/story/attributes'; +} from '$lib/parser/analyse/story/attributes.js'; import { getPropertyArrayOfStringsValue, getPropertyStringValue, -} from '#parser/analyse/define-meta/properties'; -import type { StorybookAddonSvelteCsFOptions } from '#preset'; +} from '$lib/parser/analyse/define-meta/properties.js'; +import type { StorybookAddonSvelteCsFOptions } from '$lib/preset.js'; import { DefaultOrNamespaceImportUsedError, GetDefineMetaFirstArgumentError, MissingModuleTagError, NoStoryComponentDestructuredError, -} from '#utils/error/parser/extract/svelte'; -import { NoDestructuredDefineMetaCallError } from '#utils/error/parser/analyse/define-meta'; +} from '$lib/utils/error/parser/extract/svelte.js'; +import { NoDestructuredDefineMetaCallError } from '$lib/utils/error/parser/analyse/define-meta.js'; interface Results { meta: Pick; diff --git a/src/parser/analyse/define-meta/component-identifier.ts b/src/parser/analyse/define-meta/component-identifier.ts index bd54493..ae9fcf2 100644 --- a/src/parser/analyse/define-meta/component-identifier.ts +++ b/src/parser/analyse/define-meta/component-identifier.ts @@ -1,7 +1,7 @@ -import type { ESTreeAST } from '#parser/ast'; -import { extractDefineMetaPropertiesNodes } from '#parser/extract/svelte/define-meta'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { InvalidComponentValueError } from '#utils/error/parser/analyse/define-meta'; +import type { ESTreeAST } from '$lib/parser/ast.js'; +import { extractDefineMetaPropertiesNodes } from '$lib/parser/extract/svelte/define-meta.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { InvalidComponentValueError } from '$lib/utils/error/parser/analyse/define-meta.js'; interface Params { nodes: SvelteASTNodes; diff --git a/src/parser/analyse/define-meta/meta-identifier.ts b/src/parser/analyse/define-meta/meta-identifier.ts index 7a97c39..9ab278b 100644 --- a/src/parser/analyse/define-meta/meta-identifier.ts +++ b/src/parser/analyse/define-meta/meta-identifier.ts @@ -1,9 +1,9 @@ -import type { ESTreeAST } from '#parser/ast'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; +import type { ESTreeAST } from '$lib/parser/ast.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; import { NoDestructuredDefineMetaCallError, NoMetaIdentifierFoundError, -} from '#utils/error/parser/analyse/define-meta'; +} from '$lib/utils/error/parser/analyse/define-meta.js'; interface Params { node: SvelteASTNodes['defineMetaVariableDeclaration']; diff --git a/src/parser/analyse/define-meta/properties.ts b/src/parser/analyse/define-meta/properties.ts index 9c780fc..c73cf7c 100644 --- a/src/parser/analyse/define-meta/properties.ts +++ b/src/parser/analyse/define-meta/properties.ts @@ -1,9 +1,9 @@ -import type { ESTreeAST } from '#parser/ast'; +import type { ESTreeAST } from '$lib/parser/ast.js'; import { ArrayElementNotStringError, NoArrayExpressionError, NoStringLiteralError, -} from '#utils/error/parser/analyse/define-meta'; +} from '$lib/utils/error/parser/analyse/define-meta.js'; interface GetStringOptions { node: ESTreeAST.Property; diff --git a/src/parser/analyse/story/attributes.test.ts b/src/parser/analyse/story/attributes.test.ts index ac9a532..2b1c405 100644 --- a/src/parser/analyse/story/attributes.test.ts +++ b/src/parser/analyse/story/attributes.test.ts @@ -1,11 +1,11 @@ import { describe, it } from 'vitest'; -import { getArrayOfStringsValueFromAttribute, getStringValueFromAttribute } from './attributes'; +import { getArrayOfStringsValueFromAttribute, getStringValueFromAttribute } from './attributes.js'; -import { getSvelteAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { extractStoryAttributesNodes } from '#parser/extract/svelte/story/attributes'; -import { StorybookSvelteCSFError } from '#utils/error'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { extractStoryAttributesNodes } from '$lib/parser/extract/svelte/story/attributes.js'; +import { StorybookSvelteCSFError } from '$lib/utils/error.js'; describe(getStringValueFromAttribute.name, () => { it("throws error when a `` 'name' attribute value is not a string", async ({ diff --git a/src/parser/analyse/story/attributes.ts b/src/parser/analyse/story/attributes.ts index 40c9084..a054e64 100644 --- a/src/parser/analyse/story/attributes.ts +++ b/src/parser/analyse/story/attributes.ts @@ -1,9 +1,9 @@ -import type { SvelteAST } from '#parser/ast'; +import type { SvelteAST } from '$lib/parser/ast.js'; import { AttributeNotArrayError, AttributeNotArrayOfStringsError, AttributeNotStringError, -} from '#utils/error/parser/analyse/story'; +} from '$lib/utils/error/parser/analyse/story.js'; interface Params { node: SvelteAST.Attribute | undefined; diff --git a/src/parser/analyse/story/attributes/identifiers.test.ts b/src/parser/analyse/story/attributes/identifiers.test.ts index 88b0e0a..4fc59d0 100644 --- a/src/parser/analyse/story/attributes/identifiers.test.ts +++ b/src/parser/analyse/story/attributes/identifiers.test.ts @@ -1,11 +1,11 @@ import { describe, expect, it } from 'vitest'; -import { getStoryIdentifiers, getStoriesIdentifiers } from './identifiers'; +import { getStoryIdentifiers, getStoriesIdentifiers } from './identifiers.js'; -import { getSvelteAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { extractStoryAttributesNodes } from '#parser/extract/svelte/story/attributes'; -import { StorybookSvelteCSFError } from '#utils/error'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { extractStoryAttributesNodes } from '$lib/parser/extract/svelte/story/attributes.js'; +import { StorybookSvelteCSFError } from '$lib/utils/error.js'; describe(getStoryIdentifiers.name, () => { it("extracts 'exportName' attribute when is a Text string", async () => { diff --git a/src/parser/analyse/story/attributes/identifiers.ts b/src/parser/analyse/story/attributes/identifiers.ts index ed07335..18231a6 100644 --- a/src/parser/analyse/story/attributes/identifiers.ts +++ b/src/parser/analyse/story/attributes/identifiers.ts @@ -1,13 +1,13 @@ -import { getStringValueFromAttribute } from '#parser/analyse/story/attributes'; -import type { SvelteAST } from '#parser/ast'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { extractStoryAttributesNodes } from '#parser/extract/svelte/story/attributes'; -import { isValidVariableName, storyNameToExportName } from '#utils/identifier-utils'; +import { getStringValueFromAttribute } from '$lib/parser/analyse/story/attributes.js'; +import type { SvelteAST } from '$lib/parser/ast.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { extractStoryAttributesNodes } from '$lib/parser/extract/svelte/story/attributes.js'; +import { isValidVariableName, storyNameToExportName } from '$lib/utils/identifier-utils.js'; import { DuplicateStoryIdentifiersError, InvalidStoryExportNameError, NoStoryIdentifierError, -} from '#utils/error/parser/analyse/story'; +} from '$lib/utils/error/parser/analyse/story.js'; type StoryIdentifiers = { exportName: string; diff --git a/src/parser/analyse/story/children.test.ts b/src/parser/analyse/story/children.test.ts index 16b5f6d..9b43fca 100644 --- a/src/parser/analyse/story/children.test.ts +++ b/src/parser/analyse/story/children.test.ts @@ -1,9 +1,9 @@ import { describe, it } from 'vitest'; -import { getStoryChildrenRawCode } from './children'; +import { getStoryChildrenRawCode } from './children.js'; -import { getSvelteAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; describe(getStoryChildrenRawCode.name, () => { describe('When a `` is a self-closing tag...', () => { diff --git a/src/parser/analyse/story/children.ts b/src/parser/analyse/story/children.ts index 1abdbd7..2a7bda3 100644 --- a/src/parser/analyse/story/children.ts +++ b/src/parser/analyse/story/children.ts @@ -1,13 +1,13 @@ import dedent from 'dedent'; -import { getDefineMetaComponentValue } from '#parser/analyse/define-meta/component-identifier'; -import type { SvelteAST } from '#parser/ast'; -import type { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { extractStoryChildrenSnippetBlock } from '#parser/extract/svelte/story/children'; +import { getDefineMetaComponentValue } from '$lib/parser/analyse/define-meta/component-identifier.js'; +import type { SvelteAST } from '$lib/parser/ast.js'; +import type { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { extractStoryChildrenSnippetBlock } from '$lib/parser/extract/svelte/story/children.js'; import { findSetTemplateSnippetBlock, findStoryAttributeChildrenSnippetBlock, -} from '#parser/extract/svelte/snippet-block'; +} from '$lib/parser/extract/svelte/snippet-block.js'; interface Params { nodes: { diff --git a/src/parser/extract/compiled/nodes.ts b/src/parser/extract/compiled/nodes.ts index 053bedb..a55e77e 100644 --- a/src/parser/extract/compiled/nodes.ts +++ b/src/parser/extract/compiled/nodes.ts @@ -2,15 +2,15 @@ import pkg from '@storybook/addon-svelte-csf/package.json' with { type: 'json' } import type { ProgramNode } from 'rollup'; import type { Visitors } from 'zimmerframe'; -import type { ESTreeAST } from '#parser/ast'; +import type { ESTreeAST } from '$lib/parser/ast.js'; import { MissingDefineMetaVariableDeclarationError, MissingImportedDefineMetaError, NoExportDefaultError, NoStoriesFunctionDeclarationError, NoStoryIdentifierFoundError, -} from '#utils/error/parser/extract/compiled'; -import { DefaultOrNamespaceImportUsedError } from '#utils/error/parser/extract/svelte'; +} from '$lib/utils/error/parser/extract/compiled.js'; +import { DefaultOrNamespaceImportUsedError } from '$lib/utils/error/parser/extract/svelte.js'; /** * Important AST nodes from the compiled output of a single `*.stories.svelte` file. diff --git a/src/parser/extract/compiled/stories.ts b/src/parser/extract/compiled/stories.ts index 36d68e0..2867472 100644 --- a/src/parser/extract/compiled/stories.ts +++ b/src/parser/extract/compiled/stories.ts @@ -1,8 +1,8 @@ import type { Visitors } from 'zimmerframe'; -import type { CompiledASTNodes } from './nodes'; +import type { CompiledASTNodes } from './nodes.js'; -import type { ESTreeAST } from '#parser/ast'; +import type { ESTreeAST } from '$lib/parser/ast.js'; interface Params { nodes: CompiledASTNodes; diff --git a/src/parser/extract/compiled/story.ts b/src/parser/extract/compiled/story.ts index 67ea564..861b113 100644 --- a/src/parser/extract/compiled/story.ts +++ b/src/parser/extract/compiled/story.ts @@ -1,6 +1,6 @@ -import type { ESTreeAST } from '#parser/ast'; -import type { extractStoriesNodesFromExportDefaultFn } from '#parser/extract/compiled/stories'; -import { NoCompiledStoryPropsObjectExpression } from '#utils/error/parser/extract/compiled'; +import type { ESTreeAST } from '$lib/parser/ast.js'; +import type { extractStoriesNodesFromExportDefaultFn } from '$lib/parser/extract/compiled/stories.js'; +import { NoCompiledStoryPropsObjectExpression } from '$lib/utils/error/parser/extract/compiled.js'; interface Params { node: Awaited>[number]; diff --git a/src/parser/extract/svelte/define-meta.test.ts b/src/parser/extract/svelte/define-meta.test.ts index 5c53d04..c538154 100644 --- a/src/parser/extract/svelte/define-meta.test.ts +++ b/src/parser/extract/svelte/define-meta.test.ts @@ -1,9 +1,9 @@ import { describe, it } from 'vitest'; -import { extractDefineMetaPropertiesNodes } from './define-meta'; +import { extractDefineMetaPropertiesNodes } from './define-meta.js'; -import { getSvelteAST, type ESTreeAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; +import { getSvelteAST, type ESTreeAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; describe(extractDefineMetaPropertiesNodes.name, () => { it('extracts correctly selected properties', async ({ expect }) => { diff --git a/src/parser/extract/svelte/define-meta.ts b/src/parser/extract/svelte/define-meta.ts index 960c92b..936d0a2 100644 --- a/src/parser/extract/svelte/define-meta.ts +++ b/src/parser/extract/svelte/define-meta.ts @@ -1,9 +1,9 @@ -import type { ESTreeAST } from '#parser/ast'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; -import type { CompiledASTNodes } from '#parser/extract/compiled/nodes'; +import type { ESTreeAST } from '$lib/parser/ast.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import type { CompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; -import { GetDefineMetaFirstArgumentError } from '#utils/error/parser/extract/svelte'; -import type { Cmp, Meta } from '#types'; +import { GetDefineMetaFirstArgumentError } from '$lib/utils/error/parser/extract/svelte.js'; +import type { Cmp, Meta } from '$lib/types.js'; interface Options>> { nodes: SvelteASTNodes | CompiledASTNodes; diff --git a/src/parser/extract/svelte/fragment-nodes.test.ts b/src/parser/extract/svelte/fragment-nodes.test.ts index edddb66..f5b6dc4 100644 --- a/src/parser/extract/svelte/fragment-nodes.test.ts +++ b/src/parser/extract/svelte/fragment-nodes.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; -import { extractFragmentNodes } from './fragment-nodes'; -import { extractInstanceNodes } from './instance-nodes'; -import { extractModuleNodes } from './module-nodes'; +import { extractFragmentNodes } from './fragment-nodes.js'; +import { extractInstanceNodes } from './instance-nodes.js'; +import { extractModuleNodes } from './module-nodes.js'; -import { getSvelteAST } from '#parser/ast'; +import { getSvelteAST } from '$lib/parser/ast.js'; describe(extractFragmentNodes.name, () => { it("extracts '' AST nodes correctly", async () => { diff --git a/src/parser/extract/svelte/fragment-nodes.ts b/src/parser/extract/svelte/fragment-nodes.ts index 7803cf9..4c3d0dd 100644 --- a/src/parser/extract/svelte/fragment-nodes.ts +++ b/src/parser/extract/svelte/fragment-nodes.ts @@ -1,9 +1,9 @@ import type { Visitors } from 'zimmerframe'; -import type { extractModuleNodes } from './module-nodes'; -import type { extractInstanceNodes } from './instance-nodes'; +import type { extractModuleNodes } from './module-nodes.js'; +import type { extractInstanceNodes } from './instance-nodes.js'; -import type { SvelteAST } from '#parser/ast'; +import type { SvelteAST } from '$lib/parser/ast.js'; interface Result { storyComponents: Array<{ diff --git a/src/parser/extract/svelte/instance-nodes.test.ts b/src/parser/extract/svelte/instance-nodes.test.ts index 553bf29..b331d8b 100644 --- a/src/parser/extract/svelte/instance-nodes.test.ts +++ b/src/parser/extract/svelte/instance-nodes.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; -import { extractInstanceNodes } from './instance-nodes'; -import { extractModuleNodes } from './module-nodes'; +import { extractInstanceNodes } from './instance-nodes.js'; +import { extractModuleNodes } from './module-nodes.js'; -import { getSvelteAST, type ESTreeAST } from '#parser/ast'; +import { getSvelteAST, type ESTreeAST } from '$lib/parser/ast.js'; describe(extractInstanceNodes.name, () => { it("extract 'setTemplateCall' correctly when used", async () => { diff --git a/src/parser/extract/svelte/instance-nodes.ts b/src/parser/extract/svelte/instance-nodes.ts index 1bddf53..d105ed5 100644 --- a/src/parser/extract/svelte/instance-nodes.ts +++ b/src/parser/extract/svelte/instance-nodes.ts @@ -1,8 +1,8 @@ import type { Visitors } from 'zimmerframe'; -import type { extractModuleNodes } from './module-nodes'; +import type { extractModuleNodes } from './module-nodes.js'; -import type { ESTreeAST, SvelteAST } from '#parser/ast'; +import type { ESTreeAST, SvelteAST } from '$lib/parser/ast.js'; interface Result { setTemplateCall: ESTreeAST.CallExpression | undefined; diff --git a/src/parser/extract/svelte/legacy-export-meta.ts b/src/parser/extract/svelte/legacy-export-meta.ts index 59b98ab..abeba8a 100644 --- a/src/parser/extract/svelte/legacy-export-meta.ts +++ b/src/parser/extract/svelte/legacy-export-meta.ts @@ -1,10 +1,10 @@ import type { ObjectExpression, Property } from 'estree'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; -import type { CompiledASTNodes } from '#parser/extract/compiled/nodes'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import type { CompiledASTNodes } from '$lib/parser/extract/compiled/nodes.js'; -import { GetDefineMetaFirstArgumentError } from '#utils/error/parser/extract/svelte'; -import type { Cmp, Meta } from '#types'; +import { GetDefineMetaFirstArgumentError } from '$lib/utils/error/parser/extract/svelte.js'; +import type { Cmp, Meta } from '$lib/types.js'; interface Options>> { nodes: SvelteASTNodes | CompiledASTNodes; diff --git a/src/parser/extract/svelte/module-nodes.test.ts b/src/parser/extract/svelte/module-nodes.test.ts index 5da0881..1c15cd0 100644 --- a/src/parser/extract/svelte/module-nodes.test.ts +++ b/src/parser/extract/svelte/module-nodes.test.ts @@ -1,9 +1,9 @@ import { describe, it } from 'vitest'; -import { extractModuleNodes } from './module-nodes'; +import { extractModuleNodes } from './module-nodes.js'; -import { getSvelteAST } from '#parser/ast'; -import { StorybookSvelteCSFError } from '#utils/error'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { StorybookSvelteCSFError } from '$lib/utils/error.js'; describe(extractModuleNodes.name, () => { it('fails when module tag not found', ({ expect }) => { diff --git a/src/parser/extract/svelte/module-nodes.ts b/src/parser/extract/svelte/module-nodes.ts index eb5c57d..1e6c1f5 100644 --- a/src/parser/extract/svelte/module-nodes.ts +++ b/src/parser/extract/svelte/module-nodes.ts @@ -1,14 +1,14 @@ import pkg from '@storybook/addon-svelte-csf/package.json' with { type: 'json' }; import type { Visitors } from 'zimmerframe'; -import type { ESTreeAST, SvelteAST } from '#parser/ast'; +import type { ESTreeAST, SvelteAST } from '$lib/parser/ast.js'; import { DefaultOrNamespaceImportUsedError, MissingDefineMetaImportError, MissingDefineMetaVariableDeclarationError, MissingModuleTagError, NoStoryComponentDestructuredError, -} from '#utils/error/parser/extract/svelte'; +} from '$lib/utils/error/parser/extract/svelte.js'; const AST_NODES_NAMES = { defineMeta: 'defineMeta', diff --git a/src/parser/extract/svelte/nodes.test.ts b/src/parser/extract/svelte/nodes.test.ts index 2aef1a4..a967846 100644 --- a/src/parser/extract/svelte/nodes.test.ts +++ b/src/parser/extract/svelte/nodes.test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'vitest'; -import { extractSvelteASTNodes } from './nodes'; +import { extractSvelteASTNodes } from './nodes.js'; -import { getSvelteAST } from '#parser/ast'; +import { getSvelteAST } from '$lib/parser/ast.js'; describe(extractSvelteASTNodes.name, () => { it('works with a simple example', ({ expect }) => { diff --git a/src/parser/extract/svelte/nodes.ts b/src/parser/extract/svelte/nodes.ts index f8e0fa4..9044153 100644 --- a/src/parser/extract/svelte/nodes.ts +++ b/src/parser/extract/svelte/nodes.ts @@ -1,8 +1,8 @@ -import { extractModuleNodes } from './module-nodes'; -import { extractFragmentNodes } from './fragment-nodes'; -import { extractInstanceNodes } from './instance-nodes'; +import { extractModuleNodes } from './module-nodes.js'; +import { extractFragmentNodes } from './fragment-nodes.js'; +import { extractInstanceNodes } from './instance-nodes.js'; -import type { SvelteAST } from '#parser/ast'; +import type { SvelteAST } from '$lib/parser/ast.js'; /** * Selected nodes extracted from the Svelte AST via `svelte.compile`, diff --git a/src/parser/extract/svelte/snippet-block.ts b/src/parser/extract/svelte/snippet-block.ts index 778bd80..092838d 100644 --- a/src/parser/extract/svelte/snippet-block.ts +++ b/src/parser/extract/svelte/snippet-block.ts @@ -1,11 +1,11 @@ -import type { SvelteAST } from '#parser/ast'; -import type { SvelteASTNodes } from '#parser/extract/svelte/nodes'; -import { extractStoryAttributesNodes } from '#parser/extract/svelte/story/attributes'; +import type { SvelteAST } from '$lib/parser/ast.js'; +import type { SvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; +import { extractStoryAttributesNodes } from '$lib/parser/extract/svelte/story/attributes.js'; import { InvalidSetTemplateFirstArgumentError, InvalidStoryChildrenAttributeError, -} from '#utils/error/parser/extract/svelte'; +} from '$lib/utils/error/parser/extract/svelte.js'; /** * Svelte 5 allows to passing `children` as attribute _(aka prop)_. diff --git a/src/parser/extract/svelte/story/attributes.test.ts b/src/parser/extract/svelte/story/attributes.test.ts index 91fc862..65e458b 100644 --- a/src/parser/extract/svelte/story/attributes.test.ts +++ b/src/parser/extract/svelte/story/attributes.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; -import { extractStoryAttributesNodes } from './attributes'; +import { extractStoryAttributesNodes } from './attributes.js'; -import { getSvelteAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; describe(extractStoryAttributesNodes.name, () => { it("extracts '' attributes correctly", async () => { diff --git a/src/parser/extract/svelte/story/attributes.ts b/src/parser/extract/svelte/story/attributes.ts index dcfdda5..4f7a74e 100644 --- a/src/parser/extract/svelte/story/attributes.ts +++ b/src/parser/extract/svelte/story/attributes.ts @@ -1,8 +1,8 @@ import type { ComponentProps } from 'svelte'; -import type { SvelteAST } from '#parser/ast'; -import type { Cmp } from '#types'; -import type Story from '#runtime/Story.svelte'; +import type { SvelteAST } from '$lib/parser/ast.js'; +import type { Cmp } from '$lib/types.js'; +import type Story from '$lib/runtime/Story.svelte'; type StoryAttributes = Array>>; diff --git a/src/parser/extract/svelte/story/children.test.ts b/src/parser/extract/svelte/story/children.test.ts index 4aa4bb8..8c4986b 100644 --- a/src/parser/extract/svelte/story/children.test.ts +++ b/src/parser/extract/svelte/story/children.test.ts @@ -1,9 +1,9 @@ import { describe, it } from 'vitest'; -import { extractStoryChildrenSnippetBlock } from './children'; +import { extractStoryChildrenSnippetBlock } from './children.js'; -import { getSvelteAST } from '#parser/ast'; -import { extractSvelteASTNodes } from '#parser/extract/svelte/nodes'; +import { getSvelteAST } from '$lib/parser/ast.js'; +import { extractSvelteASTNodes } from '$lib/parser/extract/svelte/nodes.js'; describe(extractStoryChildrenSnippetBlock.name, () => { it('returns correctly AST node, when a `` compponent has a snippet block `children` inside', async ({ diff --git a/src/parser/extract/svelte/story/children.ts b/src/parser/extract/svelte/story/children.ts index 2764876..15addb0 100644 --- a/src/parser/extract/svelte/story/children.ts +++ b/src/parser/extract/svelte/story/children.ts @@ -1,4 +1,4 @@ -import type { SvelteAST } from '#parser/ast'; +import type { SvelteAST } from '$lib/parser/ast.js'; type Result = SvelteAST.SnippetBlock | undefined; diff --git a/src/preset.ts b/src/preset.ts index 6260e9b..9f46c2a 100644 --- a/src/preset.ts +++ b/src/preset.ts @@ -1,8 +1,8 @@ import type { StorybookConfig } from '@storybook/svelte-vite'; import type { Options } from '@storybook/types'; -import { transformPlugin, preTransformPlugin } from '#compiler/plugins'; -import { createIndexer } from '#indexer/index'; +import { transformPlugin, preTransformPlugin } from '$lib/compiler/plugins.js'; +import { createIndexer } from '$lib/indexer/index.js'; export interface StorybookAddonSvelteCsFOptions extends Options { /** diff --git a/src/runtime/StoriesExtractor.svelte b/src/runtime/StoriesExtractor.svelte index a4189d2..714fd5f 100644 --- a/src/runtime/StoriesExtractor.svelte +++ b/src/runtime/StoriesExtractor.svelte @@ -1,12 +1,12 @@