create-app
Advanced tools
Comparing version 2.0.13 to 2.0.14
@@ -1,9 +0,5 @@ | ||
/** | ||
* createApp at client | ||
*/ | ||
import { LocationTypeMap, HistoryWithBFOL } from 'create-history'; | ||
import { EntireSettings, Settings } from '../share/type'; | ||
import { App } from './type'; | ||
import type { LocationTypeMap, HistoryWithBFOL } from 'create-history'; | ||
import type { EntireSettings, Settings, App } from './index'; | ||
export declare function createHistory(settings?: EntireSettings): HistoryWithBFOL<LocationTypeMap['QUERY']['Base'], LocationTypeMap['QUERY']['Intact']>; | ||
export declare function createHistoryWithBasename(settings?: EntireSettings): HistoryWithBFOL<LocationTypeMap['BQ']['Base'], LocationTypeMap['BQ']['Intact']>; | ||
export default function createApp(settings: Settings): App; |
@@ -26,13 +26,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* createApp at client | ||
*/ | ||
var create_history_1 = __importStar(require("create-history")); | ||
var util_1 = require("../share/util"); | ||
var createMatcher_1 = __importDefault(require("../share/createMatcher")); | ||
var defaultSettings_1 = __importDefault(require("./defaultSettings")); | ||
var createController_1 = __importDefault(require("./createController")); | ||
var util_1 = require("../share/util"); | ||
function createHistory(settings) { | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, settings === null || settings === void 0 ? void 0 : settings.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
@@ -44,4 +40,3 @@ var chInit = create_history_1.default[finalAppSettings.type]; | ||
function createHistoryWithBasename(settings) { | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, settings === null || settings === void 0 ? void 0 : settings.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
@@ -53,4 +48,3 @@ var chInit = create_history_1.default[finalAppSettings.type]; | ||
function createApp(settings) { | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, settings === null || settings === void 0 ? void 0 : settings.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
@@ -107,3 +101,4 @@ var routes = finalAppSettings.routes, viewEngine = finalAppSettings.viewEngine, loader = finalAppSettings.loader, context = finalAppSettings.context, container = finalAppSettings.container, cacheAmount = finalAppSettings.cacheAmount; | ||
if (util_1.isPromise(iController)) { | ||
return iController.then(initController); | ||
return (iController | ||
.then(initController)); | ||
} | ||
@@ -110,0 +105,0 @@ else { |
@@ -1,3 +0,2 @@ | ||
import { HistoryLocation, Context } from '../share/type'; | ||
import { ClientController, ClientControllerConstructor } from './type'; | ||
import { ClientController, ClientControllerConstructor, HistoryLocation, Context } from "./index"; | ||
export default function createController(c: ClientControllerConstructor, location: HistoryLocation, context: Context): ClientController; |
@@ -1,2 +0,2 @@ | ||
import { EntireSettings } from '../share/type'; | ||
import type { EntireSettings } from "./index"; | ||
export declare const isClient: boolean; | ||
@@ -3,0 +3,0 @@ export declare const isServer: boolean; |
import createApp from './createApp'; | ||
export default createApp; | ||
export { createHistory } from './createApp'; | ||
export { App, ClientController } from './type'; | ||
export { Route, EntireSettings, Settings, CreateHistoryType, Params, Matches, Matcher, ViewEngine, ViewEngineRender, ViewEngineClear, Loader, LoadController, Context, HistoryBaseLocation, HistoryLocation, Controller, ControllerConstructor, Cache, CacheStorage, AppMap } from '../share/type'; | ||
export { Actions } from 'create-history'; | ||
export * from './createApp'; | ||
export * from '../index'; | ||
import type { History, ILWithBQ, BLWithBQ, HistoryWithBFOL, LocationTypeMap, BLWithQuery, ILWithQuery } from 'create-history'; | ||
import type { Context, Callback, ControllerConstructor, Listener, HistoryLocation, Matcher, Route, Loader, Controller } from '../index'; | ||
export interface ClientController extends Controller { | ||
location: HistoryLocation; | ||
context: Context; | ||
history: History<BLWithBQ, ILWithBQ> | History<BLWithQuery, ILWithQuery>; | ||
matcher: Matcher; | ||
loader: Loader; | ||
routes: Route[]; | ||
} | ||
export interface ClientControllerConstructor { | ||
new (location: HistoryLocation, context: Context): ClientController; | ||
} | ||
export interface Render { | ||
(targetPath: string | ILWithBQ | ILWithQuery): unknown; | ||
} | ||
export interface Start { | ||
(callback?: Callback, shouldRenderWithCurrentLocation?: boolean): Stop | null; | ||
} | ||
export interface Stop { | ||
(): void; | ||
} | ||
export interface Subscribe { | ||
(listener: Listener): () => void; | ||
} | ||
export interface App { | ||
start: Start; | ||
stop: Stop; | ||
render: Render; | ||
history: HistoryWithBFOL<LocationTypeMap['BQ']['Base'], LocationTypeMap['BQ']['Intact']> | HistoryWithBFOL<LocationTypeMap['QUERY']['Base'], LocationTypeMap['QUERY']['Intact']>; | ||
subscribe: Subscribe; | ||
} | ||
export interface InitController { | ||
(c: ControllerConstructor | Promise<ControllerConstructor>): unknown; | ||
} |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,7 +9,11 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// FUNCTIONS | ||
/////////////////////////////////////////////////////////////////////////////// | ||
var createApp_1 = __importDefault(require("./createApp")); | ||
exports.default = createApp_1.default; | ||
var createApp_2 = require("./createApp"); | ||
exports.createHistory = createApp_2.createHistory; | ||
var create_history_1 = require("create-history"); | ||
exports.Actions = create_history_1.Actions; | ||
__export(require("./createApp")); | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// TYPES | ||
/////////////////////////////////////////////////////////////////////////////// | ||
__export(require("../index")); |
@@ -1,9 +0,5 @@ | ||
/** | ||
* createApp at server | ||
*/ | ||
import { History, LocationTypeMap } from 'create-history'; | ||
import { EntireSettings, Settings } from '../share/type'; | ||
import { App } from './type'; | ||
import type { History, LocationTypeMap } from 'create-history'; | ||
import type { App, Settings, EntireSettings } from './index'; | ||
export declare function createHistory(settings?: EntireSettings): History<LocationTypeMap['QUERY']['Base'], LocationTypeMap['QUERY']['Intact']>; | ||
export declare function createHistoryWithBasename(settings?: EntireSettings): History<LocationTypeMap['BQ']['Base'], LocationTypeMap['BQ']['Intact']>; | ||
export default function createApp(settings: Settings): App; |
@@ -34,9 +34,8 @@ "use strict"; | ||
var create_history_1 = require("create-history"); | ||
var util_1 = require("../share/util"); | ||
var createMatcher_1 = __importDefault(require("../share/createMatcher")); | ||
var defaultSettings_1 = __importDefault(require("./defaultSettings")); | ||
var createController_1 = __importDefault(require("./createController")); | ||
var util_1 = require("../share/util"); | ||
function createHistory(settings) { | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, settings === null || settings === void 0 ? void 0 : settings.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
@@ -48,4 +47,3 @@ var chInit = create_history_1.createMemoryHistory; | ||
function createHistoryWithBasename(settings) { | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, settings === null || settings === void 0 ? void 0 : settings.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
@@ -131,6 +129,7 @@ var chInit = create_history_1.createMemoryHistory; | ||
if (util_1.isPromise(iController)) { | ||
return iController.then(function (iController) { | ||
return (iController | ||
.then(function (iController) { | ||
var Wrapper = wrapController(iController); | ||
return createController_1.default(Wrapper, finalLocation, finalContext); | ||
}); | ||
})); | ||
} | ||
@@ -137,0 +136,0 @@ var Wrapper = wrapController(iController); |
@@ -1,3 +0,2 @@ | ||
import { HistoryLocation, Context } from '../share/type'; | ||
import { ServerController, ServerControllerConstructor } from './type'; | ||
import type { ServerController, ServerControllerConstructor, HistoryLocation, Context } from "./index"; | ||
export default function createController(c: ServerControllerConstructor, location: HistoryLocation, context: Context): ServerController; |
@@ -1,2 +0,2 @@ | ||
import { EntireSettings } from '../share/type'; | ||
import type { EntireSettings } from './index'; | ||
export declare const isClient: boolean; | ||
@@ -3,0 +3,0 @@ export declare const isServer: boolean; |
import createApp from './createApp'; | ||
export default createApp; | ||
export { createHistory } from './createApp'; | ||
export { App, ServerController } from './type'; | ||
export { Route, EntireSettings, Settings, CreateHistoryType, Params, Matches, Matcher, ViewEngine, ViewEngineRender, ViewEngineClear, Loader, LoadController, Context, HistoryBaseLocation, HistoryLocation, Controller, ControllerConstructor, Cache, CacheStorage, AppMap } from '../share/type'; | ||
export { Actions } from 'create-history'; | ||
export * from './createApp'; | ||
export * from '../index'; | ||
import type { History, LocationTypeMap } from 'create-history'; | ||
import type { Context, Callback, HistoryLocation, Controller } from '../index'; | ||
export interface ServerController extends Controller { | ||
location: HistoryLocation; | ||
context: Context; | ||
} | ||
export interface ServerControllerConstructor { | ||
new (location: HistoryLocation, context: Context): ServerController; | ||
} | ||
export interface App { | ||
render: Render; | ||
history: History<LocationTypeMap['BQ']['Base'], LocationTypeMap['BQ']['Intact']> | History<LocationTypeMap['QUERY']['Base'], LocationTypeMap['QUERY']['Intact']>; | ||
} | ||
export interface Render { | ||
(requestPath: string): InitControllerReturn | Promise<InitControllerReturn>; | ||
(requestPath: string, injectContext: Partial<Context> | null): InitControllerReturn | Promise<InitControllerReturn>; | ||
(requestPath: string, callback: Callback): InitControllerReturn | Promise<InitControllerReturn>; | ||
(requestPath: string, injectContext: Partial<Context> | null, callback: Callback): InitControllerReturn | Promise<InitControllerReturn>; | ||
(requestPath: string, injectContext?: Partial<Context> | null | Callback, callback?: Callback): InitControllerReturn | Promise<InitControllerReturn>; | ||
} | ||
export interface InitControllerReturn { | ||
content?: unknown; | ||
controller: Controller; | ||
} |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,7 +9,11 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// FUNCTIONS | ||
/////////////////////////////////////////////////////////////////////////////// | ||
var createApp_1 = __importDefault(require("./createApp")); | ||
exports.default = createApp_1.default; | ||
var createApp_2 = require("./createApp"); | ||
exports.createHistory = createApp_2.createHistory; | ||
var create_history_1 = require("create-history"); | ||
exports.Actions = create_history_1.Actions; | ||
__export(require("./createApp")); | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// TYPES | ||
/////////////////////////////////////////////////////////////////////////////// | ||
__export(require("../index")); |
@@ -1,2 +0,2 @@ | ||
import { Route, Matcher } from './type'; | ||
import type { Route, Matcher } from '../index'; | ||
export default function createMatcher(routes: Route[]): Matcher; |
@@ -1,2 +0,2 @@ | ||
import { Cache, AppMap } from './type'; | ||
import type { Cache, AppMap } from '../index'; | ||
export declare class ReqError extends Error { | ||
@@ -3,0 +3,0 @@ status?: number; |
{ | ||
"name": "create-app", | ||
"version": "2.0.13", | ||
"version": "2.0.14", | ||
"description": "configuring once, rendering both client and server.", | ||
@@ -10,4 +10,3 @@ "main": "index.js", | ||
"prebuild": "rimraf lib", | ||
"build": "tsc", | ||
"postbuild": "ts-node move.ts" | ||
"build": "tsc" | ||
}, | ||
@@ -40,3 +39,2 @@ "files": [ | ||
"@types/node": "^12.6.9", | ||
"fs-extra": "^8.1.0", | ||
"jest": "^23.0.1", | ||
@@ -46,9 +44,8 @@ "rimraf": "^2.6.3", | ||
"ts-node": "^8.3.0", | ||
"tslint": "^5.18.0", | ||
"typescript": "^3.7.3" | ||
"typescript": "^3.8.2" | ||
}, | ||
"dependencies": { | ||
"create-history": "^2.0.6", | ||
"create-history": "^2.0.7", | ||
"path-to-regexp": "^1.7.0" | ||
} | ||
} |
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
8
40867
30
953
Updatedcreate-history@^2.0.7