Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@factor/app

Package Overview
Dependencies
Maintainers
2
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@factor/app - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

8

app.ts
import "@factor/app"
import "@factor/meta"
import "@factor/tools" // prevent load order issues
import "@factor/api" // prevent load order issues

@@ -8,6 +8,6 @@ import Vue, { CreateElement, VNode } from "vue"

import { createRouter } from "@factor/app/router"
import { emitEvent } from "@factor/tools/events"
import { emitEvent } from "@factor/api/events"
import { getStore } from "@factor/app/store"
import { runCallbacks } from "@factor/tools/filters"
import { setting } from "@factor/tools/settings"
import { runCallbacks } from "@factor/api/hooks"
import { setting } from "@factor/api/settings"
import { extendApp } from "./extend-app"

@@ -14,0 +14,0 @@ import { ApplicationComponents } from "./types"

/* eslint-disable import/no-unresolved */
import { resolveFilePath } from "@factor/tools/resolver"
import { resolveFilePath } from "@factor/api/resolver"
import { Component } from "vue"

@@ -4,0 +4,0 @@ export default (): object => {

@@ -1,2 +0,2 @@

import { applyFilters, runCallbacks } from "@factor/tools/filters"
import { applyFilters, runCallbacks } from "@factor/api/hooks"
import Vue from "vue"

@@ -9,3 +9,2 @@

// Add before plugins import

@@ -46,2 +45,2 @@ // Observable values that can change at any time

await runCallbacks("initialize-app", options)
}
}

@@ -1,4 +0,4 @@

import { setting } from "@factor/tools/settings"
import { addFilter, applyFilters, addCallback } from "@factor/tools/filters"
import { onEvent } from "@factor/tools/events"
import { setting } from "@factor/api/settings"
import { addFilter, applyFilters, addCallback } from "@factor/api/hooks"
import { onEvent } from "@factor/api/events"
export * from "./extend-app"

@@ -24,50 +24,54 @@ import { RouteConfig } from "vue-router"

export const setup = (): void => {
addCallback("initialize-app", () => {
const factorError404 = setting("app.components.error404")
const factorContent = setting("app.components.content")
addCallback({
hook: "initialize-app",
key: "setupApp",
callback: () => {
const factorError404 = setting("app.components.error404")
const factorContent = setting("app.components.content")
if (!factorError404 || !factorContent) {
throw new Error("core components missing")
}
if (!factorError404 || !factorContent) {
throw new Error("core components missing")
}
addFilter(
"routes",
(_: RouteConfig[]) => {
const contentRoutes = applyFilters("content-routes", [
{
name: "forbidden",
path: "/forbidden",
component: factorError404,
meta: { error: 403 }
}
]).filter((route: RouteConfig, index: number, self: RouteConfig[]) => {
// remove duplicate paths
const lastIndexOf = self.map(_ => _.path).lastIndexOf(route.path)
return index === lastIndexOf
})
_.push({
path: "/",
component: factorContent,
children: contentRoutes
})
_.push({
path: "*",
component: factorContent,
children: applyFilters("content-routes-unmatched", [
addFilter({
hook: "routes",
key: "appRoutes",
callback: (_: RouteConfig[]) => {
const contentRoutes = applyFilters("content-routes", [
{
name: "notFound",
path: "*",
name: "forbidden",
path: "/forbidden",
component: factorError404,
meta: { error: 404 }
meta: { error: 403 }
}
]),
priority: 3000
})
]).filter((route: RouteConfig, index: number, self: RouteConfig[]) => {
// remove duplicate paths
const lastIndexOf = self.map(_ => _.path).lastIndexOf(route.path)
return index === lastIndexOf
})
return _
},
{ key: "app-routes" }
)
_.push({
path: "/",
component: factorContent,
children: contentRoutes
})
_.push({
path: "*",
component: factorContent,
children: applyFilters("content-routes-unmatched", [
{
name: "notFound",
path: "*",
component: factorError404,
meta: { error: 404 }
}
]),
priority: 3000
})
return _
}
})
}
})

@@ -74,0 +78,0 @@ }

{
"name": "@factor/app",
"version": "1.1.4",
"version": "1.1.5",
"license": "GPL-2.0",

@@ -17,3 +17,3 @@ "publishConfig": {

},
"gitHead": "6e823b48f098adb4ff88f62b4ce90be12a4becfa"
"gitHead": "4aa17725c1698aac14bca37151f5d0cbee3b27ae"
}

@@ -1,8 +0,3 @@

import {
applyFilters,
runCallbacks,
pushToFilter,
addFilter
} from "@factor/tools/filters"
import { emitEvent } from "@factor/tools/events"
import { applyFilters, runCallbacks, pushToFilter, addFilter } from "@factor/api/hooks"
import { emitEvent } from "@factor/api/events"
import Vue from "vue"

@@ -50,3 +45,3 @@ import VueRouter, { RouteConfig, Route, RouterOptions, Location } from "vue-router"

export const createRouter = (): VueRouter => {
const routes = applyFilters("routes", []).filter((_: RouteConfig) => _)
const routes: RouteConfig[] = applyFilters("routes", []).filter((_: RouteConfig) => _)

@@ -87,20 +82,42 @@ const router = new VueRouter({

/**
* Adds a route to the app.
*
* @param routeItem Standard Route Config
* @param options Optional route options
* @category app
*/
export const addContentRoute = (routeItem: RouteConfig, options?: object): void => {
pushToFilter("content-routes", routeItem, options)
pushToFilter({
hook: "content-routes",
key: routeItem.path,
item: routeItem,
...options
})
}
// Allow for callback signature to allow for dynamic settings that may not exist yet
export const addContentRoutes = (
routeItems: RouteConfig[] | (() => RouteConfig[]),
options?: object
): void => {
addFilter(
"content-routes",
(routes: RouteConfig[]): RouteConfig[] => {
const r = typeof routeItems === "function" ? routeItems() : routeItems
/**
* Adds an array of routes to the router.
*
* @param _id A unique group identifier for the routes
* @param routeItems Array of standard routes
* @param options Optional route options
* @category app
*/
export const addContentRoutes = ({
key,
routes
}: {
key: string;
routes: RouteConfig[] | (() => RouteConfig[]);
}): void => {
addFilter({
hook: "content-routes",
key,
callback: (allRoutes: RouteConfig[]): RouteConfig[] => {
const r = typeof routes === "function" ? routes() : routes
return routes.concat(r)
},
options
)
return allRoutes.concat(r)
}
})
}

@@ -107,0 +124,0 @@

@@ -1,2 +0,2 @@

import { runCallbacks, applyFilters } from "@factor/tools"
import { runCallbacks, applyFilters } from "@factor/api"
import { getObservables } from "@factor/app"

@@ -3,0 +3,0 @@ import Vue, { VueConstructor } from "vue"

// This configures the context information needed to SSR the page
// Add lifecycle filters that allow plugins to control the context
import log from "@factor/tools/logger"
import { applyFilters, runCallbacks } from "@factor/tools/filters"
import log from "@factor/api/logger"
import { applyFilters, runCallbacks } from "@factor/api/hooks"
import { ServerRenderContext, ApplicationComponents } from "./types"

@@ -6,0 +6,0 @@

@@ -7,4 +7,2 @@ import Vuex from "vuex"

import { addCallback } from "@factor/tools/filters"
const __store = new Vuex.Store({

@@ -29,4 +27,2 @@ strict: false,

addCallback("before-server-plugins", () => getStore())
// prime the store with server-initialized state.

@@ -33,0 +29,0 @@ // the state is determined during SSR and inlined in the page markup.

@@ -6,3 +6,3 @@ /**

import * as app from "@factor/app/app"
import * as events from "@factor/tools/events"
import * as events from "@factor/api/events"
import { waitFor, indexHtml } from "@test/utils"

@@ -9,0 +9,0 @@

import * as app from "@factor/app/app"
import * as events from "@factor/tools/events"
import * as filters from "@factor/tools/filters"
import * as events from "@factor/api/events"
import * as filters from "@factor/api/hooks"
import serverEntry from "@factor/app/entry-server"

@@ -5,0 +5,0 @@

@@ -1,2 +0,2 @@

import { setting, createSettings } from "@factor/tools/settings"
import { setting, createSettings } from "@factor/api/settings"

@@ -3,0 +3,0 @@ describe("fallbacks", () => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc