@factor/app
Advanced tools
Comparing version 1.2.1 to 1.2.2
13
app.ts
@@ -19,3 +19,7 @@ import "@factor/app" | ||
*/ | ||
export const createApp = async (): Promise<ApplicationComponents> => { | ||
export const createApp = async ({ | ||
url = "/" | ||
}: { | ||
url?: string; | ||
} = {}): Promise<ApplicationComponents> => { | ||
process.env.FACTOR_TARGET = "app" | ||
@@ -36,4 +40,5 @@ | ||
*/ | ||
const factorSite = setting("app.components.site") | ||
const site = setting("app.components.site") | ||
const vm = new Vue({ | ||
@@ -47,3 +52,3 @@ mounted(): void { | ||
}, | ||
render: (h: CreateElement): VNode => h(factorSite), | ||
render: (h: CreateElement): VNode => h(site), | ||
router, | ||
@@ -58,3 +63,3 @@ store | ||
*/ | ||
return { vm, router, store, context: {} } | ||
return { vm, router, store, context: { url } } | ||
} |
@@ -7,3 +7,3 @@ import Vue from "vue" | ||
const startClient = async (): Promise<void> => { | ||
const { vm, router, store } = await createApp() | ||
const { vm, router, store } = await createApp({ url: window.location.pathname }) | ||
@@ -10,0 +10,0 @@ /** |
@@ -6,7 +6,9 @@ import Vue from "vue" | ||
// This exported function will be called by `bundleRenderer` | ||
// this function is expected to return a Promise that resolves to the app instance. | ||
// https://ssr.vuejs.org/guide/structure.html#entry-server-js | ||
/** | ||
* This exported function will be called by `bundleRenderer` | ||
* this function is expected to return a Promise that resolves to the app instance. | ||
* https://ssr.vuejs.org/guide/structure.html#entry-server-js | ||
*/ | ||
export default async (context: ServerRenderContext): Promise<Vue> => { | ||
const { vm, router, store } = await createApp() | ||
const { vm, router, store } = await createApp({ url: context.url }) | ||
@@ -13,0 +15,0 @@ await handleContext({ context, vm, router, store }) |
@@ -9,4 +9,6 @@ import { applyFilters, runCallbacks } from "@factor/api/hooks" | ||
// Add before plugins import | ||
// Observable values that can change at any time | ||
/** | ||
* Add a utility for observable values that can change at any time | ||
* Load before plugins as they will hook into these and watch them | ||
*/ | ||
const setupGlobalObservable = (): void => { | ||
@@ -16,2 +18,5 @@ __observables = Vue.observable(applyFilters("register-global-observables", {})) | ||
/** | ||
* Gets the observables object | ||
*/ | ||
export const getObservables = (): Record<string, any> => { | ||
@@ -21,2 +26,5 @@ return __observables | ||
/** | ||
* Add Vue directives | ||
*/ | ||
const addClientDirectives = (): void => { | ||
@@ -35,2 +43,6 @@ if (process.env.FACTOR_BUILD_ENV == "client") { | ||
/** | ||
* Load into application targeted extensions | ||
* @param options - application extension options | ||
*/ | ||
export const extendApp = async (options = {}): Promise<void> => { | ||
@@ -37,0 +49,0 @@ await runCallbacks("before-app-plugins", options) |
{ | ||
"name": "@factor/app", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"license": "GPL-2.0", | ||
@@ -17,3 +17,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "4fd754a336b4df27896d4b2b37374a8cbe5b12dc" | ||
"gitHead": "17081404611035bac32dacacb1348b013b4fdf9d" | ||
} |
@@ -12,3 +12,3 @@ import Vue from "vue" | ||
export interface ServerRenderContext { | ||
url?: string; | ||
url: string; | ||
state?: object; | ||
@@ -15,0 +15,0 @@ [key: string]: any; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45730
672