From 22a79cdeddfe1e2643edef01be9f054446e3534a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 26 May 2022 23:45:40 +0200 Subject: [PATCH] [REF] reorganize file structure in order to separate compiler/ and runtime/ code --- rollup.config.js | 2 +- src/compiler/index.ts | 4 ++-- src/index.ts | 4 ++-- src/{app => runtime}/app.ts | 12 ++++++------ src/{ => runtime}/blockdom/attributes.ts | 0 src/{ => runtime}/blockdom/block_compiler.ts | 0 src/{ => runtime}/blockdom/config.ts | 0 src/{ => runtime}/blockdom/event_catcher.ts | 0 src/{ => runtime}/blockdom/events.ts | 0 src/{ => runtime}/blockdom/html.ts | 0 src/{ => runtime}/blockdom/index.ts | 0 src/{ => runtime}/blockdom/list.ts | 0 src/{ => runtime}/blockdom/multi.ts | 0 src/{ => runtime}/blockdom/text.ts | 0 src/{ => runtime}/blockdom/toggler.ts | 0 src/{component => runtime}/component.ts | 2 +- src/{component => runtime}/component_node.ts | 8 ++++---- src/{component => runtime}/error_handling.ts | 0 src/{component => runtime}/fibers.ts | 2 +- src/{component => runtime}/handler.ts | 2 +- src/{ => runtime}/hooks.ts | 6 +++--- src/{index.runtime.ts => runtime/index.ts} | 14 +++++++------- src/{component => runtime}/lifecycle_hooks.ts | 0 src/{ => runtime}/portal.ts | 4 ++-- src/{ => runtime}/reactivity.ts | 0 src/{component => runtime}/scheduler.ts | 0 src/{component => runtime}/status.ts | 0 src/{app => runtime}/template_helpers.ts | 12 ++++++------ src/{app => runtime}/template_set.ts | 6 +++--- src/{ => runtime}/utils.ts | 0 src/{ => runtime}/validation.ts | 0 tests/app/app.test.ts | 2 +- tests/blockdom/block.test.ts | 2 +- tests/blockdom/block_attributes.test.ts | 2 +- tests/blockdom/block_event_handling.test.ts | 2 +- tests/blockdom/block_refs.test.ts | 2 +- tests/blockdom/comment.test.ts | 2 +- tests/blockdom/event_catcher.test.ts | 4 ++-- tests/blockdom/html.test.ts | 2 +- tests/blockdom/list.test.ts | 11 ++++++++++- tests/blockdom/multi.test.ts | 2 +- tests/blockdom/namespace.test.ts | 2 +- tests/blockdom/remove_hook.test.ts | 2 +- tests/blockdom/text.test.ts | 2 +- tests/blockdom/toggler.test.ts | 2 +- tests/compiler/attributes.test.ts | 2 +- tests/compiler/event_handling.test.ts | 8 ++++---- tests/compiler/svg.test.ts | 2 +- tests/compiler/t_esc.test.ts | 2 +- tests/compiler/t_foreach.test.ts | 2 +- tests/compiler/t_if.test.ts | 2 +- tests/compiler/t_key.test.ts | 2 +- tests/compiler/t_out.test.ts | 6 +++--- tests/compiler/t_ref.test.ts | 4 ++-- tests/compiler/t_tag.test.ts | 2 +- tests/compiler/validation.test.ts | 2 +- tests/components/basics.test.ts | 2 +- tests/components/concurrency.test.ts | 6 +++--- tests/components/lifecycle.test.ts | 4 ++-- tests/components/props_validation.test.ts | 6 +++--- tests/components/t_call_block.test.ts | 2 +- tests/components/t_model.test.ts | 2 +- tests/components/t_on.test.ts | 2 +- tests/helpers.ts | 6 +++--- tests/misc/portal.test.ts | 2 +- tests/reactivity.test.ts | 4 ++-- tests/utils.test.ts | 2 +- tests/validation.test.ts | 2 +- 68 files changed, 100 insertions(+), 91 deletions(-) rename src/{app => runtime}/app.ts (90%) rename src/{ => runtime}/blockdom/attributes.ts (100%) rename src/{ => runtime}/blockdom/block_compiler.ts (100%) rename src/{ => runtime}/blockdom/config.ts (100%) rename src/{ => runtime}/blockdom/event_catcher.ts (100%) rename src/{ => runtime}/blockdom/events.ts (100%) rename src/{ => runtime}/blockdom/html.ts (100%) rename src/{ => runtime}/blockdom/index.ts (100%) rename src/{ => runtime}/blockdom/list.ts (100%) rename src/{ => runtime}/blockdom/multi.ts (100%) rename src/{ => runtime}/blockdom/text.ts (100%) rename src/{ => runtime}/blockdom/toggler.ts (100%) rename src/{component => runtime}/component.ts (96%) rename src/{component => runtime}/component_node.ts (98%) rename src/{component => runtime}/error_handling.ts (100%) rename src/{component => runtime}/fibers.ts (99%) rename src/{component => runtime}/handler.ts (95%) rename src/{ => runtime}/hooks.ts (96%) rename src/{index.runtime.ts => runtime/index.ts} (73%) rename src/{component => runtime}/lifecycle_hooks.ts (100%) rename src/{ => runtime}/portal.ts (94%) rename src/{ => runtime}/reactivity.ts (100%) rename src/{component => runtime}/scheduler.ts (100%) rename src/{component => runtime}/status.ts (100%) rename src/{app => runtime}/template_helpers.ts (95%) rename src/{app => runtime}/template_set.ts (97%) rename src/{ => runtime}/utils.ts (100%) rename src/{ => runtime}/validation.ts (100%) diff --git a/rollup.config.js b/rollup.config.js index b47f2492..f5efc12e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -21,7 +21,7 @@ switch (process.argv[4]) { ] break; case "runtime": - input = "src/index.runtime.ts"; + input = "src/runtime/index.ts"; output = [ getConfigForFormat('esm', addSuffix(pkg.module, 'runtime'), outro), getConfigForFormat('cjs', addSuffix(pkg.main, 'runtime'), outro), diff --git a/src/compiler/index.ts b/src/compiler/index.ts index 74e8530b..6a0b6379 100644 --- a/src/compiler/index.ts +++ b/src/compiler/index.ts @@ -1,5 +1,5 @@ -import type { TemplateSet } from "../app/template_set"; -import type { BDom } from "../blockdom"; +import type { TemplateSet } from "../runtime/template_set"; +import type { BDom } from "../runtime/blockdom"; import { CodeGenerator, Config } from "./code_generator"; import { parse } from "./parser"; diff --git a/src/index.ts b/src/index.ts index 2dbf0df3..83d84e89 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ -import { TemplateSet } from "./app/template_set"; +import { TemplateSet } from "./runtime/template_set"; import { compile } from "./compiler"; -export * from "./index.runtime"; +export * from "./runtime"; TemplateSet.prototype._compileTemplate = function _compileTemplate( name: string, diff --git a/src/app/app.ts b/src/runtime/app.ts similarity index 90% rename from src/app/app.ts rename to src/runtime/app.ts index 8f8b806e..ce71b395 100644 --- a/src/app/app.ts +++ b/src/runtime/app.ts @@ -1,10 +1,10 @@ -import { Component, ComponentConstructor } from "../component/component"; -import { ComponentNode } from "../component/component_node"; -import { MountOptions } from "../component/fibers"; -import { Scheduler } from "../component/scheduler"; +import { Component, ComponentConstructor } from "./component"; +import { ComponentNode } from "./component_node"; +import { MountOptions } from "./fibers"; +import { Scheduler } from "./scheduler"; import { TemplateSet, TemplateSetConfig } from "./template_set"; -import { nodeErrorHandlers } from "../component/error_handling"; -import { validateTarget } from "../utils"; +import { nodeErrorHandlers } from "./error_handling"; +import { validateTarget } from "./utils"; import { validateProps } from "./template_helpers"; // reimplement dev mode stuff see last change in 0f7a8289a6fb8387c3c1af41c6664b2a8448758f diff --git a/src/blockdom/attributes.ts b/src/runtime/blockdom/attributes.ts similarity index 100% rename from src/blockdom/attributes.ts rename to src/runtime/blockdom/attributes.ts diff --git a/src/blockdom/block_compiler.ts b/src/runtime/blockdom/block_compiler.ts similarity index 100% rename from src/blockdom/block_compiler.ts rename to src/runtime/blockdom/block_compiler.ts diff --git a/src/blockdom/config.ts b/src/runtime/blockdom/config.ts similarity index 100% rename from src/blockdom/config.ts rename to src/runtime/blockdom/config.ts diff --git a/src/blockdom/event_catcher.ts b/src/runtime/blockdom/event_catcher.ts similarity index 100% rename from src/blockdom/event_catcher.ts rename to src/runtime/blockdom/event_catcher.ts diff --git a/src/blockdom/events.ts b/src/runtime/blockdom/events.ts similarity index 100% rename from src/blockdom/events.ts rename to src/runtime/blockdom/events.ts diff --git a/src/blockdom/html.ts b/src/runtime/blockdom/html.ts similarity index 100% rename from src/blockdom/html.ts rename to src/runtime/blockdom/html.ts diff --git a/src/blockdom/index.ts b/src/runtime/blockdom/index.ts similarity index 100% rename from src/blockdom/index.ts rename to src/runtime/blockdom/index.ts diff --git a/src/blockdom/list.ts b/src/runtime/blockdom/list.ts similarity index 100% rename from src/blockdom/list.ts rename to src/runtime/blockdom/list.ts diff --git a/src/blockdom/multi.ts b/src/runtime/blockdom/multi.ts similarity index 100% rename from src/blockdom/multi.ts rename to src/runtime/blockdom/multi.ts diff --git a/src/blockdom/text.ts b/src/runtime/blockdom/text.ts similarity index 100% rename from src/blockdom/text.ts rename to src/runtime/blockdom/text.ts diff --git a/src/blockdom/toggler.ts b/src/runtime/blockdom/toggler.ts similarity index 100% rename from src/blockdom/toggler.ts rename to src/runtime/blockdom/toggler.ts diff --git a/src/component/component.ts b/src/runtime/component.ts similarity index 96% rename from src/component/component.ts rename to src/runtime/component.ts index 3e67a041..6889de37 100644 --- a/src/component/component.ts +++ b/src/runtime/component.ts @@ -1,4 +1,4 @@ -import { Schema } from "../validation"; +import { Schema } from "./validation"; import type { ComponentNode } from "./component_node"; // ----------------------------------------------------------------------------- diff --git a/src/component/component_node.ts b/src/runtime/component_node.ts similarity index 98% rename from src/component/component_node.ts rename to src/runtime/component_node.ts index 252baaf9..911eeccf 100644 --- a/src/component/component_node.ts +++ b/src/runtime/component_node.ts @@ -1,5 +1,5 @@ -import type { App, Env } from "../app/app"; -import { BDom, VNode } from "../blockdom"; +import type { App, Env } from "./app"; +import { BDom, VNode } from "./blockdom"; import { clearReactivesForCallback, getSubscriptions, @@ -8,8 +8,8 @@ import { reactive, toRaw, TARGET, -} from "../reactivity"; -import { batched, Callback } from "../utils"; +} from "./reactivity"; +import { batched, Callback } from "./utils"; import { Component, ComponentConstructor } from "./component"; import { fibersInError, handleError } from "./error_handling"; import { Fiber, makeChildFiber, makeRootFiber, MountFiber, MountOptions } from "./fibers"; diff --git a/src/component/error_handling.ts b/src/runtime/error_handling.ts similarity index 100% rename from src/component/error_handling.ts rename to src/runtime/error_handling.ts diff --git a/src/component/fibers.ts b/src/runtime/fibers.ts similarity index 99% rename from src/component/fibers.ts rename to src/runtime/fibers.ts index 744baa60..98e1f33c 100644 --- a/src/component/fibers.ts +++ b/src/runtime/fibers.ts @@ -1,4 +1,4 @@ -import { BDom, mount } from "../blockdom"; +import { BDom, mount } from "./blockdom"; import type { ComponentNode } from "./component_node"; import { fibersInError, handleError } from "./error_handling"; import { STATUS } from "./status"; diff --git a/src/component/handler.ts b/src/runtime/handler.ts similarity index 95% rename from src/component/handler.ts rename to src/runtime/handler.ts index 35aece9d..5d001b3d 100644 --- a/src/component/handler.ts +++ b/src/runtime/handler.ts @@ -1,4 +1,4 @@ -import { filterOutModifiersFromData } from "../blockdom/config"; +import { filterOutModifiersFromData } from "./blockdom/config"; import { STATUS } from "./status"; export const mainEventHandler = (data: any, ev: Event, currentTarget?: EventTarget | null) => { diff --git a/src/hooks.ts b/src/runtime/hooks.ts similarity index 96% rename from src/hooks.ts rename to src/runtime/hooks.ts index 231f3ff5..9d3b54bd 100644 --- a/src/hooks.ts +++ b/src/runtime/hooks.ts @@ -1,6 +1,6 @@ -import type { Env } from "./app/app"; -import { getCurrent } from "./component/component_node"; -import { onMounted, onPatched, onWillUnmount } from "./component/lifecycle_hooks"; +import type { Env } from "./app"; +import { getCurrent } from "./component_node"; +import { onMounted, onPatched, onWillUnmount } from "./lifecycle_hooks"; // ----------------------------------------------------------------------------- // useRef diff --git a/src/index.runtime.ts b/src/runtime/index.ts similarity index 73% rename from src/index.runtime.ts rename to src/runtime/index.ts index 2f260fc5..40cac53d 100644 --- a/src/index.runtime.ts +++ b/src/runtime/index.ts @@ -11,7 +11,7 @@ import { toggler, comment, } from "./blockdom"; -import { mainEventHandler } from "./component/handler"; +import { mainEventHandler } from "./handler"; export type { Reactive } from "./reactivity"; config.shouldNormalizeDom = false; @@ -33,11 +33,11 @@ export const blockDom = { comment, }; -export { App, mount } from "./app/app"; -export { xml } from "./app/template_set"; -export { Component } from "./component/component"; -export { useComponent, useState } from "./component/component_node"; -export { status } from "./component/status"; +export { App, mount } from "./app"; +export { xml } from "./template_set"; +export { Component } from "./component"; +export { useComponent, useState } from "./component_node"; +export { status } from "./status"; export { reactive, markRaw, toRaw } from "./reactivity"; export { useEffect, useEnv, useExternalListener, useRef, useChildSubEnv, useSubEnv } from "./hooks"; export { EventBus, whenReady, loadFile, markup } from "./utils"; @@ -52,7 +52,7 @@ export { onRendered, onWillDestroy, onError, -} from "./component/lifecycle_hooks"; +} from "./lifecycle_hooks"; export { validate } from "./validation"; export const __info__ = {}; diff --git a/src/component/lifecycle_hooks.ts b/src/runtime/lifecycle_hooks.ts similarity index 100% rename from src/component/lifecycle_hooks.ts rename to src/runtime/lifecycle_hooks.ts diff --git a/src/portal.ts b/src/runtime/portal.ts similarity index 94% rename from src/portal.ts rename to src/runtime/portal.ts index 64389ff8..bb483b7f 100644 --- a/src/portal.ts +++ b/src/runtime/portal.ts @@ -1,6 +1,6 @@ -import { onWillUnmount } from "./component/lifecycle_hooks"; +import { onWillUnmount } from "./lifecycle_hooks"; import { BDom, text, VNode } from "./blockdom"; -import { Component } from "./component/component"; +import { Component } from "./component"; const VText: any = text("").constructor; diff --git a/src/reactivity.ts b/src/runtime/reactivity.ts similarity index 100% rename from src/reactivity.ts rename to src/runtime/reactivity.ts diff --git a/src/component/scheduler.ts b/src/runtime/scheduler.ts similarity index 100% rename from src/component/scheduler.ts rename to src/runtime/scheduler.ts diff --git a/src/component/status.ts b/src/runtime/status.ts similarity index 100% rename from src/component/status.ts rename to src/runtime/status.ts diff --git a/src/app/template_helpers.ts b/src/runtime/template_helpers.ts similarity index 95% rename from src/app/template_helpers.ts rename to src/runtime/template_helpers.ts index 02933bb0..15c71006 100644 --- a/src/app/template_helpers.ts +++ b/src/runtime/template_helpers.ts @@ -1,9 +1,9 @@ -import { BDom, multi, text, toggler, createCatcher } from "../blockdom"; -import { Markup } from "../utils"; -import { html } from "../blockdom/index"; -import { isOptional, validateSchema } from "../validation"; -import type { ComponentConstructor } from "../component/component"; -import { markRaw } from "../reactivity"; +import { BDom, multi, text, toggler, createCatcher } from "./blockdom"; +import { Markup } from "./utils"; +import { html } from "./blockdom/index"; +import { isOptional, validateSchema } from "./validation"; +import type { ComponentConstructor } from "./component"; +import { markRaw } from "./reactivity"; /** * This file contains utility functions that will be injected in each template, diff --git a/src/app/template_set.ts b/src/runtime/template_set.ts similarity index 97% rename from src/app/template_set.ts rename to src/runtime/template_set.ts index abf39c4d..9a7e88ba 100644 --- a/src/app/template_set.ts +++ b/src/runtime/template_set.ts @@ -1,7 +1,7 @@ -import { createBlock, html, list, multi, text, toggler, comment } from "../blockdom"; +import { createBlock, html, list, multi, text, toggler, comment } from "./blockdom"; import { compile, Template, TemplateFunction } from "../compiler"; -import { Portal, portalTemplate } from "../portal"; -import { component, getCurrent } from "../component/component_node"; +import { Portal, portalTemplate } from "./portal"; +import { component, getCurrent } from "./component_node"; import { helpers } from "./template_helpers"; const bdom = { text, createBlock, list, multi, html, toggler, component, comment }; diff --git a/src/utils.ts b/src/runtime/utils.ts similarity index 100% rename from src/utils.ts rename to src/runtime/utils.ts diff --git a/src/validation.ts b/src/runtime/validation.ts similarity index 100% rename from src/validation.ts rename to src/runtime/validation.ts diff --git a/tests/app/app.test.ts b/tests/app/app.test.ts index d7701e9c..0111d2c5 100644 --- a/tests/app/app.test.ts +++ b/tests/app/app.test.ts @@ -1,5 +1,5 @@ import { App, Component, mount, xml } from "../../src"; -import { status } from "../../src/component/status"; +import { status } from "../../src/runtime/status"; import { makeTestFixture, snapshotEverything, nextTick, elem } from "../helpers"; let fixture: HTMLElement; diff --git a/tests/blockdom/block.test.ts b/tests/blockdom/block.test.ts index cd385ae8..0576efa5 100644 --- a/tests/blockdom/block.test.ts +++ b/tests/blockdom/block.test.ts @@ -1,4 +1,4 @@ -import { createBlock, mount, patch, remove, text } from "../../src/blockdom"; +import { createBlock, mount, patch, remove, text } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/block_attributes.test.ts b/tests/blockdom/block_attributes.test.ts index eb468c84..20d56187 100644 --- a/tests/blockdom/block_attributes.test.ts +++ b/tests/blockdom/block_attributes.test.ts @@ -1,4 +1,4 @@ -import { mount, patch, createBlock } from "../../src/blockdom"; +import { mount, patch, createBlock } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/block_event_handling.test.ts b/tests/blockdom/block_event_handling.test.ts index 781356e0..01bad322 100644 --- a/tests/blockdom/block_event_handling.test.ts +++ b/tests/blockdom/block_event_handling.test.ts @@ -1,4 +1,4 @@ -import { mount, createBlock, multi, config, patch } from "../../src/blockdom"; +import { mount, createBlock, multi, config, patch } from "../../src/runtime/blockdom"; // import { defaultHandler, setupMainHandler } from "../../src/bdom/block"; import { makeTestFixture } from "./helpers"; diff --git a/tests/blockdom/block_refs.test.ts b/tests/blockdom/block_refs.test.ts index 1e880c69..3aec3f02 100644 --- a/tests/blockdom/block_refs.test.ts +++ b/tests/blockdom/block_refs.test.ts @@ -1,4 +1,4 @@ -import { createBlock, mount, patch, remove } from "../../src/blockdom"; +import { createBlock, mount, patch, remove } from "../../src/runtime/blockdom"; import { logStep } from "../helpers"; import { makeTestFixture } from "./helpers"; diff --git a/tests/blockdom/comment.test.ts b/tests/blockdom/comment.test.ts index ce0cefe3..86befc36 100644 --- a/tests/blockdom/comment.test.ts +++ b/tests/blockdom/comment.test.ts @@ -1,4 +1,4 @@ -import { comment, mount } from "../../src/blockdom"; +import { comment, mount } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/event_catcher.test.ts b/tests/blockdom/event_catcher.test.ts index 10a84b7e..9bb3bf95 100644 --- a/tests/blockdom/event_catcher.test.ts +++ b/tests/blockdom/event_catcher.test.ts @@ -1,6 +1,6 @@ -import { config, createBlock, createCatcher, mount } from "../../src/blockdom"; +import { config, createBlock, createCatcher, mount } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; -import { mainEventHandler } from "../../src/component/handler"; +import { mainEventHandler } from "../../src/runtime/handler"; //------------------------------------------------------------------------------ // Setup and helpers diff --git a/tests/blockdom/html.test.ts b/tests/blockdom/html.test.ts index 5e398a06..4a4f19bd 100644 --- a/tests/blockdom/html.test.ts +++ b/tests/blockdom/html.test.ts @@ -1,4 +1,4 @@ -import { html, mount, patch, text } from "../../src/blockdom"; +import { html, mount, patch, text } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/list.test.ts b/tests/blockdom/list.test.ts index a341524f..58054bc1 100644 --- a/tests/blockdom/list.test.ts +++ b/tests/blockdom/list.test.ts @@ -1,4 +1,13 @@ -import { list, mount, multi, patch, text, createBlock, VNode, withKey } from "../../src/blockdom"; +import { + list, + mount, + multi, + patch, + text, + createBlock, + VNode, + withKey, +} from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/multi.test.ts b/tests/blockdom/multi.test.ts index c02a889f..c4723f4f 100644 --- a/tests/blockdom/multi.test.ts +++ b/tests/blockdom/multi.test.ts @@ -1,4 +1,4 @@ -import { mount, multi, patch, text, createBlock } from "../../src/blockdom"; +import { mount, multi, patch, text, createBlock } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/namespace.test.ts b/tests/blockdom/namespace.test.ts index 4d2a7d4f..e49d83c6 100644 --- a/tests/blockdom/namespace.test.ts +++ b/tests/blockdom/namespace.test.ts @@ -1,4 +1,4 @@ -import { createBlock, mount } from "../../src/blockdom"; +import { createBlock, mount } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/remove_hook.test.ts b/tests/blockdom/remove_hook.test.ts index 8bde4c83..5834fe14 100644 --- a/tests/blockdom/remove_hook.test.ts +++ b/tests/blockdom/remove_hook.test.ts @@ -1,4 +1,4 @@ -import { createBlock, mount, multi, patch } from "../../src/blockdom"; +import { createBlock, mount, multi, patch } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/text.test.ts b/tests/blockdom/text.test.ts index 55c7ce60..b2a47506 100644 --- a/tests/blockdom/text.test.ts +++ b/tests/blockdom/text.test.ts @@ -1,4 +1,4 @@ -import { mount, patch, remove, text } from "../../src/blockdom"; +import { mount, patch, remove, text } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/blockdom/toggler.test.ts b/tests/blockdom/toggler.test.ts index be411a14..0c537afb 100644 --- a/tests/blockdom/toggler.test.ts +++ b/tests/blockdom/toggler.test.ts @@ -1,4 +1,4 @@ -import { createBlock, mount, patch, text, toggler } from "../../src/blockdom"; +import { createBlock, mount, patch, text, toggler } from "../../src/runtime/blockdom"; import { makeTestFixture } from "./helpers"; //------------------------------------------------------------------------------ diff --git a/tests/compiler/attributes.test.ts b/tests/compiler/attributes.test.ts index bb0673e8..79374134 100644 --- a/tests/compiler/attributes.test.ts +++ b/tests/compiler/attributes.test.ts @@ -1,4 +1,4 @@ -import { mount, patch } from "../../src/blockdom"; +import { mount, patch } from "../../src/runtime/blockdom"; import { makeTestFixture, renderToBdom, renderToString, snapshotEverything } from "../helpers"; snapshotEverything(); diff --git a/tests/compiler/event_handling.test.ts b/tests/compiler/event_handling.test.ts index e363b62d..c79e2d08 100644 --- a/tests/compiler/event_handling.test.ts +++ b/tests/compiler/event_handling.test.ts @@ -1,8 +1,8 @@ -import { TemplateSet } from "../../src/app/template_set"; -import { mount } from "../../src/blockdom"; +import { TemplateSet } from "../../src/runtime/template_set"; +import { mount } from "../../src/runtime/blockdom"; import { makeTestFixture, renderToBdom, renderToString, snapshotEverything } from "../helpers"; -import { markup } from "../../src/utils"; -import { STATUS } from "../../src/component/status"; +import { markup } from "../../src/runtime/utils"; +import { STATUS } from "../../src/runtime/status"; snapshotEverything(); // ----------------------------------------------------------------------------- diff --git a/tests/compiler/svg.test.ts b/tests/compiler/svg.test.ts index cfe190c8..9c5cdad2 100644 --- a/tests/compiler/svg.test.ts +++ b/tests/compiler/svg.test.ts @@ -1,5 +1,5 @@ import { renderToString, renderToBdom, snapshotEverything, makeTestFixture } from "../helpers"; -import { mount } from "../../src/blockdom"; +import { mount } from "../../src/runtime/blockdom"; import { mount as mountComponent, Component, xml } from "../../src/index"; // NB: check the snapshots to see where the SVG namespaces are added diff --git a/tests/compiler/t_esc.test.ts b/tests/compiler/t_esc.test.ts index fdaf570d..0f076fed 100644 --- a/tests/compiler/t_esc.test.ts +++ b/tests/compiler/t_esc.test.ts @@ -1,4 +1,4 @@ -import { mount } from "../../src/blockdom"; +import { mount } from "../../src/runtime/blockdom"; import { makeTestFixture, renderToBdom, diff --git a/tests/compiler/t_foreach.test.ts b/tests/compiler/t_foreach.test.ts index e77acab9..9a5fd992 100644 --- a/tests/compiler/t_foreach.test.ts +++ b/tests/compiler/t_foreach.test.ts @@ -5,7 +5,7 @@ import { TestContext, makeTestFixture, } from "../helpers"; -import { mount, patch } from "../../src/blockdom"; +import { mount, patch } from "../../src/runtime/blockdom"; snapshotEverything(); diff --git a/tests/compiler/t_if.test.ts b/tests/compiler/t_if.test.ts index d5af1a72..a5c34595 100644 --- a/tests/compiler/t_if.test.ts +++ b/tests/compiler/t_if.test.ts @@ -1,5 +1,5 @@ // import { mountBlock } from "../../src/blockdom/block"; -import { mount } from "../../src/blockdom"; +import { mount } from "../../src/runtime/blockdom"; import { makeTestFixture, renderToBdom, renderToString, snapshotEverything } from "../helpers"; snapshotEverything(); diff --git a/tests/compiler/t_key.test.ts b/tests/compiler/t_key.test.ts index 7b13a8a5..596fbf9c 100644 --- a/tests/compiler/t_key.test.ts +++ b/tests/compiler/t_key.test.ts @@ -1,5 +1,5 @@ import { renderToString, renderToBdom, snapshotEverything, makeTestFixture } from "../helpers"; -import { mount, patch } from "../../src/blockdom/index"; +import { mount, patch } from "../../src/runtime/blockdom/index"; snapshotEverything(); diff --git a/tests/compiler/t_out.test.ts b/tests/compiler/t_out.test.ts index a1a44ac9..37c54bfa 100644 --- a/tests/compiler/t_out.test.ts +++ b/tests/compiler/t_out.test.ts @@ -5,9 +5,9 @@ import { TestContext, makeTestFixture, } from "../helpers"; -import { mount, patch } from "../../src/blockdom"; -import { createBlock } from "../../src/blockdom/index"; -import { markup } from "../../src/utils"; +import { mount, patch } from "../../src/runtime/blockdom"; +import { createBlock } from "../../src/runtime/blockdom/index"; +import { markup } from "../../src/runtime/utils"; snapshotEverything(); diff --git a/tests/compiler/t_ref.test.ts b/tests/compiler/t_ref.test.ts index 3ec735d8..cba367f4 100644 --- a/tests/compiler/t_ref.test.ts +++ b/tests/compiler/t_ref.test.ts @@ -1,5 +1,5 @@ -import { TemplateSet } from "../../src/app/template_set"; -import { mount } from "../../src/blockdom"; +import { TemplateSet } from "../../src/runtime/template_set"; +import { mount } from "../../src/runtime/blockdom"; import { renderToBdom, snapshotEverything } from "../helpers"; snapshotEverything(); diff --git a/tests/compiler/t_tag.test.ts b/tests/compiler/t_tag.test.ts index 46955f18..fffd3c91 100644 --- a/tests/compiler/t_tag.test.ts +++ b/tests/compiler/t_tag.test.ts @@ -1,4 +1,4 @@ -import { mount, patch } from "../../src/blockdom"; +import { mount, patch } from "../../src/runtime/blockdom"; import { makeTestFixture, renderToBdom, renderToString, snapshotEverything } from "../helpers"; snapshotEverything(); diff --git a/tests/compiler/validation.test.ts b/tests/compiler/validation.test.ts index 98531121..c57925d4 100644 --- a/tests/compiler/validation.test.ts +++ b/tests/compiler/validation.test.ts @@ -1,4 +1,4 @@ -import { TemplateSet } from "../../src/app/template_set"; +import { TemplateSet } from "../../src/runtime/template_set"; import { renderToString, snapshotTemplate, TestContext } from "../helpers"; // ----------------------------------------------------------------------------- diff --git a/tests/components/basics.test.ts b/tests/components/basics.test.ts index 3d5ccb43..6815b377 100644 --- a/tests/components/basics.test.ts +++ b/tests/components/basics.test.ts @@ -1,6 +1,6 @@ import { App, Component, mount, status, toRaw, useState, xml } from "../../src"; import { elem, makeTestFixture, nextTick, snapshotEverything, useLogLifecycle } from "../helpers"; -import { markup } from "../../src/utils"; +import { markup } from "../../src/runtime/utils"; let fixture: HTMLElement; diff --git a/tests/components/concurrency.test.ts b/tests/components/concurrency.test.ts index 1a152e2b..74031cd7 100644 --- a/tests/components/concurrency.test.ts +++ b/tests/components/concurrency.test.ts @@ -11,9 +11,9 @@ import { useState, xml, } from "../../src"; -import { Fiber } from "../../src/component/fibers"; -import { Scheduler } from "../../src/component/scheduler"; -import { status } from "../../src/component/status"; +import { Fiber } from "../../src/runtime/fibers"; +import { Scheduler } from "../../src/runtime/scheduler"; +import { status } from "../../src/runtime/status"; import { makeDeferred, makeTestFixture, diff --git a/tests/components/lifecycle.test.ts b/tests/components/lifecycle.test.ts index 5b913a6c..aa3f96a3 100644 --- a/tests/components/lifecycle.test.ts +++ b/tests/components/lifecycle.test.ts @@ -7,8 +7,8 @@ import { onWillRender, onWillDestroy, onRendered, -} from "../../src/component/lifecycle_hooks"; -import { status } from "../../src/component/status"; +} from "../../src/runtime/lifecycle_hooks"; +import { status } from "../../src/runtime/status"; import { elem, logStep, diff --git a/tests/components/props_validation.test.ts b/tests/components/props_validation.test.ts index e80a44a6..e118f408 100644 --- a/tests/components/props_validation.test.ts +++ b/tests/components/props_validation.test.ts @@ -1,8 +1,8 @@ import { makeTestFixture, nextTick, snapshotEverything } from "../helpers"; import { Component, onError, xml, mount } from "../../src"; -import { DEV_MSG } from "../../src/app/app"; -import { validateProps } from "../../src/app/template_helpers"; -import { Schema } from "../../src/validation"; +import { DEV_MSG } from "../../src/runtime/app"; +import { validateProps } from "../../src/runtime/template_helpers"; +import { Schema } from "../../src/runtime/validation"; let fixture: HTMLElement; diff --git a/tests/components/t_call_block.test.ts b/tests/components/t_call_block.test.ts index 11e355ba..d9a8e243 100644 --- a/tests/components/t_call_block.test.ts +++ b/tests/components/t_call_block.test.ts @@ -1,4 +1,4 @@ -import { text } from "../../src/blockdom"; +import { text } from "../../src/runtime/blockdom"; import { Component, mount, xml } from "../../src/index"; import { makeTestFixture, snapshotEverything } from "../helpers"; diff --git a/tests/components/t_model.test.ts b/tests/components/t_model.test.ts index a70afcd5..3b22ca2f 100644 --- a/tests/components/t_model.test.ts +++ b/tests/components/t_model.test.ts @@ -1,4 +1,4 @@ -import { Component } from "../../src/component/component"; +import { Component } from "../../src/runtime/component"; import { mount, useState, xml } from "../../src/index"; import { editInput, makeTestFixture, nextTick, snapshotEverything } from "../helpers"; diff --git a/tests/components/t_on.test.ts b/tests/components/t_on.test.ts index 27c3927c..7d692e53 100644 --- a/tests/components/t_on.test.ts +++ b/tests/components/t_on.test.ts @@ -1,6 +1,6 @@ import { Component, mount, onMounted, useState, xml } from "../../src/index"; import { elem, makeTestFixture, nextTick, snapshotEverything } from "../helpers"; -import { status } from "../../src/component/status"; +import { status } from "../../src/runtime/status"; snapshotEverything(); diff --git a/tests/helpers.ts b/tests/helpers.ts index c660861c..9293e5aa 100644 --- a/tests/helpers.ts +++ b/tests/helpers.ts @@ -15,9 +15,9 @@ import { useComponent, xml, } from "../src"; -import { helpers } from "../src/app/template_helpers"; -import { TemplateSet, globalTemplates } from "../src/app/template_set"; -import { BDom } from "../src/blockdom"; +import { helpers } from "../src/runtime/template_helpers"; +import { TemplateSet, globalTemplates } from "../src/runtime/template_set"; +import { BDom } from "../src/runtime/blockdom"; import { compile } from "../src/compiler"; const mount = blockDom.mount; diff --git a/tests/misc/portal.test.ts b/tests/misc/portal.test.ts index dc3ae63e..ba6c7c97 100644 --- a/tests/misc/portal.test.ts +++ b/tests/misc/portal.test.ts @@ -10,7 +10,7 @@ import { useState, } from "../../src"; import { xml } from "../../src/"; -import { DEV_MSG } from "../../src/app/app"; +import { DEV_MSG } from "../../src/runtime/app"; import { elem, makeTestFixture, nextTick, snapshotEverything } from "../helpers"; let fixture: HTMLElement; diff --git a/tests/reactivity.test.ts b/tests/reactivity.test.ts index 8d36d925..751ee5a7 100644 --- a/tests/reactivity.test.ts +++ b/tests/reactivity.test.ts @@ -9,8 +9,8 @@ import { markRaw, toRaw, } from "../src"; -import { reactive, Reactive } from "../src/reactivity"; -import { batched } from "../src/utils"; +import { reactive, Reactive } from "../src/runtime/reactivity"; +import { batched } from "../src/runtime/utils"; import { makeDeferred, makeTestFixture, diff --git a/tests/utils.test.ts b/tests/utils.test.ts index e2a79500..29a109fa 100644 --- a/tests/utils.test.ts +++ b/tests/utils.test.ts @@ -1,4 +1,4 @@ -import { batched, EventBus } from "../src/utils"; +import { batched, EventBus } from "../src/runtime/utils"; import { nextMicroTick } from "./helpers"; describe("event bus behaviour", () => { diff --git a/tests/validation.test.ts b/tests/validation.test.ts index 6aa1bf24..9428375b 100644 --- a/tests/validation.test.ts +++ b/tests/validation.test.ts @@ -1,4 +1,4 @@ -import { Schema, validateSchema } from "../src/validation"; +import { Schema, validateSchema } from "../src/runtime/validation"; describe("validateSchema", () => { test("simple use", () => {