From 5161dfb9500e5552410b56e0fd51a47c43ce8d79 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Mon, 27 May 2019 21:36:02 +0200 Subject: [PATCH] update folder structure - #2790 --- .gitignore | 14 +-- animate.d.ts | 1 - easing.d.ts | 1 - index.d.ts | 1 - index.js | 16 ++++ index.mjs | 1 + internal.d.ts | 1 - motion.d.ts | 1 - package.json | 18 ++-- rollup.config.js | 94 +++++++------------ scripts/create-stubs.js | 12 +++ src/{ => compiler}/Stats.ts | 0 src/{ => compiler}/compile/Component.ts | 0 src/{ => compiler}/compile/create_module.ts | 0 src/{ => compiler}/compile/css/Selector.ts | 0 src/{ => compiler}/compile/css/Stylesheet.ts | 0 .../compile/css/gather_possible_values.ts | 0 src/{ => compiler}/compile/index.ts | 2 +- src/compiler/compile/internal-exports.ts | 2 + src/{ => compiler}/compile/nodes/Action.ts | 0 src/{ => compiler}/compile/nodes/Animation.ts | 0 src/{ => compiler}/compile/nodes/Attribute.ts | 0 .../compile/nodes/AwaitBlock.ts | 0 src/{ => compiler}/compile/nodes/Binding.ts | 0 src/{ => compiler}/compile/nodes/Body.ts | 0 .../compile/nodes/CatchBlock.ts | 0 src/{ => compiler}/compile/nodes/Class.ts | 0 src/{ => compiler}/compile/nodes/Comment.ts | 0 src/{ => compiler}/compile/nodes/DebugTag.ts | 0 src/{ => compiler}/compile/nodes/EachBlock.ts | 0 src/{ => compiler}/compile/nodes/Element.ts | 0 src/{ => compiler}/compile/nodes/ElseBlock.ts | 0 .../compile/nodes/EventHandler.ts | 0 src/{ => compiler}/compile/nodes/Fragment.ts | 0 src/{ => compiler}/compile/nodes/Head.ts | 0 src/{ => compiler}/compile/nodes/IfBlock.ts | 0 .../compile/nodes/InlineComponent.ts | 0 src/{ => compiler}/compile/nodes/Let.ts | 0 .../compile/nodes/MustacheTag.ts | 0 src/{ => compiler}/compile/nodes/Options.ts | 0 .../compile/nodes/PendingBlock.ts | 0 .../compile/nodes/RawMustacheTag.ts | 0 src/{ => compiler}/compile/nodes/Slot.ts | 0 src/{ => compiler}/compile/nodes/Text.ts | 0 src/{ => compiler}/compile/nodes/ThenBlock.ts | 0 src/{ => compiler}/compile/nodes/Title.ts | 0 .../compile/nodes/Transition.ts | 0 src/{ => compiler}/compile/nodes/Window.ts | 0 .../compile/nodes/interfaces.ts | 0 .../compile/nodes/shared/AbstractBlock.ts | 2 +- .../compile/nodes/shared/Expression.ts | 0 .../compile/nodes/shared/Node.ts | 4 +- .../compile/nodes/shared/Tag.ts | 0 .../compile/nodes/shared/TemplateScope.ts | 0 .../compile/nodes/shared/map_children.ts | 0 .../compile/render-dom/Block.ts | 0 .../compile/render-dom/Renderer.ts | 0 .../compile/render-dom/index.ts | 0 .../compile/render-dom/wrappers/AwaitBlock.ts | 0 .../compile/render-dom/wrappers/Body.ts | 0 .../compile/render-dom/wrappers/DebugTag.ts | 0 .../compile/render-dom/wrappers/EachBlock.ts | 0 .../render-dom/wrappers/Element/Attribute.ts | 0 .../render-dom/wrappers/Element/Binding.ts | 2 +- .../wrappers/Element/StyleAttribute.ts | 2 +- .../wrappers/Element/fix_attribute_casing.ts | 0 .../render-dom/wrappers/Element/index.ts | 0 .../compile/render-dom/wrappers/Fragment.ts | 0 .../compile/render-dom/wrappers/Head.ts | 0 .../compile/render-dom/wrappers/IfBlock.ts | 0 .../wrappers/InlineComponent/index.ts | 0 .../render-dom/wrappers/MustacheTag.ts | 0 .../render-dom/wrappers/RawMustacheTag.ts | 0 .../compile/render-dom/wrappers/Slot.ts | 0 .../compile/render-dom/wrappers/Text.ts | 0 .../compile/render-dom/wrappers/Title.ts | 0 .../compile/render-dom/wrappers/Window.ts | 0 .../compile/render-dom/wrappers/shared/Tag.ts | 0 .../render-dom/wrappers/shared/Wrapper.ts | 0 .../render-dom/wrappers/shared/add_actions.ts | 0 .../wrappers/shared/add_event_handlers.ts | 0 .../shared/create_debugging_comment.ts | 0 .../wrappers/shared/get_context_merger.ts | 0 .../compile/render-ssr/Renderer.ts | 0 .../compile/render-ssr/handlers/AwaitBlock.ts | 0 .../compile/render-ssr/handlers/Comment.ts | 0 .../compile/render-ssr/handlers/DebugTag.ts | 0 .../compile/render-ssr/handlers/EachBlock.ts | 0 .../compile/render-ssr/handlers/Element.ts | 0 .../compile/render-ssr/handlers/Head.ts | 0 .../compile/render-ssr/handlers/HtmlTag.ts | 0 .../compile/render-ssr/handlers/IfBlock.ts | 0 .../render-ssr/handlers/InlineComponent.ts | 0 .../compile/render-ssr/handlers/Slot.ts | 0 .../compile/render-ssr/handlers/Tag.ts | 0 .../compile/render-ssr/handlers/Text.ts | 0 .../compile/render-ssr/handlers/Title.ts | 0 .../handlers/shared/get_slot_scope.ts | 0 .../compile/render-ssr/index.ts | 0 .../compile/utils/CodeBuilder.ts | 0 src/{ => compiler}/compile/utils/__test__.ts | 0 .../compile/utils/add_to_set.ts | 0 src/{ => compiler}/compile/utils/deindent.ts | 0 .../compile/utils/flatten_reference.ts | 0 .../compile/utils/get_object.ts | 0 .../compile/utils/get_slot_data.ts | 0 src/{ => compiler}/compile/utils/scope.ts | 0 src/{ => compiler}/compile/utils/snip.ts | 0 src/{ => compiler}/compile/utils/stringify.ts | 0 .../compile/utils/stringify_attribute.ts | 0 .../compile/utils/stringify_props.ts | 0 src/{ => compiler}/compile/utils/tail.ts | 0 .../compile/utils/unwrap_parens.ts | 0 src/{ => compiler}/config.ts | 0 src/{compiler.ts => compiler/index.ts} | 0 src/{ => compiler}/interfaces.ts | 0 src/{ => compiler}/parse/acorn.ts | 0 src/{ => compiler}/parse/index.ts | 0 src/{ => compiler}/parse/read/context.ts | 0 src/{ => compiler}/parse/read/expression.ts | 0 src/{ => compiler}/parse/read/script.ts | 0 src/{ => compiler}/parse/read/style.ts | 0 src/{ => compiler}/parse/state/fragment.ts | 0 src/{ => compiler}/parse/state/mustache.ts | 0 src/{ => compiler}/parse/state/tag.ts | 0 src/{ => compiler}/parse/state/text.ts | 0 src/{ => compiler}/parse/utils/entities.ts | 0 src/{ => compiler}/parse/utils/html.ts | 0 src/{ => compiler}/preprocess/index.ts | 0 src/{ => compiler}/utils/error.ts | 2 +- src/{ => compiler}/utils/full_char_code_at.ts | 0 src/{ => compiler}/utils/fuzzymatch.ts | 0 src/{ => compiler}/utils/get_code_frame.ts | 0 src/{ => compiler}/utils/indentation.ts | 0 src/{ => compiler}/utils/list.ts | 0 src/{ => compiler}/utils/names.ts | 0 src/{ => compiler}/utils/namespaces.ts | 0 src/{ => compiler}/utils/nodes_match.ts | 0 src/{ => compiler}/utils/patterns.ts | 0 src/{ => compiler}/utils/repeat.ts | 0 src/{ => compiler}/utils/trim.ts | 0 src/{animate.ts => runtime/animate/index.ts} | 0 src/{easing.ts => runtime/easing/index.ts} | 0 src/{ => runtime}/index.ts | 0 src/{ => runtime}/internal/Component.ts | 0 src/{ => runtime}/internal/animations.ts | 0 src/{ => runtime}/internal/await-block.ts | 0 src/{ => runtime}/internal/dom.ts | 0 src/{ => runtime}/internal/index.ts | 0 src/{ => runtime}/internal/keyed-each.ts | 0 src/{ => runtime}/internal/lifecycle.ts | 0 src/{ => runtime}/internal/loop.ts | 0 src/{ => runtime}/internal/scheduler.ts | 0 src/{ => runtime}/internal/spread.ts | 0 src/{ => runtime}/internal/ssr.ts | 0 src/{ => runtime}/internal/style_manager.ts | 0 src/{ => runtime}/internal/transitions.ts | 0 src/{ => runtime}/internal/utils.ts | 0 src/{ => runtime}/motion/index.ts | 0 src/{ => runtime}/motion/spring.ts | 0 src/{ => runtime}/motion/tweened.ts | 0 src/{ => runtime}/motion/utils.ts | 0 src/{store.ts => runtime/store/index.ts} | 0 .../transition/index.ts} | 0 store.d.ts | 1 - test/custom-elements/index.js | 4 +- test/runtime/index.js | 6 +- .../samples/prop-subscribable/_config.js | 2 +- .../_config.js | 2 +- .../main.svelte | 2 +- .../store-assignment-updates/_config.js | 2 +- .../store-auto-subscribe-implicit/_config.js | 2 +- .../store-auto-subscribe-in-each/_config.js | 2 +- .../_config.js | 2 +- .../store-auto-subscribe-in-script/_config.js | 2 +- .../samples/store-auto-subscribe/_config.js | 2 +- .../samples/store-contextual/_config.js | 2 +- .../samples/store-imported-module-b/foo.js | 2 +- .../samples/store-imported-module/foo.js | 2 +- test/runtime/samples/store-imported/foo.js | 2 +- .../main.svelte | 2 +- .../_config.js | 2 +- transition.d.ts | 1 - tsconfig.json | 14 +-- 184 files changed, 112 insertions(+), 120 deletions(-) delete mode 100644 animate.d.ts delete mode 100644 easing.d.ts delete mode 100644 index.d.ts create mode 100644 index.js create mode 100644 index.mjs delete mode 100644 internal.d.ts delete mode 100644 motion.d.ts create mode 100644 scripts/create-stubs.js rename src/{ => compiler}/Stats.ts (100%) rename src/{ => compiler}/compile/Component.ts (100%) rename src/{ => compiler}/compile/create_module.ts (100%) rename src/{ => compiler}/compile/css/Selector.ts (100%) rename src/{ => compiler}/compile/css/Stylesheet.ts (100%) rename src/{ => compiler}/compile/css/gather_possible_values.ts (100%) rename src/{ => compiler}/compile/index.ts (97%) create mode 100644 src/compiler/compile/internal-exports.ts rename src/{ => compiler}/compile/nodes/Action.ts (100%) rename src/{ => compiler}/compile/nodes/Animation.ts (100%) rename src/{ => compiler}/compile/nodes/Attribute.ts (100%) rename src/{ => compiler}/compile/nodes/AwaitBlock.ts (100%) rename src/{ => compiler}/compile/nodes/Binding.ts (100%) rename src/{ => compiler}/compile/nodes/Body.ts (100%) rename src/{ => compiler}/compile/nodes/CatchBlock.ts (100%) rename src/{ => compiler}/compile/nodes/Class.ts (100%) rename src/{ => compiler}/compile/nodes/Comment.ts (100%) rename src/{ => compiler}/compile/nodes/DebugTag.ts (100%) rename src/{ => compiler}/compile/nodes/EachBlock.ts (100%) rename src/{ => compiler}/compile/nodes/Element.ts (100%) rename src/{ => compiler}/compile/nodes/ElseBlock.ts (100%) rename src/{ => compiler}/compile/nodes/EventHandler.ts (100%) rename src/{ => compiler}/compile/nodes/Fragment.ts (100%) rename src/{ => compiler}/compile/nodes/Head.ts (100%) rename src/{ => compiler}/compile/nodes/IfBlock.ts (100%) rename src/{ => compiler}/compile/nodes/InlineComponent.ts (100%) rename src/{ => compiler}/compile/nodes/Let.ts (100%) rename src/{ => compiler}/compile/nodes/MustacheTag.ts (100%) rename src/{ => compiler}/compile/nodes/Options.ts (100%) rename src/{ => compiler}/compile/nodes/PendingBlock.ts (100%) rename src/{ => compiler}/compile/nodes/RawMustacheTag.ts (100%) rename src/{ => compiler}/compile/nodes/Slot.ts (100%) rename src/{ => compiler}/compile/nodes/Text.ts (100%) rename src/{ => compiler}/compile/nodes/ThenBlock.ts (100%) rename src/{ => compiler}/compile/nodes/Title.ts (100%) rename src/{ => compiler}/compile/nodes/Transition.ts (100%) rename src/{ => compiler}/compile/nodes/Window.ts (100%) rename src/{ => compiler}/compile/nodes/interfaces.ts (100%) rename src/{ => compiler}/compile/nodes/shared/AbstractBlock.ts (93%) rename src/{ => compiler}/compile/nodes/shared/Expression.ts (100%) rename src/{ => compiler}/compile/nodes/shared/Node.ts (95%) rename src/{ => compiler}/compile/nodes/shared/Tag.ts (100%) rename src/{ => compiler}/compile/nodes/shared/TemplateScope.ts (100%) rename src/{ => compiler}/compile/nodes/shared/map_children.ts (100%) rename src/{ => compiler}/compile/render-dom/Block.ts (100%) rename src/{ => compiler}/compile/render-dom/Renderer.ts (100%) rename src/{ => compiler}/compile/render-dom/index.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/AwaitBlock.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Body.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/DebugTag.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/EachBlock.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Element/Attribute.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Element/Binding.ts (99%) rename src/{ => compiler}/compile/render-dom/wrappers/Element/StyleAttribute.ts (98%) rename src/{ => compiler}/compile/render-dom/wrappers/Element/fix_attribute_casing.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Element/index.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Fragment.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Head.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/IfBlock.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/InlineComponent/index.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/MustacheTag.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/RawMustacheTag.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Slot.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Text.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Title.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/Window.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/shared/Tag.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/shared/Wrapper.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/shared/add_actions.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/shared/add_event_handlers.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/shared/create_debugging_comment.ts (100%) rename src/{ => compiler}/compile/render-dom/wrappers/shared/get_context_merger.ts (100%) rename src/{ => compiler}/compile/render-ssr/Renderer.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/AwaitBlock.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/Comment.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/DebugTag.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/EachBlock.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/Element.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/Head.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/HtmlTag.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/IfBlock.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/InlineComponent.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/Slot.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/Tag.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/Text.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/Title.ts (100%) rename src/{ => compiler}/compile/render-ssr/handlers/shared/get_slot_scope.ts (100%) rename src/{ => compiler}/compile/render-ssr/index.ts (100%) rename src/{ => compiler}/compile/utils/CodeBuilder.ts (100%) rename src/{ => compiler}/compile/utils/__test__.ts (100%) rename src/{ => compiler}/compile/utils/add_to_set.ts (100%) rename src/{ => compiler}/compile/utils/deindent.ts (100%) rename src/{ => compiler}/compile/utils/flatten_reference.ts (100%) rename src/{ => compiler}/compile/utils/get_object.ts (100%) rename src/{ => compiler}/compile/utils/get_slot_data.ts (100%) rename src/{ => compiler}/compile/utils/scope.ts (100%) rename src/{ => compiler}/compile/utils/snip.ts (100%) rename src/{ => compiler}/compile/utils/stringify.ts (100%) rename src/{ => compiler}/compile/utils/stringify_attribute.ts (100%) rename src/{ => compiler}/compile/utils/stringify_props.ts (100%) rename src/{ => compiler}/compile/utils/tail.ts (100%) rename src/{ => compiler}/compile/utils/unwrap_parens.ts (100%) rename src/{ => compiler}/config.ts (100%) rename src/{compiler.ts => compiler/index.ts} (100%) rename src/{ => compiler}/interfaces.ts (100%) rename src/{ => compiler}/parse/acorn.ts (100%) rename src/{ => compiler}/parse/index.ts (100%) rename src/{ => compiler}/parse/read/context.ts (100%) rename src/{ => compiler}/parse/read/expression.ts (100%) rename src/{ => compiler}/parse/read/script.ts (100%) rename src/{ => compiler}/parse/read/style.ts (100%) rename src/{ => compiler}/parse/state/fragment.ts (100%) rename src/{ => compiler}/parse/state/mustache.ts (100%) rename src/{ => compiler}/parse/state/tag.ts (100%) rename src/{ => compiler}/parse/state/text.ts (100%) rename src/{ => compiler}/parse/utils/entities.ts (100%) rename src/{ => compiler}/parse/utils/html.ts (100%) rename src/{ => compiler}/preprocess/index.ts (100%) rename src/{ => compiler}/utils/error.ts (94%) rename src/{ => compiler}/utils/full_char_code_at.ts (100%) rename src/{ => compiler}/utils/fuzzymatch.ts (100%) rename src/{ => compiler}/utils/get_code_frame.ts (100%) rename src/{ => compiler}/utils/indentation.ts (100%) rename src/{ => compiler}/utils/list.ts (100%) rename src/{ => compiler}/utils/names.ts (100%) rename src/{ => compiler}/utils/namespaces.ts (100%) rename src/{ => compiler}/utils/nodes_match.ts (100%) rename src/{ => compiler}/utils/patterns.ts (100%) rename src/{ => compiler}/utils/repeat.ts (100%) rename src/{ => compiler}/utils/trim.ts (100%) rename src/{animate.ts => runtime/animate/index.ts} (100%) rename src/{easing.ts => runtime/easing/index.ts} (100%) rename src/{ => runtime}/index.ts (100%) rename src/{ => runtime}/internal/Component.ts (100%) rename src/{ => runtime}/internal/animations.ts (100%) rename src/{ => runtime}/internal/await-block.ts (100%) rename src/{ => runtime}/internal/dom.ts (100%) rename src/{ => runtime}/internal/index.ts (100%) rename src/{ => runtime}/internal/keyed-each.ts (100%) rename src/{ => runtime}/internal/lifecycle.ts (100%) rename src/{ => runtime}/internal/loop.ts (100%) rename src/{ => runtime}/internal/scheduler.ts (100%) rename src/{ => runtime}/internal/spread.ts (100%) rename src/{ => runtime}/internal/ssr.ts (100%) rename src/{ => runtime}/internal/style_manager.ts (100%) rename src/{ => runtime}/internal/transitions.ts (100%) rename src/{ => runtime}/internal/utils.ts (100%) rename src/{ => runtime}/motion/index.ts (100%) rename src/{ => runtime}/motion/spring.ts (100%) rename src/{ => runtime}/motion/tweened.ts (100%) rename src/{ => runtime}/motion/utils.ts (100%) rename src/{store.ts => runtime/store/index.ts} (100%) rename src/{transition.ts => runtime/transition/index.ts} (100%) delete mode 100644 store.d.ts delete mode 100644 transition.d.ts diff --git a/.gitignore b/.gitignore index 847d12a540..bae1791f33 100644 --- a/.gitignore +++ b/.gitignore @@ -5,13 +5,13 @@ node_modules *.map /src/compile/internal-exports.ts /compiler.*js -/index.*js -/internal.*js -/store.*js -/easing.*js -/motion.*js -/transition.*js -/animate.*js +/index +/internal +/store +/easing +/motion +/transition +/animate /scratch/ /coverage/ /coverage.lcov/ diff --git a/animate.d.ts b/animate.d.ts deleted file mode 100644 index e0c5aebb0e..0000000000 --- a/animate.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './types/animate'; diff --git a/easing.d.ts b/easing.d.ts deleted file mode 100644 index 9af6dd9ca7..0000000000 --- a/easing.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './types/easing'; diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index a3d3b4a0d6..0000000000 --- a/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './types/index'; diff --git a/index.js b/index.js new file mode 100644 index 0000000000..a286b9658a --- /dev/null +++ b/index.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var internal = require('./internal'); + + + +exports.onMount = internal.onMount; +exports.onDestroy = internal.onDestroy; +exports.beforeUpdate = internal.beforeUpdate; +exports.afterUpdate = internal.afterUpdate; +exports.setContext = internal.setContext; +exports.getContext = internal.getContext; +exports.tick = internal.tick; +exports.createEventDispatcher = internal.createEventDispatcher; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000000..9f0507526b --- /dev/null +++ b/index.mjs @@ -0,0 +1 @@ +export { onMount, onDestroy, beforeUpdate, afterUpdate, setContext, getContext, tick, createEventDispatcher } from './internal'; diff --git a/internal.d.ts b/internal.d.ts deleted file mode 100644 index 135ffe7611..0000000000 --- a/internal.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './types/internal'; diff --git a/motion.d.ts b/motion.d.ts deleted file mode 100644 index 4cc764a2c9..0000000000 --- a/motion.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './types/motion'; diff --git a/package.json b/package.json index 1ce1b9b5b7..0be4033eb9 100644 --- a/package.json +++ b/package.json @@ -9,15 +9,16 @@ "compiler.js", "register.js", "index.*", - "internal.*", - "store.*", - "animate.*", - "transition.*", - "easing.*", - "motion.*", + "internal", + "store", + "animate", + "transition", + "easing", + "motion", "svelte", "README.md" ], + "types": "types/runtime", "scripts": { "test": "mocha --opts mocha.opts", "test:unit": "mocha --require sucrase/register --recursive ./**/__test__.ts", @@ -30,8 +31,9 @@ "prepare": "npm run build && npm run tsd", "dev": "rollup -cw", "pretest": "npm run build", - "posttest": "agadoo internal.mjs", - "prepublishOnly": "export PUBLISH=true && npm test", + "posttest": "agadoo internal/index.mjs", + "prepublishOnly": "export PUBLISH=true && npm test && npm run create-stubs", + "create-stubs": "node scripts/create-stubs.js", "tsd": "tsc -p . --emitDeclarationOnly", "typecheck": "tsc -p . --noEmit" }, diff --git a/rollup.config.js b/rollup.config.js index 9fd49f3e8f..b32ce36a14 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -9,7 +9,7 @@ import pkg from './package.json'; const is_publish = !!process.env.PUBLISH; -const tsPlugin = is_publish +const ts_plugin = is_publish ? typescript({ include: 'src/**', typescript: require('typescript') @@ -18,39 +18,12 @@ const tsPlugin = is_publish transforms: ['typescript'] }); -export default [ - /* internal.[m]js */ - { - input: `src/internal/index.ts`, - output: [ - { - file: `internal.mjs`, - format: 'esm', - paths: id => id.startsWith('svelte/') && id.replace('svelte', '.') - }, - { - file: `internal.js`, - format: 'cjs', - paths: id => id.startsWith('svelte/') && id.replace('svelte', '.') - } - ], - external: id => id.startsWith('svelte/'), - - plugins: [ - tsPlugin, - { - generateBundle(options, bundle) { - const mod = bundle['internal.mjs']; - if (mod) { - fs.writeFileSync('src/compile/internal-exports.ts', `// This file is automatically generated\nexport default new Set(${JSON.stringify(mod.exports)});`); - } - } - }] - }, +const external = id => id.startsWith('svelte/'); +export default [ /* compiler.js */ { - input: 'src/compiler.ts', + input: 'src/compiler/index.ts', plugins: [ replace({ __VERSION__: pkg.version @@ -60,7 +33,7 @@ export default [ include: ['node_modules/**'] }), json(), - tsPlugin + ts_plugin ], output: { file: 'compiler.js', @@ -73,45 +46,42 @@ export default [ : id => id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree') }, - /* motion.mjs */ + /* runtime */ { - input: `src/motion/index.ts`, + input: `src/runtime/index.ts`, output: [ { - file: `motion.mjs`, + file: `index.mjs`, format: 'esm', - paths: id => id.startsWith('svelte/') && id.replace('svelte', '.') + paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}` }, { - file: `motion.js`, + file: `index.js`, format: 'cjs', - paths: id => id.startsWith('svelte/') && id.replace('svelte', '.') + paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}` } ], - plugins: [ - tsPlugin - ], - external: id => id.startsWith('svelte/') + external, + plugins: [ts_plugin] }, - // everything else - ...['index', 'easing', 'transition', 'animate', 'store'].map(name => ({ - input: `src/${name}.ts`, - output: [ - { - file: `${name}.mjs`, - format: 'esm', - paths: id => id.startsWith('svelte/') && id.replace('svelte', '.') - }, - { - file: `${name}.js`, - format: 'cjs', - paths: id => id.startsWith('svelte/') && id.replace('svelte', '.') - } - ], - plugins: [ - tsPlugin - ], - external: id => id.startsWith('svelte/') - })) + ...fs.readdirSync('src/runtime') + .filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory()) + .map(dir => ({ + input: `src/runtime/${dir}/index.ts`, + output: [ + { + file: `${dir}/index.mjs`, + format: 'esm', + paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '..')}` + }, + { + file: `${dir}/index.js`, + format: 'cjs', + paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '..')}` + } + ], + external, + plugins: [ts_plugin] + })) ]; diff --git a/scripts/create-stubs.js b/scripts/create-stubs.js new file mode 100644 index 0000000000..191b86cbfd --- /dev/null +++ b/scripts/create-stubs.js @@ -0,0 +1,12 @@ +const fs = require('fs'); + +fs.readdirSync('src/runtime') + .filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory()) + .forEach(dir => { + fs.writeFileSync(`${dir}/package.json`, JSON.stringify({ + main: './index.js', + module: './index.mjs' + }, null, ' ')); + + fs.writeFileSync(`${dir}/index.d.ts`, `export * from '../types/runtime/${dir}/index.d.ts';`); + }); \ No newline at end of file diff --git a/src/Stats.ts b/src/compiler/Stats.ts similarity index 100% rename from src/Stats.ts rename to src/compiler/Stats.ts diff --git a/src/compile/Component.ts b/src/compiler/compile/Component.ts similarity index 100% rename from src/compile/Component.ts rename to src/compiler/compile/Component.ts diff --git a/src/compile/create_module.ts b/src/compiler/compile/create_module.ts similarity index 100% rename from src/compile/create_module.ts rename to src/compiler/compile/create_module.ts diff --git a/src/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts similarity index 100% rename from src/compile/css/Selector.ts rename to src/compiler/compile/css/Selector.ts diff --git a/src/compile/css/Stylesheet.ts b/src/compiler/compile/css/Stylesheet.ts similarity index 100% rename from src/compile/css/Stylesheet.ts rename to src/compiler/compile/css/Stylesheet.ts diff --git a/src/compile/css/gather_possible_values.ts b/src/compiler/compile/css/gather_possible_values.ts similarity index 100% rename from src/compile/css/gather_possible_values.ts rename to src/compiler/compile/css/gather_possible_values.ts diff --git a/src/compile/index.ts b/src/compiler/compile/index.ts similarity index 97% rename from src/compile/index.ts rename to src/compiler/compile/index.ts index dac75f23e0..2ad091c971 100644 --- a/src/compile/index.ts +++ b/src/compiler/compile/index.ts @@ -1,4 +1,4 @@ -import { assign } from '../internal/index'; +import { assign } from '../../runtime/internal/index'; import Stats from '../Stats'; import parse from '../parse/index'; import render_dom from './render-dom/index'; diff --git a/src/compiler/compile/internal-exports.ts b/src/compiler/compile/internal-exports.ts new file mode 100644 index 0000000000..f3f0c757dc --- /dev/null +++ b/src/compiler/compile/internal-exports.ts @@ -0,0 +1,2 @@ +// This file is automatically generated +export default new Set(["create_animation","fix_position","handle_promise","append","insert","detach","detach_between","detach_before","detach_after","destroy_each","element","object_without_properties","svg_element","text","space","empty","listen","prevent_default","stop_propagation","attr","set_attributes","set_custom_element_data","xlink_attr","get_binding_group_value","to_number","time_ranges_to_array","children","claim_element","claim_text","set_data","set_input_type","set_style","select_option","select_options","select_value","select_multiple_value","add_resize_listener","toggle_class","custom_event","destroy_block","outro_and_destroy_block","fix_and_outro_and_destroy_block","update_keyed_each","measure","current_component","set_current_component","beforeUpdate","onMount","afterUpdate","onDestroy","createEventDispatcher","setContext","getContext","bubble","clear_loops","loop","dirty_components","intros","schedule_update","tick","add_binding_callback","add_render_callback","add_flush_callback","flush","get_spread_update","invalid_attribute_name_character","spread","escaped","escape","each","missing_component","validate_component","debug","create_ssr_component","get_store_value","group_outros","check_outros","on_outro","create_in_transition","create_out_transition","create_bidirectional_transition","noop","identity","assign","is_promise","add_location","run","blank_object","run_all","is_function","safe_not_equal","not_equal","validate_store","subscribe","create_slot","get_slot_context","get_slot_changes","exclude_internal_props","now","raf","set_now","set_raf","bind","mount_component","init","SvelteElement","SvelteComponent","SvelteComponentDev"]); \ No newline at end of file diff --git a/src/compile/nodes/Action.ts b/src/compiler/compile/nodes/Action.ts similarity index 100% rename from src/compile/nodes/Action.ts rename to src/compiler/compile/nodes/Action.ts diff --git a/src/compile/nodes/Animation.ts b/src/compiler/compile/nodes/Animation.ts similarity index 100% rename from src/compile/nodes/Animation.ts rename to src/compiler/compile/nodes/Animation.ts diff --git a/src/compile/nodes/Attribute.ts b/src/compiler/compile/nodes/Attribute.ts similarity index 100% rename from src/compile/nodes/Attribute.ts rename to src/compiler/compile/nodes/Attribute.ts diff --git a/src/compile/nodes/AwaitBlock.ts b/src/compiler/compile/nodes/AwaitBlock.ts similarity index 100% rename from src/compile/nodes/AwaitBlock.ts rename to src/compiler/compile/nodes/AwaitBlock.ts diff --git a/src/compile/nodes/Binding.ts b/src/compiler/compile/nodes/Binding.ts similarity index 100% rename from src/compile/nodes/Binding.ts rename to src/compiler/compile/nodes/Binding.ts diff --git a/src/compile/nodes/Body.ts b/src/compiler/compile/nodes/Body.ts similarity index 100% rename from src/compile/nodes/Body.ts rename to src/compiler/compile/nodes/Body.ts diff --git a/src/compile/nodes/CatchBlock.ts b/src/compiler/compile/nodes/CatchBlock.ts similarity index 100% rename from src/compile/nodes/CatchBlock.ts rename to src/compiler/compile/nodes/CatchBlock.ts diff --git a/src/compile/nodes/Class.ts b/src/compiler/compile/nodes/Class.ts similarity index 100% rename from src/compile/nodes/Class.ts rename to src/compiler/compile/nodes/Class.ts diff --git a/src/compile/nodes/Comment.ts b/src/compiler/compile/nodes/Comment.ts similarity index 100% rename from src/compile/nodes/Comment.ts rename to src/compiler/compile/nodes/Comment.ts diff --git a/src/compile/nodes/DebugTag.ts b/src/compiler/compile/nodes/DebugTag.ts similarity index 100% rename from src/compile/nodes/DebugTag.ts rename to src/compiler/compile/nodes/DebugTag.ts diff --git a/src/compile/nodes/EachBlock.ts b/src/compiler/compile/nodes/EachBlock.ts similarity index 100% rename from src/compile/nodes/EachBlock.ts rename to src/compiler/compile/nodes/EachBlock.ts diff --git a/src/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts similarity index 100% rename from src/compile/nodes/Element.ts rename to src/compiler/compile/nodes/Element.ts diff --git a/src/compile/nodes/ElseBlock.ts b/src/compiler/compile/nodes/ElseBlock.ts similarity index 100% rename from src/compile/nodes/ElseBlock.ts rename to src/compiler/compile/nodes/ElseBlock.ts diff --git a/src/compile/nodes/EventHandler.ts b/src/compiler/compile/nodes/EventHandler.ts similarity index 100% rename from src/compile/nodes/EventHandler.ts rename to src/compiler/compile/nodes/EventHandler.ts diff --git a/src/compile/nodes/Fragment.ts b/src/compiler/compile/nodes/Fragment.ts similarity index 100% rename from src/compile/nodes/Fragment.ts rename to src/compiler/compile/nodes/Fragment.ts diff --git a/src/compile/nodes/Head.ts b/src/compiler/compile/nodes/Head.ts similarity index 100% rename from src/compile/nodes/Head.ts rename to src/compiler/compile/nodes/Head.ts diff --git a/src/compile/nodes/IfBlock.ts b/src/compiler/compile/nodes/IfBlock.ts similarity index 100% rename from src/compile/nodes/IfBlock.ts rename to src/compiler/compile/nodes/IfBlock.ts diff --git a/src/compile/nodes/InlineComponent.ts b/src/compiler/compile/nodes/InlineComponent.ts similarity index 100% rename from src/compile/nodes/InlineComponent.ts rename to src/compiler/compile/nodes/InlineComponent.ts diff --git a/src/compile/nodes/Let.ts b/src/compiler/compile/nodes/Let.ts similarity index 100% rename from src/compile/nodes/Let.ts rename to src/compiler/compile/nodes/Let.ts diff --git a/src/compile/nodes/MustacheTag.ts b/src/compiler/compile/nodes/MustacheTag.ts similarity index 100% rename from src/compile/nodes/MustacheTag.ts rename to src/compiler/compile/nodes/MustacheTag.ts diff --git a/src/compile/nodes/Options.ts b/src/compiler/compile/nodes/Options.ts similarity index 100% rename from src/compile/nodes/Options.ts rename to src/compiler/compile/nodes/Options.ts diff --git a/src/compile/nodes/PendingBlock.ts b/src/compiler/compile/nodes/PendingBlock.ts similarity index 100% rename from src/compile/nodes/PendingBlock.ts rename to src/compiler/compile/nodes/PendingBlock.ts diff --git a/src/compile/nodes/RawMustacheTag.ts b/src/compiler/compile/nodes/RawMustacheTag.ts similarity index 100% rename from src/compile/nodes/RawMustacheTag.ts rename to src/compiler/compile/nodes/RawMustacheTag.ts diff --git a/src/compile/nodes/Slot.ts b/src/compiler/compile/nodes/Slot.ts similarity index 100% rename from src/compile/nodes/Slot.ts rename to src/compiler/compile/nodes/Slot.ts diff --git a/src/compile/nodes/Text.ts b/src/compiler/compile/nodes/Text.ts similarity index 100% rename from src/compile/nodes/Text.ts rename to src/compiler/compile/nodes/Text.ts diff --git a/src/compile/nodes/ThenBlock.ts b/src/compiler/compile/nodes/ThenBlock.ts similarity index 100% rename from src/compile/nodes/ThenBlock.ts rename to src/compiler/compile/nodes/ThenBlock.ts diff --git a/src/compile/nodes/Title.ts b/src/compiler/compile/nodes/Title.ts similarity index 100% rename from src/compile/nodes/Title.ts rename to src/compiler/compile/nodes/Title.ts diff --git a/src/compile/nodes/Transition.ts b/src/compiler/compile/nodes/Transition.ts similarity index 100% rename from src/compile/nodes/Transition.ts rename to src/compiler/compile/nodes/Transition.ts diff --git a/src/compile/nodes/Window.ts b/src/compiler/compile/nodes/Window.ts similarity index 100% rename from src/compile/nodes/Window.ts rename to src/compiler/compile/nodes/Window.ts diff --git a/src/compile/nodes/interfaces.ts b/src/compiler/compile/nodes/interfaces.ts similarity index 100% rename from src/compile/nodes/interfaces.ts rename to src/compiler/compile/nodes/interfaces.ts diff --git a/src/compile/nodes/shared/AbstractBlock.ts b/src/compiler/compile/nodes/shared/AbstractBlock.ts similarity index 93% rename from src/compile/nodes/shared/AbstractBlock.ts rename to src/compiler/compile/nodes/shared/AbstractBlock.ts index e1104e4928..931dd4d82d 100644 --- a/src/compile/nodes/shared/AbstractBlock.ts +++ b/src/compiler/compile/nodes/shared/AbstractBlock.ts @@ -1,5 +1,5 @@ import Block from '../../render-dom/Block'; -import Component from './../../Component'; +import Component from '../../Component'; import Node from './Node'; import { INode } from '../interfaces'; diff --git a/src/compile/nodes/shared/Expression.ts b/src/compiler/compile/nodes/shared/Expression.ts similarity index 100% rename from src/compile/nodes/shared/Expression.ts rename to src/compiler/compile/nodes/shared/Expression.ts diff --git a/src/compile/nodes/shared/Node.ts b/src/compiler/compile/nodes/shared/Node.ts similarity index 95% rename from src/compile/nodes/shared/Node.ts rename to src/compiler/compile/nodes/shared/Node.ts index f27e4ceb62..8fa0ec0c97 100644 --- a/src/compile/nodes/shared/Node.ts +++ b/src/compiler/compile/nodes/shared/Node.ts @@ -1,5 +1,5 @@ -import Attribute from './../Attribute'; -import Component from './../../Component'; +import Attribute from '../Attribute'; +import Component from '../../Component'; import { INode } from '../interfaces'; import Text from '../Text'; diff --git a/src/compile/nodes/shared/Tag.ts b/src/compiler/compile/nodes/shared/Tag.ts similarity index 100% rename from src/compile/nodes/shared/Tag.ts rename to src/compiler/compile/nodes/shared/Tag.ts diff --git a/src/compile/nodes/shared/TemplateScope.ts b/src/compiler/compile/nodes/shared/TemplateScope.ts similarity index 100% rename from src/compile/nodes/shared/TemplateScope.ts rename to src/compiler/compile/nodes/shared/TemplateScope.ts diff --git a/src/compile/nodes/shared/map_children.ts b/src/compiler/compile/nodes/shared/map_children.ts similarity index 100% rename from src/compile/nodes/shared/map_children.ts rename to src/compiler/compile/nodes/shared/map_children.ts diff --git a/src/compile/render-dom/Block.ts b/src/compiler/compile/render-dom/Block.ts similarity index 100% rename from src/compile/render-dom/Block.ts rename to src/compiler/compile/render-dom/Block.ts diff --git a/src/compile/render-dom/Renderer.ts b/src/compiler/compile/render-dom/Renderer.ts similarity index 100% rename from src/compile/render-dom/Renderer.ts rename to src/compiler/compile/render-dom/Renderer.ts diff --git a/src/compile/render-dom/index.ts b/src/compiler/compile/render-dom/index.ts similarity index 100% rename from src/compile/render-dom/index.ts rename to src/compiler/compile/render-dom/index.ts diff --git a/src/compile/render-dom/wrappers/AwaitBlock.ts b/src/compiler/compile/render-dom/wrappers/AwaitBlock.ts similarity index 100% rename from src/compile/render-dom/wrappers/AwaitBlock.ts rename to src/compiler/compile/render-dom/wrappers/AwaitBlock.ts diff --git a/src/compile/render-dom/wrappers/Body.ts b/src/compiler/compile/render-dom/wrappers/Body.ts similarity index 100% rename from src/compile/render-dom/wrappers/Body.ts rename to src/compiler/compile/render-dom/wrappers/Body.ts diff --git a/src/compile/render-dom/wrappers/DebugTag.ts b/src/compiler/compile/render-dom/wrappers/DebugTag.ts similarity index 100% rename from src/compile/render-dom/wrappers/DebugTag.ts rename to src/compiler/compile/render-dom/wrappers/DebugTag.ts diff --git a/src/compile/render-dom/wrappers/EachBlock.ts b/src/compiler/compile/render-dom/wrappers/EachBlock.ts similarity index 100% rename from src/compile/render-dom/wrappers/EachBlock.ts rename to src/compiler/compile/render-dom/wrappers/EachBlock.ts diff --git a/src/compile/render-dom/wrappers/Element/Attribute.ts b/src/compiler/compile/render-dom/wrappers/Element/Attribute.ts similarity index 100% rename from src/compile/render-dom/wrappers/Element/Attribute.ts rename to src/compiler/compile/render-dom/wrappers/Element/Attribute.ts diff --git a/src/compile/render-dom/wrappers/Element/Binding.ts b/src/compiler/compile/render-dom/wrappers/Element/Binding.ts similarity index 99% rename from src/compile/render-dom/wrappers/Element/Binding.ts rename to src/compiler/compile/render-dom/wrappers/Element/Binding.ts index b88479ad52..70123fa10c 100644 --- a/src/compile/render-dom/wrappers/Element/Binding.ts +++ b/src/compiler/compile/render-dom/wrappers/Element/Binding.ts @@ -1,5 +1,5 @@ import Binding from '../../../nodes/Binding'; -import ElementWrapper from '.'; +import ElementWrapper from '../Element'; import { dimensions } from '../../../../utils/patterns'; import get_object from '../../../utils/get_object'; import Block from '../../Block'; diff --git a/src/compile/render-dom/wrappers/Element/StyleAttribute.ts b/src/compiler/compile/render-dom/wrappers/Element/StyleAttribute.ts similarity index 98% rename from src/compile/render-dom/wrappers/Element/StyleAttribute.ts rename to src/compiler/compile/render-dom/wrappers/Element/StyleAttribute.ts index 64de2921b3..f51ef33546 100644 --- a/src/compile/render-dom/wrappers/Element/StyleAttribute.ts +++ b/src/compiler/compile/render-dom/wrappers/Element/StyleAttribute.ts @@ -1,7 +1,7 @@ import Attribute from '../../../nodes/Attribute'; import Block from '../../Block'; import AttributeWrapper from './Attribute'; -import ElementWrapper from '.'; +import ElementWrapper from '../Element'; import { stringify } from '../../../utils/stringify'; import add_to_set from '../../../utils/add_to_set'; import Expression from '../../../nodes/shared/Expression'; diff --git a/src/compile/render-dom/wrappers/Element/fix_attribute_casing.ts b/src/compiler/compile/render-dom/wrappers/Element/fix_attribute_casing.ts similarity index 100% rename from src/compile/render-dom/wrappers/Element/fix_attribute_casing.ts rename to src/compiler/compile/render-dom/wrappers/Element/fix_attribute_casing.ts diff --git a/src/compile/render-dom/wrappers/Element/index.ts b/src/compiler/compile/render-dom/wrappers/Element/index.ts similarity index 100% rename from src/compile/render-dom/wrappers/Element/index.ts rename to src/compiler/compile/render-dom/wrappers/Element/index.ts diff --git a/src/compile/render-dom/wrappers/Fragment.ts b/src/compiler/compile/render-dom/wrappers/Fragment.ts similarity index 100% rename from src/compile/render-dom/wrappers/Fragment.ts rename to src/compiler/compile/render-dom/wrappers/Fragment.ts diff --git a/src/compile/render-dom/wrappers/Head.ts b/src/compiler/compile/render-dom/wrappers/Head.ts similarity index 100% rename from src/compile/render-dom/wrappers/Head.ts rename to src/compiler/compile/render-dom/wrappers/Head.ts diff --git a/src/compile/render-dom/wrappers/IfBlock.ts b/src/compiler/compile/render-dom/wrappers/IfBlock.ts similarity index 100% rename from src/compile/render-dom/wrappers/IfBlock.ts rename to src/compiler/compile/render-dom/wrappers/IfBlock.ts diff --git a/src/compile/render-dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts similarity index 100% rename from src/compile/render-dom/wrappers/InlineComponent/index.ts rename to src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts diff --git a/src/compile/render-dom/wrappers/MustacheTag.ts b/src/compiler/compile/render-dom/wrappers/MustacheTag.ts similarity index 100% rename from src/compile/render-dom/wrappers/MustacheTag.ts rename to src/compiler/compile/render-dom/wrappers/MustacheTag.ts diff --git a/src/compile/render-dom/wrappers/RawMustacheTag.ts b/src/compiler/compile/render-dom/wrappers/RawMustacheTag.ts similarity index 100% rename from src/compile/render-dom/wrappers/RawMustacheTag.ts rename to src/compiler/compile/render-dom/wrappers/RawMustacheTag.ts diff --git a/src/compile/render-dom/wrappers/Slot.ts b/src/compiler/compile/render-dom/wrappers/Slot.ts similarity index 100% rename from src/compile/render-dom/wrappers/Slot.ts rename to src/compiler/compile/render-dom/wrappers/Slot.ts diff --git a/src/compile/render-dom/wrappers/Text.ts b/src/compiler/compile/render-dom/wrappers/Text.ts similarity index 100% rename from src/compile/render-dom/wrappers/Text.ts rename to src/compiler/compile/render-dom/wrappers/Text.ts diff --git a/src/compile/render-dom/wrappers/Title.ts b/src/compiler/compile/render-dom/wrappers/Title.ts similarity index 100% rename from src/compile/render-dom/wrappers/Title.ts rename to src/compiler/compile/render-dom/wrappers/Title.ts diff --git a/src/compile/render-dom/wrappers/Window.ts b/src/compiler/compile/render-dom/wrappers/Window.ts similarity index 100% rename from src/compile/render-dom/wrappers/Window.ts rename to src/compiler/compile/render-dom/wrappers/Window.ts diff --git a/src/compile/render-dom/wrappers/shared/Tag.ts b/src/compiler/compile/render-dom/wrappers/shared/Tag.ts similarity index 100% rename from src/compile/render-dom/wrappers/shared/Tag.ts rename to src/compiler/compile/render-dom/wrappers/shared/Tag.ts diff --git a/src/compile/render-dom/wrappers/shared/Wrapper.ts b/src/compiler/compile/render-dom/wrappers/shared/Wrapper.ts similarity index 100% rename from src/compile/render-dom/wrappers/shared/Wrapper.ts rename to src/compiler/compile/render-dom/wrappers/shared/Wrapper.ts diff --git a/src/compile/render-dom/wrappers/shared/add_actions.ts b/src/compiler/compile/render-dom/wrappers/shared/add_actions.ts similarity index 100% rename from src/compile/render-dom/wrappers/shared/add_actions.ts rename to src/compiler/compile/render-dom/wrappers/shared/add_actions.ts diff --git a/src/compile/render-dom/wrappers/shared/add_event_handlers.ts b/src/compiler/compile/render-dom/wrappers/shared/add_event_handlers.ts similarity index 100% rename from src/compile/render-dom/wrappers/shared/add_event_handlers.ts rename to src/compiler/compile/render-dom/wrappers/shared/add_event_handlers.ts diff --git a/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts b/src/compiler/compile/render-dom/wrappers/shared/create_debugging_comment.ts similarity index 100% rename from src/compile/render-dom/wrappers/shared/create_debugging_comment.ts rename to src/compiler/compile/render-dom/wrappers/shared/create_debugging_comment.ts diff --git a/src/compile/render-dom/wrappers/shared/get_context_merger.ts b/src/compiler/compile/render-dom/wrappers/shared/get_context_merger.ts similarity index 100% rename from src/compile/render-dom/wrappers/shared/get_context_merger.ts rename to src/compiler/compile/render-dom/wrappers/shared/get_context_merger.ts diff --git a/src/compile/render-ssr/Renderer.ts b/src/compiler/compile/render-ssr/Renderer.ts similarity index 100% rename from src/compile/render-ssr/Renderer.ts rename to src/compiler/compile/render-ssr/Renderer.ts diff --git a/src/compile/render-ssr/handlers/AwaitBlock.ts b/src/compiler/compile/render-ssr/handlers/AwaitBlock.ts similarity index 100% rename from src/compile/render-ssr/handlers/AwaitBlock.ts rename to src/compiler/compile/render-ssr/handlers/AwaitBlock.ts diff --git a/src/compile/render-ssr/handlers/Comment.ts b/src/compiler/compile/render-ssr/handlers/Comment.ts similarity index 100% rename from src/compile/render-ssr/handlers/Comment.ts rename to src/compiler/compile/render-ssr/handlers/Comment.ts diff --git a/src/compile/render-ssr/handlers/DebugTag.ts b/src/compiler/compile/render-ssr/handlers/DebugTag.ts similarity index 100% rename from src/compile/render-ssr/handlers/DebugTag.ts rename to src/compiler/compile/render-ssr/handlers/DebugTag.ts diff --git a/src/compile/render-ssr/handlers/EachBlock.ts b/src/compiler/compile/render-ssr/handlers/EachBlock.ts similarity index 100% rename from src/compile/render-ssr/handlers/EachBlock.ts rename to src/compiler/compile/render-ssr/handlers/EachBlock.ts diff --git a/src/compile/render-ssr/handlers/Element.ts b/src/compiler/compile/render-ssr/handlers/Element.ts similarity index 100% rename from src/compile/render-ssr/handlers/Element.ts rename to src/compiler/compile/render-ssr/handlers/Element.ts diff --git a/src/compile/render-ssr/handlers/Head.ts b/src/compiler/compile/render-ssr/handlers/Head.ts similarity index 100% rename from src/compile/render-ssr/handlers/Head.ts rename to src/compiler/compile/render-ssr/handlers/Head.ts diff --git a/src/compile/render-ssr/handlers/HtmlTag.ts b/src/compiler/compile/render-ssr/handlers/HtmlTag.ts similarity index 100% rename from src/compile/render-ssr/handlers/HtmlTag.ts rename to src/compiler/compile/render-ssr/handlers/HtmlTag.ts diff --git a/src/compile/render-ssr/handlers/IfBlock.ts b/src/compiler/compile/render-ssr/handlers/IfBlock.ts similarity index 100% rename from src/compile/render-ssr/handlers/IfBlock.ts rename to src/compiler/compile/render-ssr/handlers/IfBlock.ts diff --git a/src/compile/render-ssr/handlers/InlineComponent.ts b/src/compiler/compile/render-ssr/handlers/InlineComponent.ts similarity index 100% rename from src/compile/render-ssr/handlers/InlineComponent.ts rename to src/compiler/compile/render-ssr/handlers/InlineComponent.ts diff --git a/src/compile/render-ssr/handlers/Slot.ts b/src/compiler/compile/render-ssr/handlers/Slot.ts similarity index 100% rename from src/compile/render-ssr/handlers/Slot.ts rename to src/compiler/compile/render-ssr/handlers/Slot.ts diff --git a/src/compile/render-ssr/handlers/Tag.ts b/src/compiler/compile/render-ssr/handlers/Tag.ts similarity index 100% rename from src/compile/render-ssr/handlers/Tag.ts rename to src/compiler/compile/render-ssr/handlers/Tag.ts diff --git a/src/compile/render-ssr/handlers/Text.ts b/src/compiler/compile/render-ssr/handlers/Text.ts similarity index 100% rename from src/compile/render-ssr/handlers/Text.ts rename to src/compiler/compile/render-ssr/handlers/Text.ts diff --git a/src/compile/render-ssr/handlers/Title.ts b/src/compiler/compile/render-ssr/handlers/Title.ts similarity index 100% rename from src/compile/render-ssr/handlers/Title.ts rename to src/compiler/compile/render-ssr/handlers/Title.ts diff --git a/src/compile/render-ssr/handlers/shared/get_slot_scope.ts b/src/compiler/compile/render-ssr/handlers/shared/get_slot_scope.ts similarity index 100% rename from src/compile/render-ssr/handlers/shared/get_slot_scope.ts rename to src/compiler/compile/render-ssr/handlers/shared/get_slot_scope.ts diff --git a/src/compile/render-ssr/index.ts b/src/compiler/compile/render-ssr/index.ts similarity index 100% rename from src/compile/render-ssr/index.ts rename to src/compiler/compile/render-ssr/index.ts diff --git a/src/compile/utils/CodeBuilder.ts b/src/compiler/compile/utils/CodeBuilder.ts similarity index 100% rename from src/compile/utils/CodeBuilder.ts rename to src/compiler/compile/utils/CodeBuilder.ts diff --git a/src/compile/utils/__test__.ts b/src/compiler/compile/utils/__test__.ts similarity index 100% rename from src/compile/utils/__test__.ts rename to src/compiler/compile/utils/__test__.ts diff --git a/src/compile/utils/add_to_set.ts b/src/compiler/compile/utils/add_to_set.ts similarity index 100% rename from src/compile/utils/add_to_set.ts rename to src/compiler/compile/utils/add_to_set.ts diff --git a/src/compile/utils/deindent.ts b/src/compiler/compile/utils/deindent.ts similarity index 100% rename from src/compile/utils/deindent.ts rename to src/compiler/compile/utils/deindent.ts diff --git a/src/compile/utils/flatten_reference.ts b/src/compiler/compile/utils/flatten_reference.ts similarity index 100% rename from src/compile/utils/flatten_reference.ts rename to src/compiler/compile/utils/flatten_reference.ts diff --git a/src/compile/utils/get_object.ts b/src/compiler/compile/utils/get_object.ts similarity index 100% rename from src/compile/utils/get_object.ts rename to src/compiler/compile/utils/get_object.ts diff --git a/src/compile/utils/get_slot_data.ts b/src/compiler/compile/utils/get_slot_data.ts similarity index 100% rename from src/compile/utils/get_slot_data.ts rename to src/compiler/compile/utils/get_slot_data.ts diff --git a/src/compile/utils/scope.ts b/src/compiler/compile/utils/scope.ts similarity index 100% rename from src/compile/utils/scope.ts rename to src/compiler/compile/utils/scope.ts diff --git a/src/compile/utils/snip.ts b/src/compiler/compile/utils/snip.ts similarity index 100% rename from src/compile/utils/snip.ts rename to src/compiler/compile/utils/snip.ts diff --git a/src/compile/utils/stringify.ts b/src/compiler/compile/utils/stringify.ts similarity index 100% rename from src/compile/utils/stringify.ts rename to src/compiler/compile/utils/stringify.ts diff --git a/src/compile/utils/stringify_attribute.ts b/src/compiler/compile/utils/stringify_attribute.ts similarity index 100% rename from src/compile/utils/stringify_attribute.ts rename to src/compiler/compile/utils/stringify_attribute.ts diff --git a/src/compile/utils/stringify_props.ts b/src/compiler/compile/utils/stringify_props.ts similarity index 100% rename from src/compile/utils/stringify_props.ts rename to src/compiler/compile/utils/stringify_props.ts diff --git a/src/compile/utils/tail.ts b/src/compiler/compile/utils/tail.ts similarity index 100% rename from src/compile/utils/tail.ts rename to src/compiler/compile/utils/tail.ts diff --git a/src/compile/utils/unwrap_parens.ts b/src/compiler/compile/utils/unwrap_parens.ts similarity index 100% rename from src/compile/utils/unwrap_parens.ts rename to src/compiler/compile/utils/unwrap_parens.ts diff --git a/src/config.ts b/src/compiler/config.ts similarity index 100% rename from src/config.ts rename to src/compiler/config.ts diff --git a/src/compiler.ts b/src/compiler/index.ts similarity index 100% rename from src/compiler.ts rename to src/compiler/index.ts diff --git a/src/interfaces.ts b/src/compiler/interfaces.ts similarity index 100% rename from src/interfaces.ts rename to src/compiler/interfaces.ts diff --git a/src/parse/acorn.ts b/src/compiler/parse/acorn.ts similarity index 100% rename from src/parse/acorn.ts rename to src/compiler/parse/acorn.ts diff --git a/src/parse/index.ts b/src/compiler/parse/index.ts similarity index 100% rename from src/parse/index.ts rename to src/compiler/parse/index.ts diff --git a/src/parse/read/context.ts b/src/compiler/parse/read/context.ts similarity index 100% rename from src/parse/read/context.ts rename to src/compiler/parse/read/context.ts diff --git a/src/parse/read/expression.ts b/src/compiler/parse/read/expression.ts similarity index 100% rename from src/parse/read/expression.ts rename to src/compiler/parse/read/expression.ts diff --git a/src/parse/read/script.ts b/src/compiler/parse/read/script.ts similarity index 100% rename from src/parse/read/script.ts rename to src/compiler/parse/read/script.ts diff --git a/src/parse/read/style.ts b/src/compiler/parse/read/style.ts similarity index 100% rename from src/parse/read/style.ts rename to src/compiler/parse/read/style.ts diff --git a/src/parse/state/fragment.ts b/src/compiler/parse/state/fragment.ts similarity index 100% rename from src/parse/state/fragment.ts rename to src/compiler/parse/state/fragment.ts diff --git a/src/parse/state/mustache.ts b/src/compiler/parse/state/mustache.ts similarity index 100% rename from src/parse/state/mustache.ts rename to src/compiler/parse/state/mustache.ts diff --git a/src/parse/state/tag.ts b/src/compiler/parse/state/tag.ts similarity index 100% rename from src/parse/state/tag.ts rename to src/compiler/parse/state/tag.ts diff --git a/src/parse/state/text.ts b/src/compiler/parse/state/text.ts similarity index 100% rename from src/parse/state/text.ts rename to src/compiler/parse/state/text.ts diff --git a/src/parse/utils/entities.ts b/src/compiler/parse/utils/entities.ts similarity index 100% rename from src/parse/utils/entities.ts rename to src/compiler/parse/utils/entities.ts diff --git a/src/parse/utils/html.ts b/src/compiler/parse/utils/html.ts similarity index 100% rename from src/parse/utils/html.ts rename to src/compiler/parse/utils/html.ts diff --git a/src/preprocess/index.ts b/src/compiler/preprocess/index.ts similarity index 100% rename from src/preprocess/index.ts rename to src/compiler/preprocess/index.ts diff --git a/src/utils/error.ts b/src/compiler/utils/error.ts similarity index 94% rename from src/utils/error.ts rename to src/compiler/utils/error.ts index f89cc3d721..a34d3fe112 100644 --- a/src/utils/error.ts +++ b/src/compiler/utils/error.ts @@ -1,5 +1,5 @@ import { locate } from 'locate-character'; -import get_code_frame from '../utils/get_code_frame'; +import get_code_frame from './get_code_frame'; class CompileError extends Error { code: string; diff --git a/src/utils/full_char_code_at.ts b/src/compiler/utils/full_char_code_at.ts similarity index 100% rename from src/utils/full_char_code_at.ts rename to src/compiler/utils/full_char_code_at.ts diff --git a/src/utils/fuzzymatch.ts b/src/compiler/utils/fuzzymatch.ts similarity index 100% rename from src/utils/fuzzymatch.ts rename to src/compiler/utils/fuzzymatch.ts diff --git a/src/utils/get_code_frame.ts b/src/compiler/utils/get_code_frame.ts similarity index 100% rename from src/utils/get_code_frame.ts rename to src/compiler/utils/get_code_frame.ts diff --git a/src/utils/indentation.ts b/src/compiler/utils/indentation.ts similarity index 100% rename from src/utils/indentation.ts rename to src/compiler/utils/indentation.ts diff --git a/src/utils/list.ts b/src/compiler/utils/list.ts similarity index 100% rename from src/utils/list.ts rename to src/compiler/utils/list.ts diff --git a/src/utils/names.ts b/src/compiler/utils/names.ts similarity index 100% rename from src/utils/names.ts rename to src/compiler/utils/names.ts diff --git a/src/utils/namespaces.ts b/src/compiler/utils/namespaces.ts similarity index 100% rename from src/utils/namespaces.ts rename to src/compiler/utils/namespaces.ts diff --git a/src/utils/nodes_match.ts b/src/compiler/utils/nodes_match.ts similarity index 100% rename from src/utils/nodes_match.ts rename to src/compiler/utils/nodes_match.ts diff --git a/src/utils/patterns.ts b/src/compiler/utils/patterns.ts similarity index 100% rename from src/utils/patterns.ts rename to src/compiler/utils/patterns.ts diff --git a/src/utils/repeat.ts b/src/compiler/utils/repeat.ts similarity index 100% rename from src/utils/repeat.ts rename to src/compiler/utils/repeat.ts diff --git a/src/utils/trim.ts b/src/compiler/utils/trim.ts similarity index 100% rename from src/utils/trim.ts rename to src/compiler/utils/trim.ts diff --git a/src/animate.ts b/src/runtime/animate/index.ts similarity index 100% rename from src/animate.ts rename to src/runtime/animate/index.ts diff --git a/src/easing.ts b/src/runtime/easing/index.ts similarity index 100% rename from src/easing.ts rename to src/runtime/easing/index.ts diff --git a/src/index.ts b/src/runtime/index.ts similarity index 100% rename from src/index.ts rename to src/runtime/index.ts diff --git a/src/internal/Component.ts b/src/runtime/internal/Component.ts similarity index 100% rename from src/internal/Component.ts rename to src/runtime/internal/Component.ts diff --git a/src/internal/animations.ts b/src/runtime/internal/animations.ts similarity index 100% rename from src/internal/animations.ts rename to src/runtime/internal/animations.ts diff --git a/src/internal/await-block.ts b/src/runtime/internal/await-block.ts similarity index 100% rename from src/internal/await-block.ts rename to src/runtime/internal/await-block.ts diff --git a/src/internal/dom.ts b/src/runtime/internal/dom.ts similarity index 100% rename from src/internal/dom.ts rename to src/runtime/internal/dom.ts diff --git a/src/internal/index.ts b/src/runtime/internal/index.ts similarity index 100% rename from src/internal/index.ts rename to src/runtime/internal/index.ts diff --git a/src/internal/keyed-each.ts b/src/runtime/internal/keyed-each.ts similarity index 100% rename from src/internal/keyed-each.ts rename to src/runtime/internal/keyed-each.ts diff --git a/src/internal/lifecycle.ts b/src/runtime/internal/lifecycle.ts similarity index 100% rename from src/internal/lifecycle.ts rename to src/runtime/internal/lifecycle.ts diff --git a/src/internal/loop.ts b/src/runtime/internal/loop.ts similarity index 100% rename from src/internal/loop.ts rename to src/runtime/internal/loop.ts diff --git a/src/internal/scheduler.ts b/src/runtime/internal/scheduler.ts similarity index 100% rename from src/internal/scheduler.ts rename to src/runtime/internal/scheduler.ts diff --git a/src/internal/spread.ts b/src/runtime/internal/spread.ts similarity index 100% rename from src/internal/spread.ts rename to src/runtime/internal/spread.ts diff --git a/src/internal/ssr.ts b/src/runtime/internal/ssr.ts similarity index 100% rename from src/internal/ssr.ts rename to src/runtime/internal/ssr.ts diff --git a/src/internal/style_manager.ts b/src/runtime/internal/style_manager.ts similarity index 100% rename from src/internal/style_manager.ts rename to src/runtime/internal/style_manager.ts diff --git a/src/internal/transitions.ts b/src/runtime/internal/transitions.ts similarity index 100% rename from src/internal/transitions.ts rename to src/runtime/internal/transitions.ts diff --git a/src/internal/utils.ts b/src/runtime/internal/utils.ts similarity index 100% rename from src/internal/utils.ts rename to src/runtime/internal/utils.ts diff --git a/src/motion/index.ts b/src/runtime/motion/index.ts similarity index 100% rename from src/motion/index.ts rename to src/runtime/motion/index.ts diff --git a/src/motion/spring.ts b/src/runtime/motion/spring.ts similarity index 100% rename from src/motion/spring.ts rename to src/runtime/motion/spring.ts diff --git a/src/motion/tweened.ts b/src/runtime/motion/tweened.ts similarity index 100% rename from src/motion/tweened.ts rename to src/runtime/motion/tweened.ts diff --git a/src/motion/utils.ts b/src/runtime/motion/utils.ts similarity index 100% rename from src/motion/utils.ts rename to src/runtime/motion/utils.ts diff --git a/src/store.ts b/src/runtime/store/index.ts similarity index 100% rename from src/store.ts rename to src/runtime/store/index.ts diff --git a/src/transition.ts b/src/runtime/transition/index.ts similarity index 100% rename from src/transition.ts rename to src/runtime/transition/index.ts diff --git a/store.d.ts b/store.d.ts deleted file mode 100644 index 6d345dce57..0000000000 --- a/store.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './types/store'; diff --git a/test/custom-elements/index.js b/test/custom-elements/index.js index 5ac0b73bbf..9255d33c0e 100644 --- a/test/custom-elements/index.js +++ b/test/custom-elements/index.js @@ -58,7 +58,7 @@ describe('custom-elements', function() { const solo = /\.solo$/.test(dir); const skip = /\.skip$/.test(dir); - const internal = path.resolve('internal.mjs'); + const internal = path.resolve('internal/index.mjs'); const index = path.resolve('index.mjs'); const warnings = []; @@ -71,7 +71,7 @@ describe('custom-elements', function() { plugins: [ { resolveId(importee) { - if (importee === 'svelte/internal') { + if (importee === 'svelte/internal' || importee === './internal') { return internal; } diff --git a/test/runtime/index.js b/test/runtime/index.js index fd5ffdef04..77879edc1f 100644 --- a/test/runtime/index.js +++ b/test/runtime/index.js @@ -3,7 +3,7 @@ import * as path from "path"; import * as fs from "fs"; import { rollup } from 'rollup'; import * as virtual from 'rollup-plugin-virtual'; -import { clear_loops, set_now, set_raf } from "../../internal.js"; +import { clear_loops, set_now, set_raf } from "../../internal"; import { showOutput, @@ -20,7 +20,7 @@ let compileOptions = null; let compile = null; const sveltePath = process.cwd().split('\\').join('/'); -const internal = `${sveltePath}/internal.js`; +const internal = `${sveltePath}/internal`; describe("runtime", () => { before(() => { @@ -223,7 +223,7 @@ describe("runtime", () => { { resolveId: (importee, importer) => { if (importee.startsWith('svelte/')) { - return importee.replace('svelte', process.cwd()) + '.mjs'; + return importee.replace('svelte', process.cwd()) + '/index.mjs'; } } } diff --git a/test/runtime/samples/prop-subscribable/_config.js b/test/runtime/samples/prop-subscribable/_config.js index 69f8104fab..84cde8c9af 100644 --- a/test/runtime/samples/prop-subscribable/_config.js +++ b/test/runtime/samples/prop-subscribable/_config.js @@ -1,4 +1,4 @@ -import { writable } from '../../../../store.js'; +import { writable } from '../../../../store'; export default { props: { diff --git a/test/runtime/samples/store-assignment-updates-reactive/_config.js b/test/runtime/samples/store-assignment-updates-reactive/_config.js index a7439bde5c..e81b3bb180 100644 --- a/test/runtime/samples/store-assignment-updates-reactive/_config.js +++ b/test/runtime/samples/store-assignment-updates-reactive/_config.js @@ -1,4 +1,4 @@ -import { writable } from '../../../../store.js'; +import { writable } from '../../../../store'; const c = writable(0); diff --git a/test/runtime/samples/store-assignment-updates-reactive/main.svelte b/test/runtime/samples/store-assignment-updates-reactive/main.svelte index 18ec3bd7a7..9975ea87b8 100644 --- a/test/runtime/samples/store-assignment-updates-reactive/main.svelte +++ b/test/runtime/samples/store-assignment-updates-reactive/main.svelte @@ -1,5 +1,5 @@