[REF] reorganize file structure

in order to separate compiler/ and runtime/ code
This commit is contained in:
Géry Debongnie
2022-05-26 23:45:40 +02:00
committed by Sam Degueldre
parent e4b810c027
commit 22a79cdedd
68 changed files with 100 additions and 91 deletions
+2 -2
View File
@@ -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";
+2 -2
View File
@@ -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,
+6 -6
View File
@@ -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
@@ -1,4 +1,4 @@
import { Schema } from "../validation";
import { Schema } from "./validation";
import type { ComponentNode } from "./component_node";
// -----------------------------------------------------------------------------
@@ -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";
@@ -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";
@@ -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) => {
+3 -3
View File
@@ -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
@@ -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__ = {};
+2 -2
View File
@@ -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;
@@ -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,
@@ -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 };