create-app
Advanced tools
Comparing version 2.0.11 to 2.0.12
@@ -15,13 +15,2 @@ "use strict"; | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -42,10 +31,10 @@ if (mod && mod.__esModule) return mod; | ||
var create_history_1 = __importStar(require("create-history")); | ||
var viewEngine_1 = __importDefault(require("./viewEngine")); | ||
var util_1 = require("../share/util"); | ||
var createMatcher_1 = __importDefault(require("../share/createMatcher")); | ||
var defaultSettings_1 = __importDefault(require("../share/defaultSettings")); | ||
var defaultSettings_1 = __importDefault(require("./defaultSettings")); | ||
var createController_1 = __importDefault(require("./createController")); | ||
function createHistory(settings) { | ||
var finalAppSettings = Object.assign({ viewEngine: viewEngine_1.default }, defaultSettings_1.default); | ||
finalAppSettings = Object.assign(finalAppSettings, settings); | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
var chInit = create_history_1.default[finalAppSettings.type]; | ||
@@ -56,4 +45,5 @@ return create_history_1.useBeforeUnload(create_history_1.useQueries(chInit))(finalAppSettings); | ||
function createHistoryWithBasename(settings) { | ||
var finalAppSettings = Object.assign({ viewEngine: viewEngine_1.default }, defaultSettings_1.default); | ||
finalAppSettings = Object.assign(finalAppSettings, settings); | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
var chInit = create_history_1.default[finalAppSettings.type]; | ||
@@ -64,6 +54,6 @@ return create_history_1.useBeforeUnload(create_history_1.useQueries(create_history_1.useBasename(chInit)))(finalAppSettings); | ||
function createApp(settings) { | ||
var finalAppSettings = Object.assign({ viewEngine: viewEngine_1.default }, defaultSettings_1.default); | ||
finalAppSettings = Object.assign(finalAppSettings, settings); | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
var routes = finalAppSettings.routes, viewEngine = finalAppSettings.viewEngine, loader = finalAppSettings.loader, context = finalAppSettings.context, container = finalAppSettings.container, cacheAmount = finalAppSettings.cacheAmount; | ||
context = __assign(__assign({}, finalAppSettings.context), settings.context); | ||
var history = finalAppSettings.basename | ||
@@ -70,0 +60,0 @@ ? createHistoryWithBasename(finalAppSettings) |
@@ -35,9 +35,9 @@ "use strict"; | ||
var util_1 = require("../share/util"); | ||
var viewEngine_1 = __importDefault(require("./viewEngine")); | ||
var createMatcher_1 = __importDefault(require("../share/createMatcher")); | ||
var defaultSettings_1 = __importDefault(require("../share/defaultSettings")); | ||
var defaultSettings_1 = __importDefault(require("./defaultSettings")); | ||
var createController_1 = __importDefault(require("./createController")); | ||
function createHistory(settings) { | ||
var finalAppSettings = Object.assign({ viewEngine: viewEngine_1.default }, defaultSettings_1.default); | ||
finalAppSettings = Object.assign(finalAppSettings, settings); | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
var chInit = create_history_1.createMemoryHistory; | ||
@@ -48,4 +48,5 @@ return create_history_1.useQueries(chInit)(finalAppSettings); | ||
function createHistoryWithBasename(settings) { | ||
var finalAppSettings = Object.assign({ viewEngine: viewEngine_1.default }, defaultSettings_1.default); | ||
finalAppSettings = Object.assign(finalAppSettings, settings); | ||
var _a; | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, (_a = settings) === null || _a === void 0 ? void 0 : _a.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
var chInit = create_history_1.createMemoryHistory; | ||
@@ -56,6 +57,5 @@ return create_history_1.useQueries(create_history_1.useBasename(chInit))(finalAppSettings); | ||
function createApp(settings) { | ||
var finalAppSettings = Object.assign({ viewEngine: viewEngine_1.default }, defaultSettings_1.default); | ||
finalAppSettings = Object.assign(finalAppSettings, settings); | ||
var finalContext = Object.assign({}, defaultSettings_1.default.context, settings.context); | ||
var finalAppSettings = Object.assign({}, defaultSettings_1.default, settings, { context: finalContext }); | ||
var routes = finalAppSettings.routes, viewEngine = finalAppSettings.viewEngine, loader = finalAppSettings.loader, context = finalAppSettings.context; | ||
context = __assign(__assign({}, finalAppSettings.context), settings.context); | ||
var matcher = createMatcher_1.default(routes || []); | ||
@@ -62,0 +62,0 @@ var history = finalAppSettings.basename |
@@ -43,3 +43,3 @@ import { History, LocationTypeMap } from 'create-history' | ||
requestPath: string, | ||
injectContext: Context | null | ||
injectContext: Partial<Context> | null | ||
): InitControllerReturn | Promise<InitControllerReturn> | ||
@@ -52,3 +52,3 @@ ( | ||
requestPath: string, | ||
injectContext: Context | null, | ||
injectContext: Partial<Context> | null, | ||
callback: Callback | ||
@@ -58,3 +58,3 @@ ): InitControllerReturn | Promise<InitControllerReturn> | ||
requestPath: string, | ||
injectContext?: Context | null | Callback, | ||
injectContext?: Partial<Context> | null | Callback, | ||
callback?: Callback | ||
@@ -61,0 +61,0 @@ ): InitControllerReturn | Promise<InitControllerReturn> |
@@ -66,7 +66,16 @@ /* | ||
cacheAmount?: number | ||
routes?: Route[] | ||
viewEngine?: ViewEngine<any, Controller> | ||
routes: Route[] | ||
viewEngine: ViewEngine<any, Controller> | ||
} | ||
export type Settings = Partial<EntireSettings> | ||
export type Settings = Partial<{ | ||
container: string | HTMLElement | ||
basename: string | ||
context: Partial<Context> | ||
type: CreateHistoryType | ||
loader: Loader | ||
cacheAmount?: number | ||
routes: Route[] | ||
viewEngine: ViewEngine<any, Controller> | ||
}> | ||
@@ -78,6 +87,6 @@ export type Listener = Function | ||
export interface Context { | ||
isClient?: boolean | ||
isServer?: boolean | ||
prevLocation?: object | null | ||
location?: HistoryBaseLocation | ||
isClient: boolean | ||
isServer: boolean | ||
prevLocation: object | null | ||
location: HistoryBaseLocation | ||
[propName: string]: unknown | ||
@@ -84,0 +93,0 @@ } |
{ | ||
"name": "create-app", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"description": "configuring once, rendering both client and server.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
40921
31