From 19d19e68f573bca870fdea3071cde9c9bff1130a Mon Sep 17 00:00:00 2001 From: Christian Mortaro Date: Mon, 20 Mar 2023 21:12:27 -0300 Subject: [PATCH 1/5] :construction: lazy load with swc --- client/client.js | 4 ++++ client/index.js | 1 - client/runtime.js | 3 +++ plugins/routable.js | 6 ++++++ server/registry.js | 4 +++- server/runtime.js | 4 +++- server/server.js | 5 ++++- shared/generateTree.js | 9 ++++++++- tests/src/Application.njs | 34 +++++++++++----------------------- tests/src/LazyComponent.njs | 10 ++++++---- webpack/experiments.js | 2 +- webpack/module.js | 9 +++++++++ 12 files changed, 58 insertions(+), 33 deletions(-) diff --git a/client/client.js b/client/client.js index c45758ab..18c993fa 100644 --- a/client/client.js +++ b/client/client.js @@ -101,4 +101,8 @@ client.processLifecycleQueues = async function processLifecycleQueues() { router._changed = false } +if (module.hot) { + client.klasses = {} +} + export default client diff --git a/client/index.js b/client/index.js index 0f9d22da..60660942 100644 --- a/client/index.js +++ b/client/index.js @@ -14,7 +14,6 @@ import rerender from './rerender' import router from './router' import settings from './settings' import state from './state' -import windowEvent from './windowEvent' import worker from './worker' context.page = page diff --git a/client/runtime.js b/client/runtime.js index 9c61d5d1..8942468e 100644 --- a/client/runtime.js +++ b/client/runtime.js @@ -4,11 +4,13 @@ import invoke from './invoke' import context from './context' import windowEvent from './windowEvent' import client from './client' +import lazy from './lazy' const $runtime = { element, fragment, invoke, + lazy } if (module.hot) { @@ -49,6 +51,7 @@ if (module.hot) { } } } + client.klasses[declaration.klass.hash] = declaration.klass declaration.klass.__hashes = declaration.hashes } windowEvent('environment') diff --git a/plugins/routable.js b/plugins/routable.js index 8fbc2baa..643c29d8 100644 --- a/plugins/routable.js +++ b/plugins/routable.js @@ -15,16 +15,22 @@ function load({ router }) { } function transform({ node, depth, router }) { + // console.log(node) if (!match(node)) return const routeDepth = depth.slice(0, depth.lastIndexOf('-')) if (router._routes[routeDepth] !== undefined) { + // console.log("first") erase(node) } else { + // console.log("else") const params = routeMatches(router.url, node.attributes.route) + // console.log({ params, url: router.url, route: node.attributes.route, routeDepth }) if (params) { + // console.log("params if") router._routes[routeDepth] = true Object.assign(router._segments, params) } else { + // console.log("params else") erase(node) } } diff --git a/server/registry.js b/server/registry.js index 8ec00228..9d19db0c 100644 --- a/server/registry.js +++ b/server/registry.js @@ -3,6 +3,7 @@ export default registry import reqres from "./reqres" import { generateContext } from "./context" import Nullstack from '.' +import { load } from "./lazy" export function register(klass, functionName) { if (functionName) { @@ -27,13 +28,14 @@ function bindStaticProps(klass) { if (!klass[propName]) { klass[propName] = klass[prop] } - function _invoke(...args) { + async function _invoke(...args) { if (underscored) { return klass[propName].call(klass, ...args) } const params = args[0] || {} const { request, response } = reqres const subcontext = generateContext({ request, response, ...params }) + await load(klass.hash) return klass[propName].call(klass, subcontext) } if (module.hot) { diff --git a/server/runtime.js b/server/runtime.js index d527fd69..b0004da8 100644 --- a/server/runtime.js +++ b/server/runtime.js @@ -1,12 +1,14 @@ import element from '../shared/element' import fragment from '../shared/fragment' import { register } from './registry' +import lazy from './lazy' import Nullstack from './index' const $runtime = { element, fragment, - register + register, + lazy } if (module.hot) { diff --git a/server/server.js b/server/server.js index 2f0e35e9..c06044e0 100644 --- a/server/server.js +++ b/server/server.js @@ -17,6 +17,7 @@ import reqres from './reqres' import generateRobots from './robots' import template from './template' import { generateServiceWorker } from './worker' +import { load } from './lazy' const server = express() @@ -124,6 +125,7 @@ server.start = function () { const { hash, methodName } = request.params const [invokerHash, boundHash] = hash.split('-') const key = `${invokerHash}.${methodName}` + await load(boundHash || invokerHash) const invokerKlass = registry[invokerHash] let boundKlass = invokerKlass if (boundHash) { @@ -159,6 +161,7 @@ server.start = function () { const [invokerHash, boundHash] = hash.split('-') const key = `${invokerHash}.${methodName}` let invokerKlass; + await load(boundHash || invokerHash) async function reply() { let boundKlass = invokerKlass if (boundHash) { @@ -189,7 +192,7 @@ server.start = function () { if (invokerKlass.__hashes[methodName] !== version) { setTimeout(() => { delay() - }, 200) + }, 0) } else { reply() } diff --git a/shared/generateTree.js b/shared/generateTree.js index efb59128..2fe2bd56 100644 --- a/shared/generateTree.js +++ b/shared/generateTree.js @@ -27,7 +27,14 @@ async function generateBranch(siblings, node, depth, scope) { if (isClass(node)) { const key = generateKey(scope, node, depth) - const instance = scope.instances[key] || new node.type(scope) + let instance = scope.instances[key] + if (!instance) { + if (module.hot && node.type.hash) { + instance = new scope.klasses[node.type.hash](scope) + } else { + instance = new node.type(scope) + } + } instance.persistent = !!node.attributes.persistent instance.key = key instance._attributes = node.attributes diff --git a/tests/src/Application.njs b/tests/src/Application.njs index b83a28ea..b8310ef2 100644 --- a/tests/src/Application.njs +++ b/tests/src/Application.njs @@ -1,7 +1,6 @@ import Nullstack from 'nullstack' import AnchorModifiers from './AnchorModifiers' -import './Application.css' import ArrayAttributes from './ArrayAttributes' import BodyFragment from './BodyFragment' import CatchError from './CatchError' @@ -40,12 +39,12 @@ import PersistentComponent from './PersistentComponent' import PluginAttributes from './PluginAttributes' import PublicServerFunctions from './PublicServerFunctions' import PureComponents from './PureComponents' -import Refs from './Refs' +// import Refs from './Refs' import RenderableComponent from './RenderableComponent' import ReqRes from './ReqRes' import RoutesAndParams from './RoutesAndParams' import RouteScroll from './RouteScroll' -import ServerFunctions from './ServerFunctions' +// import ServerFunctions from './ServerFunctions' import ServerRequestAndResponse from './ServerRequestAndResponse' import StatefulComponent from './StatefulComponent' import StaticThis from './StaticThis' @@ -57,22 +56,15 @@ import UndefinedNodes from './UndefinedNodes' import UnderscoredAttributes from './UnderscoredAttributes' import Vunerability from './Vunerability' import WebpackCustomPlugin from './WebpackCustomPlugin' -import WindowDependency from './WindowDependency' +// import WindowDependency from './WindowDependency' import WorkerVerbs from './WorkerVerbs' -import LazyComponent from './LazyComponent.njs' +import $runtime2 from 'nullstack/runtime' +import './Application.css' -let CachedLazyComponent -function LazyImporter() { - if (!CachedLazyComponent) { - CachedLazyComponent = import('./LazyComponent') - CachedLazyComponent.then((mod) => CachedLazyComponent = mod.default) - return false - } - if (CachedLazyComponent instanceof Promise) { - return false - } - return -} + +// const LazyComponent = $runtime2.lazy(module.hot ? 'src__LazyComponent__njs' : 'ef60d95e', () => import('./LazyComponent')) +const ServerFunctions = $runtime2.lazy('src__ServerFunctions__njs', () => import('./ServerFunctions')) +const Refs = $runtime2.lazy('src__Refs__njs', () => import('./Refs')) class Application extends Nullstack { @@ -80,10 +72,6 @@ class Application extends Nullstack { await instances.instanceable.customMethod() } - static async safelist() { - console.log(LazyComponent) - } - prepare(context) { context.string = 'nullstack' context.refInstanceCount = 0 @@ -91,7 +79,7 @@ class Application extends Nullstack { render({ project, page, environment, refInstanceCount }) { return ( - +

{project.name}

{page.status !== 200 &&
}
@@ -107,7 +95,7 @@ class Application extends Nullstack { error-on-child-node?serialization=true #bottom
- + {/* */} diff --git a/tests/src/LazyComponent.njs b/tests/src/LazyComponent.njs index 8d40289a..62b6605c 100644 --- a/tests/src/LazyComponent.njs +++ b/tests/src/LazyComponent.njs @@ -4,17 +4,19 @@ import './LazyComponent.css' class LazyComponent extends Nullstack { static async serverFunctionWorks() { - return 1 + return true } async initiate() { this.safelisted = await this.serverFunctionWorks() } - render() { + render({ prop }) { return ( -
- LazyComponent: {this.safelisted}!!! +
+

safelisted: {this.safelisted}

+

prop: {prop}

+ home
) } diff --git a/webpack/experiments.js b/webpack/experiments.js index 8732bde1..1762de2e 100644 --- a/webpack/experiments.js +++ b/webpack/experiments.js @@ -1,5 +1,5 @@ function experiments(options) { - if (options.environment !== 'development') return false + if (options.environment !== 'development') return return { lazyCompilation: { entries: false, diff --git a/webpack/module.js b/webpack/module.js index 7e50d631..80acca94 100644 --- a/webpack/module.js +++ b/webpack/module.js @@ -162,10 +162,19 @@ function runtime(options) { } } +function debug(options) { + if (options.environment !== 'server') return + return { + test: /\.(nts|tsx|njs|jsx)$/, + loader: path.posix.join(options.configFolder, 'loaders', 'debug.js'), + } +} + function rules(options) { return [ css(options), scss(options), + debug(options), js(options), ts(options), njs(options), From 8c150835b1f8a23ca4204a0332acb9f40104ee69 Mon Sep 17 00:00:00 2001 From: Christian Mortaro Date: Mon, 20 Mar 2023 21:46:09 -0300 Subject: [PATCH 2/5] :construction: lazy files --- client/lazy.js | 7 +++++++ loaders/debug.js | 7 +++++++ server/lazy.js | 18 ++++++++++++++++++ shared/lazyComponent.js | 25 +++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 client/lazy.js create mode 100644 loaders/debug.js create mode 100644 server/lazy.js create mode 100644 shared/lazyComponent.js diff --git a/client/lazy.js b/client/lazy.js new file mode 100644 index 00000000..7efe386a --- /dev/null +++ b/client/lazy.js @@ -0,0 +1,7 @@ +import LazyComponent from "../shared/lazyComponent" + +export default function lazy(_hash, importer) { + return class extends LazyComponent { + importer = importer + } +} \ No newline at end of file diff --git a/loaders/debug.js b/loaders/debug.js new file mode 100644 index 00000000..72c6ec6f --- /dev/null +++ b/loaders/debug.js @@ -0,0 +1,7 @@ +module.exports = function (source, map) { + if (this.resourcePath.includes('Application.njs')) { + console.log("DEBUG") + require('fs').writeFileSync('debug.njs', source) + } + this.callback(null, source, map) +} \ No newline at end of file diff --git a/server/lazy.js b/server/lazy.js new file mode 100644 index 00000000..49d6510d --- /dev/null +++ b/server/lazy.js @@ -0,0 +1,18 @@ +import LazyComponent from "../shared/lazyComponent" + +const queue = {} + +export default function lazy(hash, importer) { + queue[hash] = importer + return class extends LazyComponent { + importer = importer + } +} + +export async function load(hash) { + const fileHash = module.hot ? hash.split('___')[0] : hash.slice(0, 8) + if (!queue[fileHash]) return + const importer = queue[fileHash] + delete queue[fileHash] + return importer() +} \ No newline at end of file diff --git a/shared/lazyComponent.js b/shared/lazyComponent.js new file mode 100644 index 00000000..e0a95621 --- /dev/null +++ b/shared/lazyComponent.js @@ -0,0 +1,25 @@ +import element from './element' + +class LazyComponent { + + constructor(scope) { + this.server = scope.context.server + } + + async initiate() { + this.component = (await this.importer()).default + } + + render() { + if (!this.component) return false + const { key, ...attributes } = this._attributes + return element(this.component, attributes) + } + + toJSON() { + return null + } + +} + +export default LazyComponent \ No newline at end of file From d69cdbb43b97ea6e2d8539c72283b58ed2dd9066 Mon Sep 17 00:00:00 2001 From: Christian Mortaro Date: Tue, 21 Mar 2023 22:41:24 -0300 Subject: [PATCH 3/5] :construction: lazy debug --- tests/debug.njs | 723 ++++++++++++++++++++++++++++++++++++++ tests/src/Application.njs | 14 +- webpack/module.js | 2 +- 3 files changed, 727 insertions(+), 12 deletions(-) create mode 100644 tests/debug.njs diff --git a/tests/debug.njs b/tests/debug.njs new file mode 100644 index 00000000..c850e4c7 --- /dev/null +++ b/tests/debug.njs @@ -0,0 +1,723 @@ +import $runtime from "nullstack/runtime"; +import Nullstack from "nullstack"; +const AnchorModifiers = $runtime.lazy("src__AnchorModifiers", ()=>import("./AnchorModifiers")); +const ArrayAttributes = $runtime.lazy("src__ArrayAttributes", ()=>import("./ArrayAttributes")); +const BodyFragment = $runtime.lazy("src__BodyFragment", ()=>import("./BodyFragment")); +const CatchError = $runtime.lazy("src__CatchError", ()=>import("./CatchError")); +const ChildComponent = $runtime.lazy("src__ChildComponent", ()=>import("./ChildComponent")); +const ComponentTernary = $runtime.lazy("src__ComponentTernary", ()=>import("./ComponentTernary")); +const Context = $runtime.lazy("src__Context", ()=>import("./Context")); +const ContextData = $runtime.lazy("src__ContextData", ()=>import("./ContextData")); +const ContextEnvironment = $runtime.lazy("src__ContextEnvironment", ()=>import("./ContextEnvironment")); +const ContextPage = $runtime.lazy("src__ContextPage", ()=>import("./ContextPage")); +const ContextProject = $runtime.lazy("src__ContextProject", ()=>import("./ContextProject")); +const ContextSecrets = $runtime.lazy("src__ContextSecrets", ()=>import("./ContextSecrets")); +const ContextSettings = $runtime.lazy("src__ContextSettings", ()=>import("./ContextSettings")); +const ContextWorker = $runtime.lazy("src__ContextWorker", ()=>import("./ContextWorker")); +const DateParser = $runtime.lazy("src__DateParser", ()=>import("./DateParser")); +const DynamicHead = $runtime.lazy("src__DynamicHead", ()=>import("./DynamicHead")); +const Element = $runtime.lazy("src__Element", ()=>import("./Element")); +const ErrorOnChildNode = $runtime.lazy("src__ErrorOnChildNode", ()=>import("./ErrorOnChildNode")); +const ErrorPage = $runtime.lazy("src__ErrorPage", ()=>import("./ErrorPage")); +const ExposedServerFunctions = $runtime.lazy("src__ExposedServerFunctions", ()=>import("./ExposedServerFunctions")); +const ExternalServerFunctions = $runtime.lazy("src__ExternalServerFunctions", ()=>import("./ExternalServerFunctions")); +const FalsyNodes = $runtime.lazy("src__FalsyNodes", ()=>import("./FalsyNodes")); +const FullStackLifecycle = $runtime.lazy("src__FullStackLifecycle", ()=>import("./FullStackLifecycle")); +const Instanceable = $runtime.lazy("src__Instanceable", ()=>import("./Instanceable")); +const InstanceKey = $runtime.lazy("src__InstanceKey", ()=>import("./InstanceKey")); +const InstanceSelf = $runtime.lazy("src__InstanceSelf", ()=>import("./InstanceSelf")); +const IsomorphicImport = $runtime.lazy("src__IsomorphicImport", ()=>import("./IsomorphicImport")); +const IsomorphicStartup = $runtime.lazy("src__IsomorphicStartup", ()=>import("./IsomorphicStartup")); +const JavaScriptExtension = $runtime.lazy("src__JavaScriptExtension", ()=>import("./JavaScriptExtension")); +const Logo = $runtime.lazy("src__Logo", ()=>import("./Logo")); +const MetatagState = $runtime.lazy("src__MetatagState", ()=>import("./MetatagState")); +const NestedProxy = $runtime.lazy("src__NestedProxy", ()=>import("./NestedProxy")); +const OptimizedEvents = $runtime.lazy("src__OptimizedEvents", ()=>import("./OptimizedEvents")); +const ParentComponent = $runtime.lazy("src__ParentComponent", ()=>import("./ParentComponent")); +const PersistentComponent = $runtime.lazy("src__PersistentComponent", ()=>import("./PersistentComponent")); +const PluginAttributes = $runtime.lazy("src__PluginAttributes", ()=>import("./PluginAttributes")); +const PublicServerFunctions = $runtime.lazy("src__PublicServerFunctions", ()=>import("./PublicServerFunctions")); +const PureComponents = $runtime.lazy("src__PureComponents", ()=>import("./PureComponents")); +const Refs = $runtime.lazy("src__Refs", ()=>import("./Refs")); +const RenderableComponent = $runtime.lazy("src__RenderableComponent", ()=>import("./RenderableComponent")); +const ReqRes = $runtime.lazy("src__ReqRes", ()=>import("./ReqRes")); +const RoutesAndParams = $runtime.lazy("src__RoutesAndParams", ()=>import("./RoutesAndParams")); +const RouteScroll = $runtime.lazy("src__RouteScroll", ()=>import("./RouteScroll")); +const ServerFunctions = $runtime.lazy("src__ServerFunctions", ()=>import("./ServerFunctions")); +const ServerRequestAndResponse = $runtime.lazy("src__ServerRequestAndResponse", ()=>import("./ServerRequestAndResponse")); +const StatefulComponent = $runtime.lazy("src__StatefulComponent", ()=>import("./StatefulComponent")); +const StaticThis = $runtime.lazy("src__StaticThis", ()=>import("./StaticThis")); +const TextObserver = $runtime.lazy("src__TextObserver", ()=>import("./TextObserver")); +const TwoWayBindings = $runtime.lazy("src__TwoWayBindings", ()=>import("./TwoWayBindings")); +const TypeScript = $runtime.lazy("src__TypeScript", ()=>import("./TypeScript")); +const TypeScriptExtension = $runtime.lazy("src__TypeScriptExtension", ()=>import("./TypeScriptExtension")); +const UndefinedNodes = $runtime.lazy("src__UndefinedNodes", ()=>import("./UndefinedNodes")); +const UnderscoredAttributes = $runtime.lazy("src__UnderscoredAttributes", ()=>import("./UnderscoredAttributes")); +const Vunerability = $runtime.lazy("src__Vunerability", ()=>import("./Vunerability")); +const WebpackCustomPlugin = $runtime.lazy("src__WebpackCustomPlugin", ()=>import("./WebpackCustomPlugin")); +const WorkerVerbs = $runtime.lazy("src__WorkerVerbs", ()=>import("./WorkerVerbs")); +class Application extends Nullstack { + static hash = "src__Application___Application"; + async changeInstanceable({ instances }) { + await instances.instanceable.customMethod(); + } + prepare(context) { + context.string = "nullstack"; + context.refInstanceCount = 0; + } + render({ project , page , environment , refInstanceCount }) { + const LazyComponent = this/*#__PURE__*/ .renderLazyComponent; + return /*#__PURE__*/ $runtime.element("body", { + "data-application-hydrated": this.hydrated, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 74, + columnNumber: 7 + }, + __self: this + }, /*#__PURE__*/ $runtime.element("h1", { + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 75, + columnNumber: 9 + }, + __self: this + }, " ", project.name, " "), page.status !== 200 && /*#__PURE__*/ $runtime.element("div", { + route: "*", + "data-page-status": page.status, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 76, + columnNumber: 33 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + route: "/", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 77, + columnNumber: 9 + }, + __self: this + }, /*#__PURE__*/ $runtime.element("a", { + href: "/lazy-component", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 78, + columnNumber: 11 + }, + __self: this + }, " go lazy go home "), /*#__PURE__*/ $runtime.element("a", { + href: "/lazy-importer", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 79, + columnNumber: 11 + }, + __self: this + }, " import "), /*#__PURE__*/ $runtime.element("a", { + href: `/nullstack/${environment.key}/offline`, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 80, + columnNumber: 11 + }, + __self: this + }, " offline "), /*#__PURE__*/ $runtime.element("a", { + href: "/static-this", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 81, + columnNumber: 11 + }, + __self: this + }, " static this "), /*#__PURE__*/ $runtime.element("a", { + href: "/routes-and-params/a", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 82, + columnNumber: 11 + }, + __self: this + }, " router with params "), /*#__PURE__*/ $runtime.element("a", { + href: "/undefined-nodes", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 83, + columnNumber: 11 + }, + __self: this + }, " undefined nodes "), /*#__PURE__*/ $runtime.element("a", { + href: "/full-stack-lifecycle", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 84, + columnNumber: 11 + }, + __self: this + }, " lifecycle "), /*#__PURE__*/ $runtime.element("a", { + href: "/refs", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 85, + columnNumber: 11 + }, + __self: this + }, " refs "), /*#__PURE__*/ $runtime.element("a", { + href: "/error-on-child-node?dom=true", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 86, + columnNumber: 11 + }, + __self: this + }, " error-on-child-node?dom=true "), /*#__PURE__*/ $runtime.element("a", { + href: "/error-on-child-node?serialization=true", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 87, + columnNumber: 11 + }, + __self: this + }, " error-on-child-node?serialization=true "), /*#__PURE__*/ $runtime.element("a", { + href: "/route-scroll/class?changed=1#bottom", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 88, + columnNumber: 11 + }, + __self: this + }, "#bottom")), $runtime.element(LazyComponent, { + route: "/lazy-importer", + prop: "works", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 90, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(RenderableComponent, { + route: "/renderable-component", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 91, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(StatefulComponent, { + route: "/stateful-component", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 92, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(FullStackLifecycle, { + route: "/full-stack-lifecycle", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 93, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(InstanceSelf, { + route: "/instance-self", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 94, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ContextProject, { + route: "/context-project", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 95, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ServerFunctions, { + route: "/server-functions", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 96, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(Context, { + route: "/context", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 97, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ContextSecrets, { + route: "/context-secrets", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 98, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ContextSettings, { + route: "/context-settings", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 99, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ContextEnvironment, { + route: "/context-environment", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 100, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ContextWorker, { + route: "/context-worker", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 101, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(InstanceKey, { + route: "/instance-key", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 102, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(RoutesAndParams, { + route: "/routes-and-params/*", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 103, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ContextPage, { + route: "/context-page", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 104, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(TwoWayBindings, { + route: "/two-way-bindings", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 105, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ServerRequestAndResponse, { + route: "/server-request-and-response", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 106, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ContextData, { + route: "/context-data", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 107, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(DateParser, { + route: "/date-parser", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 108, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(StaticThis, { + route: "/static-this", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 109, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ChildComponent, { + route: "/child-component", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 110, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ParentComponent, { + route: "/parent-component", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 111, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(Element, { + route: "/element", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 112, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(PluginAttributes, { + route: "/plugin-attributes", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 113, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(PureComponents, { + route: "/pure-components", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 114, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(Instanceable, { + route: "/instanceable", + key: "instanceable", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 115, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(NestedProxy, { + route: "/nested-proxy", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 116, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(FalsyNodes, { + route: "/falsy-nodes", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 117, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ErrorOnChildNode, { + route: "/error-on-child-node", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 118, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(Vunerability, { + route: "/vunerability", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 119, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(UnderscoredAttributes, { + route: "/underscored-attributes", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 120, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(PersistentComponent, { + route: "/persistent-component/:id", + persistent: true, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 121, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(IsomorphicStartup, { + route: "/isomorphic-startup", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 122, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(WorkerVerbs, { + route: "/worker-verbs", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 123, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(TypeScript, { + route: "/typescript", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 124, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(PublicServerFunctions, { + key: "publicServerFunctions", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 126, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ExternalServerFunctions, { + route: "/external-server-functions", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 127, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(UndefinedNodes, { + route: "/undefined-nodes", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 128, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(WebpackCustomPlugin, { + route: "/webpack-custom-plugin", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 129, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ComponentTernary, { + route: "/component-ternary", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 130, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(AnchorModifiers, { + route: "/anchor-modifiers", + key: "anchorModifiers", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 131, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(MetatagState, { + route: "/metatag-state", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 132, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(JavaScriptExtension, { + route: "/javascript-extension", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 133, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(TypeScriptExtension, { + route: "/typescript-extension", + generic: true, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 134, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(Refs, { + route: "/refs", + key: `refs${refInstanceCount}`, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 135, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(OptimizedEvents, { + route: "/optimized-events", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 136, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(DynamicHead, { + route: "/dynamic-head", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 137, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(TextObserver, { + route: "/text-observer", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 138, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(BodyFragment, { + route: "/body-fragment", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 139, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ArrayAttributes, { + route: "/array-attributes", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 140, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(RouteScroll, { + route: "/route-scroll/*", + key: "routeScroll", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 141, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(IsomorphicImport, { + route: "/isomorphic-import", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 142, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ExposedServerFunctions, { + route: "/exposed-server-functions", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 143, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(CatchError, { + route: "/catch-error", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 144, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ReqRes, { + route: "/reqres", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 145, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(Logo, { + route: "/logo", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 146, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element(ErrorPage, { + route: "*", + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", + lineNumber: 147, + columnNumber: 9 + }, + __self: this + })); + } +} +export default Application; +$runtime.accept(module, "src\\Application.njs", [ + "nullstack/runtime", + "nullstack", + "./AnchorModifiers", + "./ArrayAttributes", + "./BodyFragment", + "./CatchError", + "./ChildComponent", + "./ComponentTernary", + "./Context", + "./ContextData", + "./ContextEnvironment", + "./ContextPage", + "./ContextProject", + "./ContextSecrets", + "./ContextSettings", + "./ContextWorker", + "./DateParser", + "./DynamicHead", + "./Element", + "./ErrorOnChildNode", + "./ErrorPage", + "./ExposedServerFunctions", + "./ExternalServerFunctions", + "./FalsyNodes", + "./FullStackLifecycle", + "./Instanceable", + "./InstanceKey", + "./InstanceSelf", + "./IsomorphicImport", + "./IsomorphicStartup", + "./JavaScriptExtension", + "./Logo", + "./MetatagState", + "./NestedProxy", + "./OptimizedEvents", + "./ParentComponent", + "./PersistentComponent", + "./PluginAttributes", + "./PublicServerFunctions", + "./PureComponents", + "./Refs", + "./RenderableComponent", + "./ReqRes", + "./RoutesAndParams", + "./RouteScroll", + "./ServerFunctions", + "./ServerRequestAndResponse", + "./StatefulComponent", + "./StaticThis", + "./TextObserver", + "./TwoWayBindings", + "./TypeScript", + "./TypeScriptExtension", + "./UndefinedNodes", + "./UnderscoredAttributes", + "./Vunerability", + "./WebpackCustomPlugin", + "./WorkerVerbs", + "./Application.css" +], [ + { + klass: Application, + initiate: [], + hashes: {} + } +]); diff --git a/tests/src/Application.njs b/tests/src/Application.njs index b8310ef2..ba543d1f 100644 --- a/tests/src/Application.njs +++ b/tests/src/Application.njs @@ -29,7 +29,6 @@ import InstanceSelf from './InstanceSelf' import IsomorphicImport from './IsomorphicImport' import IsomorphicStartup from './IsomorphicStartup' import JavaScriptExtension from './JavaScriptExtension' -// import LazyComponentLoader from './LazyComponentLoader' import Logo from './Logo' import MetatagState from './MetatagState' import NestedProxy from './NestedProxy' @@ -39,12 +38,12 @@ import PersistentComponent from './PersistentComponent' import PluginAttributes from './PluginAttributes' import PublicServerFunctions from './PublicServerFunctions' import PureComponents from './PureComponents' -// import Refs from './Refs' +import Refs from './Refs' import RenderableComponent from './RenderableComponent' import ReqRes from './ReqRes' import RoutesAndParams from './RoutesAndParams' import RouteScroll from './RouteScroll' -// import ServerFunctions from './ServerFunctions' +import ServerFunctions from './ServerFunctions' import ServerRequestAndResponse from './ServerRequestAndResponse' import StatefulComponent from './StatefulComponent' import StaticThis from './StaticThis' @@ -56,16 +55,9 @@ import UndefinedNodes from './UndefinedNodes' import UnderscoredAttributes from './UnderscoredAttributes' import Vunerability from './Vunerability' import WebpackCustomPlugin from './WebpackCustomPlugin' -// import WindowDependency from './WindowDependency' import WorkerVerbs from './WorkerVerbs' -import $runtime2 from 'nullstack/runtime' import './Application.css' - -// const LazyComponent = $runtime2.lazy(module.hot ? 'src__LazyComponent__njs' : 'ef60d95e', () => import('./LazyComponent')) -const ServerFunctions = $runtime2.lazy('src__ServerFunctions__njs', () => import('./ServerFunctions')) -const Refs = $runtime2.lazy('src__Refs__njs', () => import('./Refs')) - class Application extends Nullstack { async changeInstanceable({ instances }) { @@ -95,7 +87,7 @@ class Application extends Nullstack { error-on-child-node?serialization=true #bottom
- {/* */} + diff --git a/webpack/module.js b/webpack/module.js index 80acca94..c5532fcd 100644 --- a/webpack/module.js +++ b/webpack/module.js @@ -163,7 +163,7 @@ function runtime(options) { } function debug(options) { - if (options.environment !== 'server') return + if (options.target !== 'server') return return { test: /\.(nts|tsx|njs|jsx)$/, loader: path.posix.join(options.configFolder, 'loaders', 'debug.js'), From 71fc7892f0b6fd9f73ad81b0aeb068b5d4c304aa Mon Sep 17 00:00:00 2001 From: Christian Mortaro Date: Wed, 22 Mar 2023 10:56:57 -0300 Subject: [PATCH 4/5] :recycle: cleanup --- loaders/debug.js | 1 - plugins/routable.js | 6 - tests/debug.njs | 772 ++++++------------------------ tests/src/Application.njs | 8 +- tests/src/Application.test.js | 5 - tests/src/BodyFragment.test.js | 4 +- tests/src/WindowDependency.js | 3 - tests/src/nested/NestedFolder.njs | 17 + 8 files changed, 164 insertions(+), 652 deletions(-) delete mode 100644 tests/src/WindowDependency.js create mode 100644 tests/src/nested/NestedFolder.njs diff --git a/loaders/debug.js b/loaders/debug.js index 72c6ec6f..ffafef57 100644 --- a/loaders/debug.js +++ b/loaders/debug.js @@ -1,6 +1,5 @@ module.exports = function (source, map) { if (this.resourcePath.includes('Application.njs')) { - console.log("DEBUG") require('fs').writeFileSync('debug.njs', source) } this.callback(null, source, map) diff --git a/plugins/routable.js b/plugins/routable.js index 643c29d8..8fbc2baa 100644 --- a/plugins/routable.js +++ b/plugins/routable.js @@ -15,22 +15,16 @@ function load({ router }) { } function transform({ node, depth, router }) { - // console.log(node) if (!match(node)) return const routeDepth = depth.slice(0, depth.lastIndexOf('-')) if (router._routes[routeDepth] !== undefined) { - // console.log("first") erase(node) } else { - // console.log("else") const params = routeMatches(router.url, node.attributes.route) - // console.log({ params, url: router.url, route: node.attributes.route, routeDepth }) if (params) { - // console.log("params if") router._routes[routeDepth] = true Object.assign(router._segments, params) } else { - // console.log("params else") erase(node) } } diff --git a/tests/debug.njs b/tests/debug.njs index c850e4c7..f77712b3 100644 --- a/tests/debug.njs +++ b/tests/debug.njs @@ -1,63 +1,66 @@ import $runtime from "nullstack/runtime"; import Nullstack from "nullstack"; -const AnchorModifiers = $runtime.lazy("src__AnchorModifiers", ()=>import("./AnchorModifiers")); -const ArrayAttributes = $runtime.lazy("src__ArrayAttributes", ()=>import("./ArrayAttributes")); -const BodyFragment = $runtime.lazy("src__BodyFragment", ()=>import("./BodyFragment")); -const CatchError = $runtime.lazy("src__CatchError", ()=>import("./CatchError")); -const ChildComponent = $runtime.lazy("src__ChildComponent", ()=>import("./ChildComponent")); -const ComponentTernary = $runtime.lazy("src__ComponentTernary", ()=>import("./ComponentTernary")); -const Context = $runtime.lazy("src__Context", ()=>import("./Context")); -const ContextData = $runtime.lazy("src__ContextData", ()=>import("./ContextData")); -const ContextEnvironment = $runtime.lazy("src__ContextEnvironment", ()=>import("./ContextEnvironment")); -const ContextPage = $runtime.lazy("src__ContextPage", ()=>import("./ContextPage")); -const ContextProject = $runtime.lazy("src__ContextProject", ()=>import("./ContextProject")); -const ContextSecrets = $runtime.lazy("src__ContextSecrets", ()=>import("./ContextSecrets")); -const ContextSettings = $runtime.lazy("src__ContextSettings", ()=>import("./ContextSettings")); -const ContextWorker = $runtime.lazy("src__ContextWorker", ()=>import("./ContextWorker")); -const DateParser = $runtime.lazy("src__DateParser", ()=>import("./DateParser")); -const DynamicHead = $runtime.lazy("src__DynamicHead", ()=>import("./DynamicHead")); -const Element = $runtime.lazy("src__Element", ()=>import("./Element")); -const ErrorOnChildNode = $runtime.lazy("src__ErrorOnChildNode", ()=>import("./ErrorOnChildNode")); -const ErrorPage = $runtime.lazy("src__ErrorPage", ()=>import("./ErrorPage")); -const ExposedServerFunctions = $runtime.lazy("src__ExposedServerFunctions", ()=>import("./ExposedServerFunctions")); -const ExternalServerFunctions = $runtime.lazy("src__ExternalServerFunctions", ()=>import("./ExternalServerFunctions")); -const FalsyNodes = $runtime.lazy("src__FalsyNodes", ()=>import("./FalsyNodes")); -const FullStackLifecycle = $runtime.lazy("src__FullStackLifecycle", ()=>import("./FullStackLifecycle")); -const Instanceable = $runtime.lazy("src__Instanceable", ()=>import("./Instanceable")); -const InstanceKey = $runtime.lazy("src__InstanceKey", ()=>import("./InstanceKey")); -const InstanceSelf = $runtime.lazy("src__InstanceSelf", ()=>import("./InstanceSelf")); -const IsomorphicImport = $runtime.lazy("src__IsomorphicImport", ()=>import("./IsomorphicImport")); -const IsomorphicStartup = $runtime.lazy("src__IsomorphicStartup", ()=>import("./IsomorphicStartup")); -const JavaScriptExtension = $runtime.lazy("src__JavaScriptExtension", ()=>import("./JavaScriptExtension")); -const Logo = $runtime.lazy("src__Logo", ()=>import("./Logo")); -const MetatagState = $runtime.lazy("src__MetatagState", ()=>import("./MetatagState")); -const NestedProxy = $runtime.lazy("src__NestedProxy", ()=>import("./NestedProxy")); -const OptimizedEvents = $runtime.lazy("src__OptimizedEvents", ()=>import("./OptimizedEvents")); -const ParentComponent = $runtime.lazy("src__ParentComponent", ()=>import("./ParentComponent")); -const PersistentComponent = $runtime.lazy("src__PersistentComponent", ()=>import("./PersistentComponent")); -const PluginAttributes = $runtime.lazy("src__PluginAttributes", ()=>import("./PluginAttributes")); -const PublicServerFunctions = $runtime.lazy("src__PublicServerFunctions", ()=>import("./PublicServerFunctions")); -const PureComponents = $runtime.lazy("src__PureComponents", ()=>import("./PureComponents")); -const Refs = $runtime.lazy("src__Refs", ()=>import("./Refs")); -const RenderableComponent = $runtime.lazy("src__RenderableComponent", ()=>import("./RenderableComponent")); -const ReqRes = $runtime.lazy("src__ReqRes", ()=>import("./ReqRes")); -const RoutesAndParams = $runtime.lazy("src__RoutesAndParams", ()=>import("./RoutesAndParams")); -const RouteScroll = $runtime.lazy("src__RouteScroll", ()=>import("./RouteScroll")); -const ServerFunctions = $runtime.lazy("src__ServerFunctions", ()=>import("./ServerFunctions")); -const ServerRequestAndResponse = $runtime.lazy("src__ServerRequestAndResponse", ()=>import("./ServerRequestAndResponse")); -const StatefulComponent = $runtime.lazy("src__StatefulComponent", ()=>import("./StatefulComponent")); -const StaticThis = $runtime.lazy("src__StaticThis", ()=>import("./StaticThis")); -const TextObserver = $runtime.lazy("src__TextObserver", ()=>import("./TextObserver")); -const TwoWayBindings = $runtime.lazy("src__TwoWayBindings", ()=>import("./TwoWayBindings")); -const TypeScript = $runtime.lazy("src__TypeScript", ()=>import("./TypeScript")); -const TypeScriptExtension = $runtime.lazy("src__TypeScriptExtension", ()=>import("./TypeScriptExtension")); -const UndefinedNodes = $runtime.lazy("src__UndefinedNodes", ()=>import("./UndefinedNodes")); -const UnderscoredAttributes = $runtime.lazy("src__UnderscoredAttributes", ()=>import("./UnderscoredAttributes")); -const Vunerability = $runtime.lazy("src__Vunerability", ()=>import("./Vunerability")); -const WebpackCustomPlugin = $runtime.lazy("src__WebpackCustomPlugin", ()=>import("./WebpackCustomPlugin")); -const WorkerVerbs = $runtime.lazy("src__WorkerVerbs", ()=>import("./WorkerVerbs")); +import AnchorModifiers from "./AnchorModifiers"; +import ArrayAttributes from "./ArrayAttributes"; +import BodyFragment from "./BodyFragment"; +import CatchError from "./CatchError"; +import ChildComponent from "./ChildComponent"; +import ComponentTernary from "./ComponentTernary"; +import Context from "./Context"; +import ContextData from "./ContextData"; +import ContextEnvironment from "./ContextEnvironment"; +import ContextPage from "./ContextPage"; +import ContextProject from "./ContextProject"; +import ContextSecrets from "./ContextSecrets"; +import ContextSettings from "./ContextSettings"; +import ContextWorker from "./ContextWorker"; +import DateParser from "./DateParser"; +import DynamicHead from "./DynamicHead"; +import Element from "./Element"; +import ErrorOnChildNode from "./ErrorOnChildNode"; +import ErrorPage from "./ErrorPage"; +import ExposedServerFunctions from "./ExposedServerFunctions"; +import ExternalServerFunctions from "./ExternalServerFunctions"; +import FalsyNodes from "./FalsyNodes"; +import FullStackLifecycle from "./FullStackLifecycle"; +import Instanceable from "./Instanceable"; +import InstanceKey from "./InstanceKey"; +import InstanceSelf from "./InstanceSelf"; +import IsomorphicImport from "./IsomorphicImport"; +import IsomorphicStartup from "./IsomorphicStartup"; +import JavaScriptExtension from "./JavaScriptExtension"; +import Logo from "./Logo"; +import MetatagState from "./MetatagState"; +import NestedProxy from "./NestedProxy"; +import OptimizedEvents from "./OptimizedEvents"; +import ParentComponent from "./ParentComponent"; +import PersistentComponent from "./PersistentComponent"; +import PluginAttributes from "./PluginAttributes"; +import PublicServerFunctions from "./PublicServerFunctions"; +import PureComponents from "./PureComponents"; +import Refs from "./Refs"; +import RenderableComponent from "./RenderableComponent"; +import ReqRes from "./ReqRes"; +import RoutesAndParams from "./RoutesAndParams"; +import RouteScroll from "./RouteScroll"; +import ServerFunctions from "./ServerFunctions"; +import ServerRequestAndResponse from "./ServerRequestAndResponse"; +import StatefulComponent from "./StatefulComponent"; +import StaticThis from "./StaticThis"; +import TextObserver from "./TextObserver"; +import TwoWayBindings from "./TwoWayBindings"; +import TypeScript from "./TypeScript"; +import TypeScriptExtension from "./TypeScriptExtension"; +import UndefinedNodes from "./UndefinedNodes"; +import UnderscoredAttributes from "./UnderscoredAttributes"; +import Vunerability from "./Vunerability"; +import WebpackCustomPlugin from "./WebpackCustomPlugin"; +import WorkerVerbs from "./WorkerVerbs"; +import LazyComponent from "./LazyComponent"; +import LazyComponentLoader from "./LazyComponentLoader"; +import NestedFolder from "./nested/NestedFolder.njs"; class Application extends Nullstack { - static hash = "src__Application___Application"; + static hash = "6b94b59a22c75216"; async changeInstanceable({ instances }) { await instances.instanceable.customMethod(); } @@ -66,658 +69,161 @@ class Application extends Nullstack { context.refInstanceCount = 0; } render({ project , page , environment , refInstanceCount }) { - const LazyComponent = this/*#__PURE__*/ .renderLazyComponent; return /*#__PURE__*/ $runtime.element("body", { - "data-application-hydrated": this.hydrated, - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 74, - columnNumber: 7 - }, - __self: this - }, /*#__PURE__*/ $runtime.element("h1", { - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 75, - columnNumber: 9 - }, - __self: this - }, " ", project.name, " "), page.status !== 200 && /*#__PURE__*/ $runtime.element("div", { + "data-application-hydrated": this.hydrated + }, /*#__PURE__*/ $runtime.element("h1", null, " ", project.name, " "), page.status !== 200 && /*#__PURE__*/ $runtime.element("div", { route: "*", - "data-page-status": page.status, - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 76, - columnNumber: 33 - }, - __self: this + "data-page-status": page.status }), /*#__PURE__*/ $runtime.element("div", { - route: "/", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 77, - columnNumber: 9 - }, - __self: this + route: "/" }, /*#__PURE__*/ $runtime.element("a", { - href: "/lazy-component", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 78, - columnNumber: 11 - }, - __self: this + href: "/lazy-component" }, " go lazy go home "), /*#__PURE__*/ $runtime.element("a", { - href: "/lazy-importer", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 79, - columnNumber: 11 - }, - __self: this + href: "/lazy-importer" }, " import "), /*#__PURE__*/ $runtime.element("a", { - href: `/nullstack/${environment.key}/offline`, - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 80, - columnNumber: 11 - }, - __self: this + href: `/nullstack/${environment.key}/offline` }, " offline "), /*#__PURE__*/ $runtime.element("a", { - href: "/static-this", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 81, - columnNumber: 11 - }, - __self: this + href: "/static-this" }, " static this "), /*#__PURE__*/ $runtime.element("a", { - href: "/routes-and-params/a", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 82, - columnNumber: 11 - }, - __self: this + href: "/routes-and-params/a" }, " router with params "), /*#__PURE__*/ $runtime.element("a", { - href: "/undefined-nodes", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 83, - columnNumber: 11 - }, - __self: this + href: "/undefined-nodes" }, " undefined nodes "), /*#__PURE__*/ $runtime.element("a", { - href: "/full-stack-lifecycle", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 84, - columnNumber: 11 - }, - __self: this + href: "/full-stack-lifecycle" }, " lifecycle "), /*#__PURE__*/ $runtime.element("a", { - href: "/refs", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 85, - columnNumber: 11 - }, - __self: this + href: "/refs" }, " refs "), /*#__PURE__*/ $runtime.element("a", { - href: "/error-on-child-node?dom=true", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 86, - columnNumber: 11 - }, - __self: this + href: "/error-on-child-node?dom=true" }, " error-on-child-node?dom=true "), /*#__PURE__*/ $runtime.element("a", { - href: "/error-on-child-node?serialization=true", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 87, - columnNumber: 11 - }, - __self: this + href: "/error-on-child-node?serialization=true" }, " error-on-child-node?serialization=true "), /*#__PURE__*/ $runtime.element("a", { - href: "/route-scroll/class?changed=1#bottom", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 88, - columnNumber: 11 - }, - __self: this - }, "#bottom")), $runtime.element(LazyComponent, { - route: "/lazy-importer", - prop: "works", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 90, - columnNumber: 9 - }, - __self: this - }), /*#__PURE__*/ $runtime.element(RenderableComponent, { - route: "/renderable-component", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 91, - columnNumber: 9 - }, - __self: this + href: "/route-scroll/class?changed=1#bottom" + }, "#bottom")), /*#__PURE__*/ $runtime.element(RenderableComponent, { + route: "/renderable-component" }), /*#__PURE__*/ $runtime.element(StatefulComponent, { - route: "/stateful-component", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 92, - columnNumber: 9 - }, - __self: this + route: "/stateful-component" }), /*#__PURE__*/ $runtime.element(FullStackLifecycle, { - route: "/full-stack-lifecycle", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 93, - columnNumber: 9 - }, - __self: this + route: "/full-stack-lifecycle" }), /*#__PURE__*/ $runtime.element(InstanceSelf, { - route: "/instance-self", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 94, - columnNumber: 9 - }, - __self: this + route: "/instance-self" }), /*#__PURE__*/ $runtime.element(ContextProject, { - route: "/context-project", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 95, - columnNumber: 9 - }, - __self: this + route: "/context-project" }), /*#__PURE__*/ $runtime.element(ServerFunctions, { - route: "/server-functions", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 96, - columnNumber: 9 - }, - __self: this + route: "/server-functions" }), /*#__PURE__*/ $runtime.element(Context, { - route: "/context", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 97, - columnNumber: 9 - }, - __self: this + route: "/context" }), /*#__PURE__*/ $runtime.element(ContextSecrets, { - route: "/context-secrets", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 98, - columnNumber: 9 - }, - __self: this + route: "/context-secrets" }), /*#__PURE__*/ $runtime.element(ContextSettings, { - route: "/context-settings", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 99, - columnNumber: 9 - }, - __self: this + route: "/context-settings" }), /*#__PURE__*/ $runtime.element(ContextEnvironment, { - route: "/context-environment", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 100, - columnNumber: 9 - }, - __self: this + route: "/context-environment" }), /*#__PURE__*/ $runtime.element(ContextWorker, { - route: "/context-worker", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 101, - columnNumber: 9 - }, - __self: this + route: "/context-worker" }), /*#__PURE__*/ $runtime.element(InstanceKey, { - route: "/instance-key", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 102, - columnNumber: 9 - }, - __self: this + route: "/instance-key" }), /*#__PURE__*/ $runtime.element(RoutesAndParams, { - route: "/routes-and-params/*", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 103, - columnNumber: 9 - }, - __self: this + route: "/routes-and-params/*" }), /*#__PURE__*/ $runtime.element(ContextPage, { - route: "/context-page", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 104, - columnNumber: 9 - }, - __self: this + route: "/context-page" }), /*#__PURE__*/ $runtime.element(TwoWayBindings, { - route: "/two-way-bindings", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 105, - columnNumber: 9 - }, - __self: this + route: "/two-way-bindings" }), /*#__PURE__*/ $runtime.element(ServerRequestAndResponse, { - route: "/server-request-and-response", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 106, - columnNumber: 9 - }, - __self: this + route: "/server-request-and-response" }), /*#__PURE__*/ $runtime.element(ContextData, { - route: "/context-data", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 107, - columnNumber: 9 - }, - __self: this + route: "/context-data" }), /*#__PURE__*/ $runtime.element(DateParser, { - route: "/date-parser", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 108, - columnNumber: 9 - }, - __self: this + route: "/date-parser" }), /*#__PURE__*/ $runtime.element(StaticThis, { - route: "/static-this", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 109, - columnNumber: 9 - }, - __self: this + route: "/static-this" }), /*#__PURE__*/ $runtime.element(ChildComponent, { - route: "/child-component", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 110, - columnNumber: 9 - }, - __self: this + route: "/child-component" }), /*#__PURE__*/ $runtime.element(ParentComponent, { - route: "/parent-component", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 111, - columnNumber: 9 - }, - __self: this + route: "/parent-component" }), /*#__PURE__*/ $runtime.element(Element, { - route: "/element", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 112, - columnNumber: 9 - }, - __self: this + route: "/element" }), /*#__PURE__*/ $runtime.element(PluginAttributes, { - route: "/plugin-attributes", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 113, - columnNumber: 9 - }, - __self: this + route: "/plugin-attributes" }), /*#__PURE__*/ $runtime.element(PureComponents, { - route: "/pure-components", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 114, - columnNumber: 9 - }, - __self: this + route: "/pure-components" }), /*#__PURE__*/ $runtime.element(Instanceable, { route: "/instanceable", - key: "instanceable", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 115, - columnNumber: 9 - }, - __self: this + key: "instanceable" }), /*#__PURE__*/ $runtime.element(NestedProxy, { - route: "/nested-proxy", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 116, - columnNumber: 9 - }, - __self: this + route: "/nested-proxy" }), /*#__PURE__*/ $runtime.element(FalsyNodes, { - route: "/falsy-nodes", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 117, - columnNumber: 9 - }, - __self: this + route: "/falsy-nodes" }), /*#__PURE__*/ $runtime.element(ErrorOnChildNode, { - route: "/error-on-child-node", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 118, - columnNumber: 9 - }, - __self: this + route: "/error-on-child-node" }), /*#__PURE__*/ $runtime.element(Vunerability, { - route: "/vunerability", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 119, - columnNumber: 9 - }, - __self: this + route: "/vunerability" }), /*#__PURE__*/ $runtime.element(UnderscoredAttributes, { - route: "/underscored-attributes", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 120, - columnNumber: 9 - }, - __self: this + route: "/underscored-attributes" }), /*#__PURE__*/ $runtime.element(PersistentComponent, { route: "/persistent-component/:id", - persistent: true, - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 121, - columnNumber: 9 - }, - __self: this + persistent: true }), /*#__PURE__*/ $runtime.element(IsomorphicStartup, { - route: "/isomorphic-startup", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 122, - columnNumber: 9 - }, - __self: this + route: "/isomorphic-startup" }), /*#__PURE__*/ $runtime.element(WorkerVerbs, { - route: "/worker-verbs", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 123, - columnNumber: 9 - }, - __self: this + route: "/worker-verbs" }), /*#__PURE__*/ $runtime.element(TypeScript, { - route: "/typescript", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 124, - columnNumber: 9 - }, - __self: this + route: "/typescript" + }), /*#__PURE__*/ $runtime.element(LazyComponentLoader, { + route: "/lazy-component" }), /*#__PURE__*/ $runtime.element(PublicServerFunctions, { - key: "publicServerFunctions", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 126, - columnNumber: 9 - }, - __self: this + key: "publicServerFunctions" }), /*#__PURE__*/ $runtime.element(ExternalServerFunctions, { - route: "/external-server-functions", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 127, - columnNumber: 9 - }, - __self: this + route: "/external-server-functions" }), /*#__PURE__*/ $runtime.element(UndefinedNodes, { - route: "/undefined-nodes", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 128, - columnNumber: 9 - }, - __self: this + route: "/undefined-nodes" }), /*#__PURE__*/ $runtime.element(WebpackCustomPlugin, { - route: "/webpack-custom-plugin", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 129, - columnNumber: 9 - }, - __self: this + route: "/webpack-custom-plugin" }), /*#__PURE__*/ $runtime.element(ComponentTernary, { - route: "/component-ternary", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 130, - columnNumber: 9 - }, - __self: this + route: "/component-ternary" }), /*#__PURE__*/ $runtime.element(AnchorModifiers, { route: "/anchor-modifiers", - key: "anchorModifiers", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 131, - columnNumber: 9 - }, - __self: this + key: "anchorModifiers" }), /*#__PURE__*/ $runtime.element(MetatagState, { - route: "/metatag-state", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 132, - columnNumber: 9 - }, - __self: this + route: "/metatag-state" }), /*#__PURE__*/ $runtime.element(JavaScriptExtension, { - route: "/javascript-extension", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 133, - columnNumber: 9 - }, - __self: this + route: "/javascript-extension" }), /*#__PURE__*/ $runtime.element(TypeScriptExtension, { route: "/typescript-extension", - generic: true, - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 134, - columnNumber: 9 - }, - __self: this + generic: true }), /*#__PURE__*/ $runtime.element(Refs, { route: "/refs", - key: `refs${refInstanceCount}`, - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 135, - columnNumber: 9 - }, - __self: this + key: `refs${refInstanceCount}` }), /*#__PURE__*/ $runtime.element(OptimizedEvents, { - route: "/optimized-events", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 136, - columnNumber: 9 - }, - __self: this + route: "/optimized-events" }), /*#__PURE__*/ $runtime.element(DynamicHead, { - route: "/dynamic-head", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 137, - columnNumber: 9 - }, - __self: this + route: "/dynamic-head" }), /*#__PURE__*/ $runtime.element(TextObserver, { - route: "/text-observer", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 138, - columnNumber: 9 - }, - __self: this + route: "/text-observer" }), /*#__PURE__*/ $runtime.element(BodyFragment, { - route: "/body-fragment", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 139, - columnNumber: 9 - }, - __self: this + route: "/body-fragment" }), /*#__PURE__*/ $runtime.element(ArrayAttributes, { - route: "/array-attributes", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 140, - columnNumber: 9 - }, - __self: this + route: "/array-attributes" }), /*#__PURE__*/ $runtime.element(RouteScroll, { route: "/route-scroll/*", - key: "routeScroll", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 141, - columnNumber: 9 - }, - __self: this + key: "routeScroll" }), /*#__PURE__*/ $runtime.element(IsomorphicImport, { - route: "/isomorphic-import", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 142, - columnNumber: 9 - }, - __self: this + route: "/isomorphic-import" }), /*#__PURE__*/ $runtime.element(ExposedServerFunctions, { - route: "/exposed-server-functions", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 143, - columnNumber: 9 - }, - __self: this + route: "/exposed-server-functions" }), /*#__PURE__*/ $runtime.element(CatchError, { - route: "/catch-error", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 144, - columnNumber: 9 - }, - __self: this + route: "/catch-error" }), /*#__PURE__*/ $runtime.element(ReqRes, { - route: "/reqres", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 145, - columnNumber: 9 - }, - __self: this + route: "/reqres" }), /*#__PURE__*/ $runtime.element(Logo, { - route: "/logo", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 146, - columnNumber: 9 - }, - __self: this + route: "/logo" + }), /*#__PURE__*/ $runtime.element(NestedFolder, { + route: "/nested/folder" + }), /*#__PURE__*/ $runtime.element(LazyComponent, { + route: "/lazy-importer", + prop: "works" }), /*#__PURE__*/ $runtime.element(ErrorPage, { - route: "*", - __source: { - fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\Application.njs", - lineNumber: 147, - columnNumber: 9 - }, - __self: this + route: "*" })); } } export default Application; -$runtime.accept(module, "src\\Application.njs", [ - "nullstack/runtime", - "nullstack", - "./AnchorModifiers", - "./ArrayAttributes", - "./BodyFragment", - "./CatchError", - "./ChildComponent", - "./ComponentTernary", - "./Context", - "./ContextData", - "./ContextEnvironment", - "./ContextPage", - "./ContextProject", - "./ContextSecrets", - "./ContextSettings", - "./ContextWorker", - "./DateParser", - "./DynamicHead", - "./Element", - "./ErrorOnChildNode", - "./ErrorPage", - "./ExposedServerFunctions", - "./ExternalServerFunctions", - "./FalsyNodes", - "./FullStackLifecycle", - "./Instanceable", - "./InstanceKey", - "./InstanceSelf", - "./IsomorphicImport", - "./IsomorphicStartup", - "./JavaScriptExtension", - "./Logo", - "./MetatagState", - "./NestedProxy", - "./OptimizedEvents", - "./ParentComponent", - "./PersistentComponent", - "./PluginAttributes", - "./PublicServerFunctions", - "./PureComponents", - "./Refs", - "./RenderableComponent", - "./ReqRes", - "./RoutesAndParams", - "./RouteScroll", - "./ServerFunctions", - "./ServerRequestAndResponse", - "./StatefulComponent", - "./StaticThis", - "./TextObserver", - "./TwoWayBindings", - "./TypeScript", - "./TypeScriptExtension", - "./UndefinedNodes", - "./UnderscoredAttributes", - "./Vunerability", - "./WebpackCustomPlugin", - "./WorkerVerbs", - "./Application.css" -], [ - { - klass: Application, - initiate: [], - hashes: {} - } -]); diff --git a/tests/src/Application.njs b/tests/src/Application.njs index ba543d1f..30a1a726 100644 --- a/tests/src/Application.njs +++ b/tests/src/Application.njs @@ -56,7 +56,10 @@ import UnderscoredAttributes from './UnderscoredAttributes' import Vunerability from './Vunerability' import WebpackCustomPlugin from './WebpackCustomPlugin' import WorkerVerbs from './WorkerVerbs' +import LazyComponent from './LazyComponent' +import LazyComponentLoader from './LazyComponentLoader' import './Application.css' +import NestedFolder from './nested/NestedFolder.njs' class Application extends Nullstack { @@ -87,7 +90,6 @@ class Application extends Nullstack { error-on-child-node?serialization=true #bottom
- @@ -122,7 +124,7 @@ class Application extends Nullstack { - {/* */} + @@ -144,6 +146,8 @@ class Application extends Nullstack { + + ) diff --git a/tests/src/Application.test.js b/tests/src/Application.test.js index 8a4dd3b4..bb563435 100644 --- a/tests/src/Application.test.js +++ b/tests/src/Application.test.js @@ -15,9 +15,4 @@ describe('Application', () => { const element = await page.$('[rel="stylesheet"]') expect(element).toBeTruthy() }) - - test('simple scripts depending on window should be importable on server', async () => { - const element = await page.$('[data-window="shim"]') - expect(element).toBeTruthy() - }) }) diff --git a/tests/src/BodyFragment.test.js b/tests/src/BodyFragment.test.js index b95624bf..6860906d 100644 --- a/tests/src/BodyFragment.test.js +++ b/tests/src/BodyFragment.test.js @@ -52,9 +52,9 @@ describe('BodyFragment', () => { test('the body removes events when the fragment leaves the tree', async () => { await page.waitForSelector('body[data-hydrated]') await page.click('[href="/"]') - await page.waitForSelector('[data-window="shim"]:not([data-count])') + await page.waitForSelector('[data-application-hydrated]:not([data-count])') await page.click('body') - const element = await page.$('[data-window="shim"]:not([data-count])') + const element = await page.$('[data-application-hydrated]:not([data-count])') expect(element).toBeTruthy() }) }) diff --git a/tests/src/WindowDependency.js b/tests/src/WindowDependency.js deleted file mode 100644 index b1806955..00000000 --- a/tests/src/WindowDependency.js +++ /dev/null @@ -1,3 +0,0 @@ -window.key = 'shim' - -export default window diff --git a/tests/src/nested/NestedFolder.njs b/tests/src/nested/NestedFolder.njs new file mode 100644 index 00000000..fac716cc --- /dev/null +++ b/tests/src/nested/NestedFolder.njs @@ -0,0 +1,17 @@ +import Nullstack from 'nullstack' +import LazyComponent from '../LazyComponent' + +class NestedFolder extends Nullstack { + + render() { + return ( +
+ NestedFolder + +
+ ) + } + +} + +export default NestedFolder; \ No newline at end of file From 49ddbeddd1d4800002aaf24933ce3ec5e298bc90 Mon Sep 17 00:00:00 2001 From: Christian Mortaro Date: Thu, 23 Mar 2023 09:39:09 -0300 Subject: [PATCH 5/5] :construction: cleanup --- client/lazy.js | 12 ++ loaders/debug.js | 2 +- server/server.js | 2 +- tests/debug.njs | 465 ++++++++++++++++++++++++----------------------- 4 files changed, 255 insertions(+), 226 deletions(-) diff --git a/client/lazy.js b/client/lazy.js index 7efe386a..bebb6bc2 100644 --- a/client/lazy.js +++ b/client/lazy.js @@ -1,6 +1,18 @@ import LazyComponent from "../shared/lazyComponent" +let next = null +const queue = [] + +async function preload() { + let importer = queue.pop() + await importer() + requestIdleCallback(preload) +} + export default function lazy(_hash, importer) { + queue.push(importer) + cancelIdleCallback(next) + preload() return class extends LazyComponent { importer = importer } diff --git a/loaders/debug.js b/loaders/debug.js index ffafef57..74ab76cb 100644 --- a/loaders/debug.js +++ b/loaders/debug.js @@ -1,5 +1,5 @@ module.exports = function (source, map) { - if (this.resourcePath.includes('Application.njs')) { + if (this.resourcePath.includes('ServerFunctions.njs')) { require('fs').writeFileSync('debug.njs', source) } this.callback(null, source, map) diff --git a/server/server.js b/server/server.js index c06044e0..15da16b4 100644 --- a/server/server.js +++ b/server/server.js @@ -189,7 +189,7 @@ server.start = function () { } async function delay() { invokerKlass = registry[invokerHash] - if (invokerKlass.__hashes[methodName] !== version) { + if (invokerKlass && invokerKlass.__hashes[methodName] !== version) { setTimeout(() => { delay() }, 0) diff --git a/tests/debug.njs b/tests/debug.njs index f77712b3..87ec2e1f 100644 --- a/tests/debug.njs +++ b/tests/debug.njs @@ -1,229 +1,246 @@ -import $runtime from "nullstack/runtime"; +import $runtime from "nullstack/runtime"; // server function works import Nullstack from "nullstack"; -import AnchorModifiers from "./AnchorModifiers"; -import ArrayAttributes from "./ArrayAttributes"; -import BodyFragment from "./BodyFragment"; -import CatchError from "./CatchError"; -import ChildComponent from "./ChildComponent"; -import ComponentTernary from "./ComponentTernary"; -import Context from "./Context"; -import ContextData from "./ContextData"; -import ContextEnvironment from "./ContextEnvironment"; -import ContextPage from "./ContextPage"; -import ContextProject from "./ContextProject"; -import ContextSecrets from "./ContextSecrets"; -import ContextSettings from "./ContextSettings"; -import ContextWorker from "./ContextWorker"; -import DateParser from "./DateParser"; -import DynamicHead from "./DynamicHead"; -import Element from "./Element"; -import ErrorOnChildNode from "./ErrorOnChildNode"; -import ErrorPage from "./ErrorPage"; -import ExposedServerFunctions from "./ExposedServerFunctions"; -import ExternalServerFunctions from "./ExternalServerFunctions"; -import FalsyNodes from "./FalsyNodes"; -import FullStackLifecycle from "./FullStackLifecycle"; -import Instanceable from "./Instanceable"; -import InstanceKey from "./InstanceKey"; -import InstanceSelf from "./InstanceSelf"; -import IsomorphicImport from "./IsomorphicImport"; -import IsomorphicStartup from "./IsomorphicStartup"; -import JavaScriptExtension from "./JavaScriptExtension"; -import Logo from "./Logo"; -import MetatagState from "./MetatagState"; -import NestedProxy from "./NestedProxy"; -import OptimizedEvents from "./OptimizedEvents"; -import ParentComponent from "./ParentComponent"; -import PersistentComponent from "./PersistentComponent"; -import PluginAttributes from "./PluginAttributes"; -import PublicServerFunctions from "./PublicServerFunctions"; -import PureComponents from "./PureComponents"; -import Refs from "./Refs"; -import RenderableComponent from "./RenderableComponent"; -import ReqRes from "./ReqRes"; -import RoutesAndParams from "./RoutesAndParams"; -import RouteScroll from "./RouteScroll"; -import ServerFunctions from "./ServerFunctions"; -import ServerRequestAndResponse from "./ServerRequestAndResponse"; -import StatefulComponent from "./StatefulComponent"; -import StaticThis from "./StaticThis"; -import TextObserver from "./TextObserver"; -import TwoWayBindings from "./TwoWayBindings"; -import TypeScript from "./TypeScript"; -import TypeScriptExtension from "./TypeScriptExtension"; -import UndefinedNodes from "./UndefinedNodes"; -import UnderscoredAttributes from "./UnderscoredAttributes"; -import Vunerability from "./Vunerability"; -import WebpackCustomPlugin from "./WebpackCustomPlugin"; -import WorkerVerbs from "./WorkerVerbs"; -import LazyComponent from "./LazyComponent"; -import LazyComponentLoader from "./LazyComponentLoader"; -import NestedFolder from "./nested/NestedFolder.njs"; -class Application extends Nullstack { - static hash = "6b94b59a22c75216"; - async changeInstanceable({ instances }) { - await instances.instanceable.customMethod(); - } - prepare(context) { - context.string = "nullstack"; - context.refInstanceCount = 0; - } - render({ project , page , environment , refInstanceCount }) { - return /*#__PURE__*/ $runtime.element("body", { - "data-application-hydrated": this.hydrated - }, /*#__PURE__*/ $runtime.element("h1", null, " ", project.name, " "), page.status !== 200 && /*#__PURE__*/ $runtime.element("div", { - route: "*", - "data-page-status": page.status +import { readFileSync } from "fs"; +const decodedString = "! * ' ( ) ; : @ & = + $ , / ? % # [ ]"; +class ServerFunctions extends Nullstack { + static hash = "src__ServerFunctions___ServerFunctions"; + count = 0; + year = null; + statement = ""; + response = ""; + clientOnly = ""; + static async getCountAsOne() { + return 1; + } + async setCountToOne() { + this.count = await this.getCountAsOne(); + } + static async getCount({ to }) { + return to; + } + async setCountToTwo() { + this.count = await this.getCount({ + to: 2 + }); + } + static async getDate({ input }) { + return input; + } + async setDate() { + const input = new Date("1992-10-16"); + const output = await this.getDate({ + input + }); + this.year = output.getFullYear(); + } + static async useNodeFileSystem() { + const text = readFileSync("src/ServerFunctions.njs", "utf-8"); + return text.split(`\n`)[0].trim(); + } + static async useFetchInNode() { + const response = await fetch("http://localhost:6969/robots.txt"); + const text = await response.text(); + return text.split(`\n`)[0].trim(); + } + static async getDoublePlusOne({ number }) { + return number * 2 + 1; + } + static async getEncodedString({ string }) { + return string === decodedString; + } + static async _privateFunction() { + return true; + } + static async getPrivateFunction({ request }) { + return this._privateFunction(); + } + static async getRequestUrl({ request }) { + return request.originalUrl.startsWith("/"); + } + async initiate() { + this.statement = await this.useNodeFileSystem(); + this.response = await this.useFetchInNode(); + this.doublePlusOneServer = await ServerFunctions.getDoublePlusOne({ + number: 34 + }); + this.originalUrl = await ServerFunctions.getRequestUrl(); + } + async hydrate() { + this.underlineRemovedFromClient = !ServerFunctions._privateFunction; + this.underlineStayOnServer = await ServerFunctions.getPrivateFunction(); + this.doublePlusOneClient = await ServerFunctions.getDoublePlusOne({ + number: 34 + }); + this.acceptsSpecialCharacters = await this.getEncodedString({ + string: decodedString + }); + this.hydratedOriginalUrl = await ServerFunctions.getRequestUrl(); + } + render() { + return /*#__PURE__*/ $runtime.element("div", { + "data-hydrated": this.hydrated, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 90, + columnNumber: 7 + }, + __self: this + }, /*#__PURE__*/ $runtime.element("button", { + class: "set-count-to-one", + onclick: this.setCountToOne, + source: this, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 91, + columnNumber: 9 + }, + __self: this + }, "1"), /*#__PURE__*/ $runtime.element("button", { + class: "set-count-to-two", + onclick: this.setCountToTwo, + source: this, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 94, + columnNumber: 9 + }, + __self: this + }, "2"), /*#__PURE__*/ $runtime.element("button", { + class: "set-date", + onclick: this.setDate, + source: this, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 97, + columnNumber: 9 + }, + __self: this + }, "1992"), /*#__PURE__*/ $runtime.element("div", { + "data-count": this.count, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 100, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-year": this.year, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 101, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-statement": this.statement, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 102, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-response": this.response, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 103, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-double-plus-one-server": this.doublePlusOneServer === 69, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 104, + columnNumber: 9 + }, + __self: this }), /*#__PURE__*/ $runtime.element("div", { - route: "/" - }, /*#__PURE__*/ $runtime.element("a", { - href: "/lazy-component" - }, " go lazy go home "), /*#__PURE__*/ $runtime.element("a", { - href: "/lazy-importer" - }, " import "), /*#__PURE__*/ $runtime.element("a", { - href: `/nullstack/${environment.key}/offline` - }, " offline "), /*#__PURE__*/ $runtime.element("a", { - href: "/static-this" - }, " static this "), /*#__PURE__*/ $runtime.element("a", { - href: "/routes-and-params/a" - }, " router with params "), /*#__PURE__*/ $runtime.element("a", { - href: "/undefined-nodes" - }, " undefined nodes "), /*#__PURE__*/ $runtime.element("a", { - href: "/full-stack-lifecycle" - }, " lifecycle "), /*#__PURE__*/ $runtime.element("a", { - href: "/refs" - }, " refs "), /*#__PURE__*/ $runtime.element("a", { - href: "/error-on-child-node?dom=true" - }, " error-on-child-node?dom=true "), /*#__PURE__*/ $runtime.element("a", { - href: "/error-on-child-node?serialization=true" - }, " error-on-child-node?serialization=true "), /*#__PURE__*/ $runtime.element("a", { - href: "/route-scroll/class?changed=1#bottom" - }, "#bottom")), /*#__PURE__*/ $runtime.element(RenderableComponent, { - route: "/renderable-component" - }), /*#__PURE__*/ $runtime.element(StatefulComponent, { - route: "/stateful-component" - }), /*#__PURE__*/ $runtime.element(FullStackLifecycle, { - route: "/full-stack-lifecycle" - }), /*#__PURE__*/ $runtime.element(InstanceSelf, { - route: "/instance-self" - }), /*#__PURE__*/ $runtime.element(ContextProject, { - route: "/context-project" - }), /*#__PURE__*/ $runtime.element(ServerFunctions, { - route: "/server-functions" - }), /*#__PURE__*/ $runtime.element(Context, { - route: "/context" - }), /*#__PURE__*/ $runtime.element(ContextSecrets, { - route: "/context-secrets" - }), /*#__PURE__*/ $runtime.element(ContextSettings, { - route: "/context-settings" - }), /*#__PURE__*/ $runtime.element(ContextEnvironment, { - route: "/context-environment" - }), /*#__PURE__*/ $runtime.element(ContextWorker, { - route: "/context-worker" - }), /*#__PURE__*/ $runtime.element(InstanceKey, { - route: "/instance-key" - }), /*#__PURE__*/ $runtime.element(RoutesAndParams, { - route: "/routes-and-params/*" - }), /*#__PURE__*/ $runtime.element(ContextPage, { - route: "/context-page" - }), /*#__PURE__*/ $runtime.element(TwoWayBindings, { - route: "/two-way-bindings" - }), /*#__PURE__*/ $runtime.element(ServerRequestAndResponse, { - route: "/server-request-and-response" - }), /*#__PURE__*/ $runtime.element(ContextData, { - route: "/context-data" - }), /*#__PURE__*/ $runtime.element(DateParser, { - route: "/date-parser" - }), /*#__PURE__*/ $runtime.element(StaticThis, { - route: "/static-this" - }), /*#__PURE__*/ $runtime.element(ChildComponent, { - route: "/child-component" - }), /*#__PURE__*/ $runtime.element(ParentComponent, { - route: "/parent-component" - }), /*#__PURE__*/ $runtime.element(Element, { - route: "/element" - }), /*#__PURE__*/ $runtime.element(PluginAttributes, { - route: "/plugin-attributes" - }), /*#__PURE__*/ $runtime.element(PureComponents, { - route: "/pure-components" - }), /*#__PURE__*/ $runtime.element(Instanceable, { - route: "/instanceable", - key: "instanceable" - }), /*#__PURE__*/ $runtime.element(NestedProxy, { - route: "/nested-proxy" - }), /*#__PURE__*/ $runtime.element(FalsyNodes, { - route: "/falsy-nodes" - }), /*#__PURE__*/ $runtime.element(ErrorOnChildNode, { - route: "/error-on-child-node" - }), /*#__PURE__*/ $runtime.element(Vunerability, { - route: "/vunerability" - }), /*#__PURE__*/ $runtime.element(UnderscoredAttributes, { - route: "/underscored-attributes" - }), /*#__PURE__*/ $runtime.element(PersistentComponent, { - route: "/persistent-component/:id", - persistent: true - }), /*#__PURE__*/ $runtime.element(IsomorphicStartup, { - route: "/isomorphic-startup" - }), /*#__PURE__*/ $runtime.element(WorkerVerbs, { - route: "/worker-verbs" - }), /*#__PURE__*/ $runtime.element(TypeScript, { - route: "/typescript" - }), /*#__PURE__*/ $runtime.element(LazyComponentLoader, { - route: "/lazy-component" - }), /*#__PURE__*/ $runtime.element(PublicServerFunctions, { - key: "publicServerFunctions" - }), /*#__PURE__*/ $runtime.element(ExternalServerFunctions, { - route: "/external-server-functions" - }), /*#__PURE__*/ $runtime.element(UndefinedNodes, { - route: "/undefined-nodes" - }), /*#__PURE__*/ $runtime.element(WebpackCustomPlugin, { - route: "/webpack-custom-plugin" - }), /*#__PURE__*/ $runtime.element(ComponentTernary, { - route: "/component-ternary" - }), /*#__PURE__*/ $runtime.element(AnchorModifiers, { - route: "/anchor-modifiers", - key: "anchorModifiers" - }), /*#__PURE__*/ $runtime.element(MetatagState, { - route: "/metatag-state" - }), /*#__PURE__*/ $runtime.element(JavaScriptExtension, { - route: "/javascript-extension" - }), /*#__PURE__*/ $runtime.element(TypeScriptExtension, { - route: "/typescript-extension", - generic: true - }), /*#__PURE__*/ $runtime.element(Refs, { - route: "/refs", - key: `refs${refInstanceCount}` - }), /*#__PURE__*/ $runtime.element(OptimizedEvents, { - route: "/optimized-events" - }), /*#__PURE__*/ $runtime.element(DynamicHead, { - route: "/dynamic-head" - }), /*#__PURE__*/ $runtime.element(TextObserver, { - route: "/text-observer" - }), /*#__PURE__*/ $runtime.element(BodyFragment, { - route: "/body-fragment" - }), /*#__PURE__*/ $runtime.element(ArrayAttributes, { - route: "/array-attributes" - }), /*#__PURE__*/ $runtime.element(RouteScroll, { - route: "/route-scroll/*", - key: "routeScroll" - }), /*#__PURE__*/ $runtime.element(IsomorphicImport, { - route: "/isomorphic-import" - }), /*#__PURE__*/ $runtime.element(ExposedServerFunctions, { - route: "/exposed-server-functions" - }), /*#__PURE__*/ $runtime.element(CatchError, { - route: "/catch-error" - }), /*#__PURE__*/ $runtime.element(ReqRes, { - route: "/reqres" - }), /*#__PURE__*/ $runtime.element(Logo, { - route: "/logo" - }), /*#__PURE__*/ $runtime.element(NestedFolder, { - route: "/nested/folder" - }), /*#__PURE__*/ $runtime.element(LazyComponent, { - route: "/lazy-importer", - prop: "works" - }), /*#__PURE__*/ $runtime.element(ErrorPage, { - route: "*" + "data-double-plus-one-client": this.doublePlusOneClient === 69, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 105, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-accepts-special-characters": this.acceptsSpecialCharacters, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 106, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-underline-removed-from-client": this.underlineRemovedFromClient, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 107, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-underline-stay-on-server": this.underlineStayOnServer, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 108, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-hydrated-original-url": this.hydratedOriginalUrl, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 109, + columnNumber: 9 + }, + __self: this + }), /*#__PURE__*/ $runtime.element("div", { + "data-original-url": this.originalUrl, + __source: { + fileName: "C:\\Repositories\\nullstack\\nullstack\\tests\\src\\ServerFunctions.njs", + lineNumber: 110, + columnNumber: 9 + }, + __self: this })); } } -export default Application; +export default ServerFunctions; +$runtime.accept(module, "src\\ServerFunctions.njs", [ + "nullstack/runtime", + "nullstack", + "fs" +], [ + { + klass: ServerFunctions, + initiate: [ + "useNodeFileSystem", + "useFetchInNode", + "getDoublePlusOne", + "getRequestUrl" + ], + hashes: { + getCount: "64ef23a80103627bea3edaeb8f533934", + useFetchInNode: "3b93e3a8e5dc19945360e9523e0ded32", + getCountAsOne: "771a1b57771dd29a59b9c155a8d8db56", + getPrivateFunction: "f0f780a14ce2ed58903e2b33ccf0c955", + getDate: "4f8e7ea6c02ae89b19432d3e3a73da8e", + getDoublePlusOne: "1dd6a327579482f27a02eaf5a4bf8ac0", + useNodeFileSystem: "243b666d0b221adf5809bf54d21829d5", + getEncodedString: "88a0ffa79f8ec5a5d9aa928d61f79e68", + _privateFunction: "c0990f04929c14e0294dcefcfc80fab4", + getRequestUrl: "7ee4471ded1f135c3cfce3544a56c3a2" + } + } +]); +$runtime.register(ServerFunctions, "getCountAsOne"); +$runtime.register(ServerFunctions, "getCount"); +$runtime.register(ServerFunctions, "getDate"); +$runtime.register(ServerFunctions, "useNodeFileSystem"); +$runtime.register(ServerFunctions, "useFetchInNode"); +$runtime.register(ServerFunctions, "getDoublePlusOne"); +$runtime.register(ServerFunctions, "getEncodedString"); +$runtime.register(ServerFunctions, "getPrivateFunction"); +$runtime.register(ServerFunctions, "getRequestUrl"); +$runtime.register(ServerFunctions);