diff --git a/src/common/common.ts b/src/common/common.ts index 99a311ba..8c4128bc 100644 --- a/src/common/common.ts +++ b/src/common/common.ts @@ -6,10 +6,10 @@ * @packageDocumentation * @preferred */ -import { isFunction, isString, isArray, isRegExp, isDate } from './predicates'; -import { all, any, prop, curry, not } from './hof'; -import { services } from './coreservices'; -import { StateObject } from '../state/stateObject'; +import { isFunction, isString, isArray, isRegExp, isDate } from './predicates.js'; +import { all, any, prop, curry, not } from './hof.js'; +import { services } from './coreservices.js'; +import { StateObject } from '../state/stateObject.js'; declare const global; export const root: any = diff --git a/src/common/coreservices.ts b/src/common/coreservices.ts index afa8102e..6e754f18 100644 --- a/src/common/coreservices.ts +++ b/src/common/coreservices.ts @@ -4,9 +4,9 @@ * * @packageDocumentation */ -import { IInjectable, Obj } from './common'; -import { Disposable } from '../interface'; -import { UrlConfig, UrlService } from '../url'; +import { IInjectable, Obj } from './common.js'; +import { Disposable } from '../interface.js'; +import { UrlConfig, UrlService } from '../url/index.js'; const noImpl = (fnname: string) => () => { throw new Error(`No implementation for ${fnname}. The framework specific code did not implement this method.`); diff --git a/src/common/hof.ts b/src/common/hof.ts index fc52c7e9..fe3123bc 100644 --- a/src/common/hof.ts +++ b/src/common/hof.ts @@ -6,7 +6,7 @@ * @packageDocumentation */ -import { Predicate } from './common'; +import { Predicate } from './common.js'; /** * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function. * diff --git a/src/common/index.ts b/src/common/index.ts index 9f3c4e4f..d3117bf8 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -1,8 +1,8 @@ -export * from './common'; -export * from './coreservices'; -export * from './glob'; -export * from './hof'; -export * from './predicates'; -export * from './queue'; -export * from './strings'; -export * from './trace'; +export * from './common.js'; +export * from './coreservices.js'; +export * from './glob.js'; +export * from './hof.js'; +export * from './predicates.js'; +export * from './queue.js'; +export * from './strings.js'; +export * from './trace.js'; diff --git a/src/common/predicates.ts b/src/common/predicates.ts index db25543a..ff3bf5ea 100644 --- a/src/common/predicates.ts +++ b/src/common/predicates.ts @@ -6,9 +6,9 @@ * * @packageDocumentation */ -import { and, not, pipe, prop, or } from './hof'; -import { Predicate } from './common'; // has or is using -import { StateObject } from '../state/stateObject'; +import { and, not, pipe, prop, or } from './hof.js'; +import { Predicate } from './common.js'; // has or is using +import { StateObject } from '../state/stateObject.js'; const toStr = Object.prototype.toString; const tis = (t: string) => (x: any) => typeof x === t; diff --git a/src/common/queue.ts b/src/common/queue.ts index e43b8815..7f521a44 100644 --- a/src/common/queue.ts +++ b/src/common/queue.ts @@ -1,4 +1,4 @@ -import { pushTo } from './common'; +import { pushTo } from './common.js'; export class Queue { private _evictListeners: ((item: T) => void)[] = []; diff --git a/src/common/safeConsole.ts b/src/common/safeConsole.ts index b16c710c..3f2ca8b7 100644 --- a/src/common/safeConsole.ts +++ b/src/common/safeConsole.ts @@ -3,7 +3,7 @@ * @packageDocumentation */ /* tslint:disable:no-console */ -import { noop } from './common'; +import { noop } from './common.js'; const noopConsoleStub = { log: noop, error: noop, table: noop }; diff --git a/src/common/strings.ts b/src/common/strings.ts index 7c8d42d7..6e69e3ec 100644 --- a/src/common/strings.ts +++ b/src/common/strings.ts @@ -6,10 +6,10 @@ * @packageDocumentation */ -import { isArray, isFunction, isInjectable, isNull, isObject, isPromise, isString, isUndefined } from './predicates'; -import { Rejection } from '../transition/rejectFactory'; -import { identity, IInjectable, pushR, tail } from './common'; -import { pattern, val } from './hof'; +import { isArray, isFunction, isInjectable, isNull, isObject, isPromise, isString, isUndefined } from './predicates.js'; +import { Rejection } from '../transition/rejectFactory.js'; +import { identity, IInjectable, pushR, tail } from './common.js'; +import { pattern, val } from './hof.js'; /** * Returns a string shortened to a maximum length diff --git a/src/common/trace.ts b/src/common/trace.ts index 61f20846..12006d77 100644 --- a/src/common/trace.ts +++ b/src/common/trace.ts @@ -32,19 +32,19 @@ * * @packageDocumentation */ -import { parse } from '../common/hof'; -import { isNumber } from '../common/predicates'; -import { Transition } from '../transition/transition'; -import { ViewTuple } from '../view'; -import { ActiveUIView, ViewConfig, ViewContext } from '../view/interface'; -import { stringify, functionToString, maxLength, padString } from './strings'; -import { safeConsole } from './safeConsole'; -import { Resolvable } from '../resolve/resolvable'; -import { PathNode } from '../path/pathNode'; -import { PolicyWhen } from '../resolve/interface'; -import { TransitionHook } from '../transition/transitionHook'; -import { HookResult } from '../transition/interface'; -import { StateObject } from '../state/stateObject'; +import { parse } from '../common/hof.js'; +import { isNumber } from '../common/predicates.js'; +import { Transition } from '../transition/transition.js'; +import { ViewTuple } from '../view/index.js'; +import { ActiveUIView, ViewConfig, ViewContext } from '../view/interface.js'; +import { stringify, functionToString, maxLength, padString } from './strings.js'; +import { safeConsole } from './safeConsole.js'; +import { Resolvable } from '../resolve/resolvable.js'; +import { PathNode } from '../path/pathNode.js'; +import { PolicyWhen } from '../resolve/interface.js'; +import { TransitionHook } from '../transition/transitionHook.js'; +import { HookResult } from '../transition/interface.js'; +import { StateObject } from '../state/stateObject.js'; function uiViewString(uiview: ActiveUIView) { if (!uiview) return 'ui-view (defunct)'; diff --git a/src/globals.ts b/src/globals.ts index ae2f5ee2..707b2858 100644 --- a/src/globals.ts +++ b/src/globals.ts @@ -1,9 +1,9 @@ -import { StateParams } from './params/stateParams'; -import { StateDeclaration } from './state/interface'; -import { StateObject } from './state/stateObject'; -import { Transition } from './transition/transition'; -import { Queue } from './common/queue'; -import { Disposable } from './interface'; +import { StateParams } from './params/stateParams.js'; +import { StateDeclaration } from './state/interface.js'; +import { StateObject } from './state/stateObject.js'; +import { Transition } from './transition/transition.js'; +import { Queue } from './common/queue.js'; +import { Disposable } from './interface.js'; /** * Global router state diff --git a/src/hooks/coreResolvables.ts b/src/hooks/coreResolvables.ts index dccf5f27..ef2230f2 100644 --- a/src/hooks/coreResolvables.ts +++ b/src/hooks/coreResolvables.ts @@ -1,9 +1,9 @@ -import { Transition } from '../transition/transition'; -import { UIRouter } from '../router'; -import { TransitionService } from '../transition/transitionService'; -import { Resolvable } from '../resolve'; -import { inArray, uniqR, unnestR, values } from '../common'; -import { PathNode } from '../path'; +import { Transition } from '../transition/transition.js'; +import { UIRouter } from '../router.js'; +import { TransitionService } from '../transition/transitionService.js'; +import { Resolvable } from '../resolve/index.js'; +import { inArray, uniqR, unnestR, values } from '../common/index.js'; +import { PathNode } from '../path/index.js'; function addCoreResolvables(trans: Transition) { trans.addResolvable(Resolvable.fromData(UIRouter, trans.router), ''); diff --git a/src/hooks/ignoredTransition.ts b/src/hooks/ignoredTransition.ts index 217a719f..c4bff3e0 100644 --- a/src/hooks/ignoredTransition.ts +++ b/src/hooks/ignoredTransition.ts @@ -1,7 +1,7 @@ -import { trace } from '../common/trace'; -import { Rejection } from '../transition/rejectFactory'; -import { TransitionService } from '../transition/transitionService'; -import { Transition } from '../transition/transition'; +import { trace } from '../common/trace.js'; +import { Rejection } from '../transition/rejectFactory.js'; +import { TransitionService } from '../transition/transitionService.js'; +import { Transition } from '../transition/transition.js'; /** * A [[TransitionHookFn]] that skips a transition if it should be ignored diff --git a/src/hooks/invalidTransition.ts b/src/hooks/invalidTransition.ts index 199417ff..45e08200 100644 --- a/src/hooks/invalidTransition.ts +++ b/src/hooks/invalidTransition.ts @@ -1,5 +1,5 @@ -import { TransitionService } from '../transition/transitionService'; -import { Transition } from '../transition/transition'; +import { TransitionService } from '../transition/transitionService.js'; +import { Transition } from '../transition/transition.js'; /** * A [[TransitionHookFn]] that rejects the Transition if it is invalid diff --git a/src/hooks/lazyLoad.ts b/src/hooks/lazyLoad.ts index 1d891110..b40329bd 100644 --- a/src/hooks/lazyLoad.ts +++ b/src/hooks/lazyLoad.ts @@ -1,9 +1,9 @@ -import { Transition } from '../transition/transition'; -import { TransitionService } from '../transition/transitionService'; -import { TransitionHookFn } from '../transition/interface'; -import { StateDeclaration, LazyLoadResult } from '../state/interface'; -import { services } from '../common/coreservices'; -import { StateRule } from '../url/interface'; +import { Transition } from '../transition/transition.js'; +import { TransitionService } from '../transition/transitionService.js'; +import { TransitionHookFn } from '../transition/interface.js'; +import { StateDeclaration, LazyLoadResult } from '../state/interface.js'; +import { services } from '../common/coreservices.js'; +import { StateRule } from '../url/interface.js'; /** * A [[TransitionHookFn]] that performs lazy loading diff --git a/src/hooks/onEnterExitRetain.ts b/src/hooks/onEnterExitRetain.ts index 21a9e621..c59ff63c 100644 --- a/src/hooks/onEnterExitRetain.ts +++ b/src/hooks/onEnterExitRetain.ts @@ -1,8 +1,8 @@ -import { TransitionStateHookFn } from '../transition/interface'; -import { Transition } from '../transition/transition'; -import { TransitionService } from '../transition/transitionService'; -import { StateDeclaration } from '../state/interface'; -import { StateObject } from '../state/stateObject'; +import { TransitionStateHookFn } from '../transition/interface.js'; +import { Transition } from '../transition/transition.js'; +import { TransitionService } from '../transition/transitionService.js'; +import { StateDeclaration } from '../state/interface.js'; +import { StateObject } from '../state/stateObject.js'; /** * A factory which creates an onEnter, onExit or onRetain transition hook function diff --git a/src/hooks/redirectTo.ts b/src/hooks/redirectTo.ts index e9cdaf6b..61648605 100644 --- a/src/hooks/redirectTo.ts +++ b/src/hooks/redirectTo.ts @@ -1,9 +1,9 @@ -import { isString, isFunction } from '../common/predicates'; -import { Transition } from '../transition/transition'; -import { services } from '../common/coreservices'; -import { TargetState } from '../state/targetState'; -import { TransitionService } from '../transition/transitionService'; -import { TransitionHookFn } from '../transition/interface'; +import { isString, isFunction } from '../common/predicates.js'; +import { Transition } from '../transition/transition.js'; +import { services } from '../common/coreservices.js'; +import { TargetState } from '../state/targetState.js'; +import { TransitionService } from '../transition/transitionService.js'; +import { TransitionHookFn } from '../transition/interface.js'; /** * A [[TransitionHookFn]] that redirects to a different state or params diff --git a/src/hooks/resolve.ts b/src/hooks/resolve.ts index 8f9665ee..010e39c3 100644 --- a/src/hooks/resolve.ts +++ b/src/hooks/resolve.ts @@ -1,10 +1,10 @@ -import { noop } from '../common/common'; -import { Transition } from '../transition/transition'; -import { ResolveContext } from '../resolve/resolveContext'; -import { TransitionStateHookFn, TransitionHookFn } from '../transition/interface'; -import { TransitionService } from '../transition/transitionService'; -import { val } from '../common/hof'; -import { StateDeclaration } from '../state/interface'; +import { noop } from '../common/common.js'; +import { Transition } from '../transition/transition.js'; +import { ResolveContext } from '../resolve/resolveContext.js'; +import { TransitionStateHookFn, TransitionHookFn } from '../transition/interface.js'; +import { TransitionService } from '../transition/transitionService.js'; +import { val } from '../common/hof.js'; +import { StateDeclaration } from '../state/interface.js'; export const RESOLVE_HOOK_PRIORITY = 1000; diff --git a/src/hooks/updateGlobals.ts b/src/hooks/updateGlobals.ts index 4e0517f3..2d156895 100644 --- a/src/hooks/updateGlobals.ts +++ b/src/hooks/updateGlobals.ts @@ -1,6 +1,6 @@ -import { Transition } from '../transition/transition'; -import { copy } from '../common/common'; -import { TransitionService } from '../transition/transitionService'; +import { Transition } from '../transition/transition.js'; +import { copy } from '../common/common.js'; +import { TransitionService } from '../transition/transitionService.js'; /** * A [[TransitionHookFn]] which updates global UI-Router state diff --git a/src/hooks/url.ts b/src/hooks/url.ts index 07439fdc..fa6a3ddd 100644 --- a/src/hooks/url.ts +++ b/src/hooks/url.ts @@ -1,8 +1,8 @@ -import { UrlRouter } from '../url/urlRouter'; -import { StateService } from '../state/stateService'; -import { Transition } from '../transition/transition'; -import { TransitionHookFn } from '../transition/interface'; -import { TransitionService } from '../transition/transitionService'; +import { UrlRouter } from '../url/urlRouter.js'; +import { StateService } from '../state/stateService.js'; +import { Transition } from '../transition/transition.js'; +import { TransitionHookFn } from '../transition/interface.js'; +import { TransitionService } from '../transition/transitionService.js'; /** * A [[TransitionHookFn]] which updates the URL after a successful transition diff --git a/src/hooks/views.ts b/src/hooks/views.ts index a35771ee..ee0f497a 100644 --- a/src/hooks/views.ts +++ b/src/hooks/views.ts @@ -1,10 +1,10 @@ -import { noop } from '../common/common'; -import { services } from '../common/coreservices'; -import { Transition } from '../transition/transition'; -import { ViewService } from '../view/view'; -import { ViewConfig } from '../view/interface'; -import { TransitionHookFn } from '../transition/interface'; -import { TransitionService } from '../transition/transitionService'; +import { noop } from '../common/common.js'; +import { services } from '../common/coreservices.js'; +import { Transition } from '../transition/transition.js'; +import { ViewService } from '../view/view.js'; +import { ViewConfig } from '../view/interface.js'; +import { TransitionHookFn } from '../transition/interface.js'; +import { TransitionService } from '../transition/transitionService.js'; /** * A [[TransitionHookFn]] which waits for the views to load diff --git a/src/index.ts b/src/index.ts index 470fb7b8..933c8edb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,13 @@ -export * from './common/index'; -export * from './params/index'; -export * from './path/index'; -export * from './resolve/index'; -export * from './state/index'; -export * from './transition/index'; -export * from './url/index'; -export * from './view/index'; -export * from './globals'; +export * from './common/index.js'; +export * from './params/index.js'; +export * from './path/index.js'; +export * from './resolve/index.js'; +export * from './state/index.js'; +export * from './transition/index.js'; +export * from './url/index.js'; +export * from './view/index.js'; +export * from './globals.js'; -export * from './router'; -export * from './vanilla'; -export * from './interface'; +export * from './router.js'; +export * from './vanilla.js'; +export * from './interface.js'; diff --git a/src/interface.ts b/src/interface.ts index 45599217..a750d6dd 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -7,8 +7,8 @@ * @packageDocumentation */ // Need to import or export at least one concrete something -import { noop } from './common/common'; -import { UIRouter } from './router'; +import { noop } from './common/common.js'; +import { UIRouter } from './router.js'; /** * An interface for getting values from dependency injection. diff --git a/src/params/index.ts b/src/params/index.ts index b386de3a..d7ddb406 100644 --- a/src/params/index.ts +++ b/src/params/index.ts @@ -5,8 +5,8 @@ * * @packageDocumentation @preferred */ -export * from './interface'; -export * from './param'; -export * from './paramTypes'; -export * from './stateParams'; -export * from './paramType'; +export * from './interface.js'; +export * from './param.js'; +export * from './paramTypes.js'; +export * from './stateParams.js'; +export * from './paramType.js'; diff --git a/src/params/interface.ts b/src/params/interface.ts index a0fe2171..8e944872 100644 --- a/src/params/interface.ts +++ b/src/params/interface.ts @@ -1,4 +1,4 @@ -import { ParamType } from './paramType'; +import { ParamType } from './paramType.js'; /** * Parameter values diff --git a/src/params/param.ts b/src/params/param.ts index c3ef8b29..234c7b11 100644 --- a/src/params/param.ts +++ b/src/params/param.ts @@ -1,12 +1,12 @@ -import { extend, filter, map, allTrueR, find } from '../common/common'; -import { prop } from '../common/hof'; -import { isInjectable, isDefined, isString, isArray, isUndefined } from '../common/predicates'; -import { RawParams, ParamDeclaration } from '../params/interface'; -import { services } from '../common/coreservices'; -import { ParamType } from './paramType'; -import { ParamTypes } from './paramTypes'; -import { StateDeclaration } from '../state'; -import { UrlConfig } from '../url'; +import { extend, filter, map, allTrueR, find } from '../common/common.js'; +import { prop } from '../common/hof.js'; +import { isInjectable, isDefined, isString, isArray, isUndefined } from '../common/predicates.js'; +import { RawParams, ParamDeclaration } from '../params/interface.js'; +import { services } from '../common/coreservices.js'; +import { ParamType } from './paramType.js'; +import { ParamTypes } from './paramTypes.js'; +import { StateDeclaration } from '../state/index.js'; +import { UrlConfig } from '../url/index.js'; const hasOwn = Object.prototype.hasOwnProperty; diff --git a/src/params/paramType.ts b/src/params/paramType.ts index 7b39b3bc..27692067 100644 --- a/src/params/paramType.ts +++ b/src/params/paramType.ts @@ -1,6 +1,6 @@ -import { extend, filter, map } from '../common/common'; -import { isArray, isDefined } from '../common/predicates'; -import { ParamTypeDefinition } from './interface'; +import { extend, filter, map } from '../common/common.js'; +import { isArray, isDefined } from '../common/predicates.js'; +import { ParamTypeDefinition } from './interface.js'; /** * An internal class which implements [[ParamTypeDefinition]]. diff --git a/src/params/paramTypes.ts b/src/params/paramTypes.ts index 4abca31a..bf4d5bf1 100644 --- a/src/params/paramTypes.ts +++ b/src/params/paramTypes.ts @@ -1,9 +1,9 @@ -import { fromJson, toJson, identity, equals, inherit, map, extend, pick } from '../common/common'; -import { isDefined, isNullOrUndefined } from '../common/predicates'; -import { is } from '../common/hof'; -import { services } from '../common/coreservices'; -import { ParamType } from './paramType'; -import { ParamTypeDefinition } from './interface'; +import { fromJson, toJson, identity, equals, inherit, map, extend, pick } from '../common/common.js'; +import { isDefined, isNullOrUndefined } from '../common/predicates.js'; +import { is } from '../common/hof.js'; +import { services } from '../common/coreservices.js'; +import { ParamType } from './paramType.js'; +import { ParamTypeDefinition } from './interface.js'; /** * A registry for parameter types. diff --git a/src/params/stateParams.ts b/src/params/stateParams.ts index b79f3893..bb8a3302 100644 --- a/src/params/stateParams.ts +++ b/src/params/stateParams.ts @@ -1,6 +1,6 @@ -import { Param } from '.'; -import { extend, ancestors, Obj } from '../common/common'; -import { StateObject } from '../state/stateObject'; +import { Param } from '../index.js'; +import { extend, ancestors, Obj } from '../common/common.js'; +import { StateObject } from '../state/stateObject.js'; export class StateParams { [key: string]: any; diff --git a/src/path/index.ts b/src/path/index.ts index 02bbf913..270cc7c3 100644 --- a/src/path/index.ts +++ b/src/path/index.ts @@ -1,2 +1,2 @@ -export * from './pathNode'; -export * from './pathUtils'; +export * from './pathNode.js'; +export * from './pathUtils.js'; diff --git a/src/path/pathNode.ts b/src/path/pathNode.ts index d0c54423..b934d5a6 100644 --- a/src/path/pathNode.ts +++ b/src/path/pathNode.ts @@ -1,10 +1,10 @@ -import { extend, applyPairs, find, allTrueR, pairs, arrayTuples } from '../common/common'; -import { propEq } from '../common/hof'; -import { StateObject } from '../state/stateObject'; -import { RawParams } from '../params/interface'; -import { Param } from '../params/param'; -import { Resolvable } from '../resolve/resolvable'; -import { ViewConfig } from '../view/interface'; +import { extend, applyPairs, find, allTrueR, pairs, arrayTuples } from '../common/common.js'; +import { propEq } from '../common/hof.js'; +import { StateObject } from '../state/stateObject.js'; +import { RawParams } from '../params/interface.js'; +import { Param } from '../params/param.js'; +import { Resolvable } from '../resolve/resolvable.js'; +import { ViewConfig } from '../view/interface.js'; /** * A node in a [[TreeChanges]] path diff --git a/src/path/pathUtils.ts b/src/path/pathUtils.ts index 6752d849..01b5440c 100644 --- a/src/path/pathUtils.ts +++ b/src/path/pathUtils.ts @@ -10,20 +10,20 @@ import { Predicate, inArray, arrayTuples, -} from '../common/common'; -import { prop, propEq, not } from '../common/hof'; - -import { RawParams } from '../params/interface'; -import { TreeChanges } from '../transition/interface'; -import { ViewConfig } from '../view/interface'; -import { _ViewDeclaration } from '../state/interface'; - -import { StateObject } from '../state/stateObject'; -import { TargetState } from '../state/targetState'; -import { GetParamsFn, PathNode } from './pathNode'; -import { ViewService } from '../view/view'; -import { Param } from '../params/param'; -import { StateRegistry } from '../state'; +} from '../common/common.js'; +import { prop, propEq, not } from '../common/hof.js'; + +import { RawParams } from '../params/interface.js'; +import { TreeChanges } from '../transition/interface.js'; +import { ViewConfig } from '../view/interface.js'; +import { _ViewDeclaration } from '../state/interface.js'; + +import { StateObject } from '../state/stateObject.js'; +import { TargetState } from '../state/targetState.js'; +import { GetParamsFn, PathNode } from './pathNode.js'; +import { ViewService } from '../view/view.js'; +import { Param } from '../params/param.js'; +import { StateRegistry } from '../state/index.js'; /** * This class contains functions which convert TargetStates, Nodes and paths from one type to another. diff --git a/src/resolve/index.ts b/src/resolve/index.ts index b54145a2..da23833a 100644 --- a/src/resolve/index.ts +++ b/src/resolve/index.ts @@ -1,3 +1,3 @@ -export * from './interface'; -export * from './resolvable'; -export * from './resolveContext'; +export * from './interface.js'; +export * from './resolvable.js'; +export * from './resolveContext.js'; diff --git a/src/resolve/resolvable.ts b/src/resolve/resolvable.ts index d665ba04..c9a9b186 100644 --- a/src/resolve/resolvable.ts +++ b/src/resolve/resolvable.ts @@ -1,15 +1,15 @@ -import { extend, identity } from '../common/common'; -import { services } from '../common/coreservices'; -import { trace } from '../common/trace'; -import { ResolvePolicy, ResolvableLiteral, PolicyAsync } from './interface'; - -import { ResolveContext } from './resolveContext'; -import { stringify } from '../common/strings'; -import { isFunction, isObject } from '../common/predicates'; -import { Transition } from '../transition/transition'; -import { StateObject } from '../state/stateObject'; -import { PathNode } from '../path/pathNode'; -import { isNullOrUndefined } from '../common/predicates'; +import { extend, identity } from '../common/common.js'; +import { services } from '../common/coreservices.js'; +import { trace } from '../common/trace.js'; +import { ResolvePolicy, ResolvableLiteral, PolicyAsync } from './interface.js'; + +import { ResolveContext } from './resolveContext.js'; +import { stringify } from '../common/strings.js'; +import { isFunction, isObject } from '../common/predicates.js'; +import { Transition } from '../transition/transition.js'; +import { StateObject } from '../state/stateObject.js'; +import { PathNode } from '../path/pathNode.js'; +import { isNullOrUndefined } from '../common/predicates.js'; // TODO: explicitly make this user configurable export let defaultResolvePolicy: ResolvePolicy = { diff --git a/src/resolve/resolveContext.ts b/src/resolve/resolveContext.ts index 01202497..76f3a467 100644 --- a/src/resolve/resolveContext.ts +++ b/src/resolve/resolveContext.ts @@ -1,16 +1,16 @@ -import { find, tail, uniqR, unnestR, inArray } from '../common/common'; -import { propEq, not } from '../common/hof'; -import { trace } from '../common/trace'; -import { services, $InjectorLike } from '../common/coreservices'; -import { resolvePolicies, PolicyWhen, ResolvePolicy } from './interface'; -import { PathNode } from '../path/pathNode'; -import { Resolvable } from './resolvable'; -import { StateObject } from '../state/stateObject'; -import { PathUtils } from '../path/pathUtils'; -import { stringify } from '../common/strings'; -import { Transition } from '../transition/transition'; -import { UIInjector } from '../interface'; -import { isUndefined } from '../common'; +import { find, tail, uniqR, unnestR, inArray } from '../common/common.js'; +import { propEq, not } from '../common/hof.js'; +import { trace } from '../common/trace.js'; +import { services, $InjectorLike } from '../common/coreservices.js'; +import { resolvePolicies, PolicyWhen, ResolvePolicy } from './interface.js'; +import { PathNode } from '../path/pathNode.js'; +import { Resolvable } from './resolvable.js'; +import { StateObject } from '../state/stateObject.js'; +import { PathUtils } from '../path/pathUtils.js'; +import { stringify } from '../common/strings.js'; +import { Transition } from '../transition/transition.js'; +import { UIInjector } from '../interface.js'; +import { isUndefined } from '../common/index.js'; const whens = resolvePolicies.when; const ALL_WHENS = [whens.EAGER, whens.LAZY]; diff --git a/src/router.ts b/src/router.ts index 46b9daa2..eaa5d13d 100644 --- a/src/router.ts +++ b/src/router.ts @@ -1,17 +1,17 @@ -import { UrlMatcherFactory } from './url/urlMatcherFactory'; -import { UrlRouter } from './url/urlRouter'; -import { TransitionService } from './transition/transitionService'; -import { ViewService } from './view/view'; -import { StateRegistry } from './state/stateRegistry'; -import { StateService } from './state/stateService'; -import { UIRouterGlobals } from './globals'; -import { UIRouterPlugin, Disposable } from './interface'; -import { values, removeFrom } from './common/common'; -import { isFunction } from './common/predicates'; -import { UrlService } from './url/urlService'; -import { LocationServices, LocationConfig } from './common/coreservices'; -import { Trace, trace } from './common/trace'; -import { makeStub } from './common'; +import { UrlMatcherFactory } from './url/urlMatcherFactory.js'; +import { UrlRouter } from './url/urlRouter.js'; +import { TransitionService } from './transition/transitionService.js'; +import { ViewService } from './view/view.js'; +import { StateRegistry } from './state/stateRegistry.js'; +import { StateService } from './state/stateService.js'; +import { UIRouterGlobals } from './globals.js'; +import { UIRouterPlugin, Disposable } from './interface.js'; +import { values, removeFrom } from './common/common.js'; +import { isFunction } from './common/predicates.js'; +import { UrlService } from './url/urlService.js'; +import { LocationServices, LocationConfig } from './common/coreservices.js'; +import { Trace, trace } from './common/trace.js'; +import { makeStub } from './common/index.js'; /** @internal */ let _routerInstance = 0; diff --git a/src/state/index.ts b/src/state/index.ts index 79cf0995..f741a4ed 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -18,11 +18,11 @@ * * @packageDocumentation */ -export * from './interface'; -export * from './stateBuilder'; -export * from './stateObject'; -export * from './stateMatcher'; -export * from './stateQueueManager'; -export * from './stateRegistry'; -export * from './stateService'; -export * from './targetState'; +export * from './interface.js'; +export * from './stateBuilder.js'; +export * from './stateObject.js'; +export * from './stateMatcher.js'; +export * from './stateQueueManager.js'; +export * from './stateRegistry.js'; +export * from './stateService.js'; +export * from './targetState.js'; diff --git a/src/state/interface.ts b/src/state/interface.ts index 3188dbc0..996bd004 100644 --- a/src/state/interface.ts +++ b/src/state/interface.ts @@ -1,12 +1,12 @@ -import { ParamDeclaration, RawParams } from '../params/interface'; -import { StateObject } from './stateObject'; -import { ViewContext } from '../view/interface'; -import { IInjectable } from '../common/common'; -import { Transition } from '../transition/transition'; -import { TransitionStateHookFn, TransitionOptions } from '../transition/interface'; -import { ResolvePolicy, ResolvableLiteral, ProviderLike } from '../resolve/interface'; -import { Resolvable } from '../resolve/resolvable'; -import { TargetState } from './targetState'; +import { ParamDeclaration, RawParams } from '../params/interface.js'; +import { StateObject } from './stateObject.js'; +import { ViewContext } from '../view/interface.js'; +import { IInjectable } from '../common/common.js'; +import { Transition } from '../transition/transition.js'; +import { TransitionStateHookFn, TransitionOptions } from '../transition/interface.js'; +import { ResolvePolicy, ResolvableLiteral, ProviderLike } from '../resolve/interface.js'; +import { Resolvable } from '../resolve/resolvable.js'; +import { TargetState } from './targetState.js'; export type StateOrName = string | StateDeclaration | StateObject; diff --git a/src/state/stateBuilder.ts b/src/state/stateBuilder.ts index 6a2dca34..627d57f1 100644 --- a/src/state/stateBuilder.ts +++ b/src/state/stateBuilder.ts @@ -1,19 +1,31 @@ -import { applyPairs, extend, identity, inherit, mapObj, noop, Obj, omit, tail, values, copy } from '../common/common'; -import { isArray, isDefined, isFunction, isString } from '../common/predicates'; -import { stringify } from '../common/strings'; -import { is, pattern, pipe, prop, val } from '../common/hof'; -import { StateDeclaration } from './interface'; - -import { StateObject } from './stateObject'; -import { StateMatcher } from './stateMatcher'; -import { Param } from '../params/param'; -import { UrlMatcherFactory } from '../url/urlMatcherFactory'; -import { UrlMatcher } from '../url/urlMatcher'; -import { Resolvable } from '../resolve/resolvable'; -import { services } from '../common/coreservices'; -import { ResolvePolicy } from '../resolve/interface'; -import { ParamDeclaration } from '../params'; -import { ParamFactory } from '../url'; +import { + applyPairs, + extend, + identity, + inherit, + mapObj, + noop, + Obj, + omit, + tail, + values, + copy, +} from '../common/common.js'; +import { isArray, isDefined, isFunction, isString } from '../common/predicates.js'; +import { stringify } from '../common/strings.js'; +import { is, pattern, pipe, prop, val } from '../common/hof.js'; +import { StateDeclaration } from './interface.js'; + +import { StateObject } from './stateObject.js'; +import { StateMatcher } from './stateMatcher.js'; +import { Param } from '../params/param.js'; +import { UrlMatcherFactory } from '../url/urlMatcherFactory.js'; +import { UrlMatcher } from '../url/urlMatcher.js'; +import { Resolvable } from '../resolve/resolvable.js'; +import { services } from '../common/coreservices.js'; +import { ResolvePolicy } from '../resolve/interface.js'; +import { ParamDeclaration } from '../params/index.js'; +import { ParamFactory } from '../url/index.js'; const parseUrl = (url: string): any => { if (!isString(url)) return false; diff --git a/src/state/stateMatcher.ts b/src/state/stateMatcher.ts index ee572b65..4d718161 100644 --- a/src/state/stateMatcher.ts +++ b/src/state/stateMatcher.ts @@ -1,8 +1,8 @@ -import { isString } from '../common/predicates'; -import { StateOrName } from './interface'; -import { StateObject } from './stateObject'; -import { values } from '../common/common'; -import { safeConsole } from '../common/safeConsole'; +import { isString } from '../common/predicates.js'; +import { StateOrName } from './interface.js'; +import { StateObject } from './stateObject.js'; +import { values } from '../common/common.js'; +import { safeConsole } from '../common/safeConsole.js'; export class StateMatcher { constructor(private _states: { [key: string]: StateObject }) {} diff --git a/src/state/stateObject.ts b/src/state/stateObject.ts index cb6f4406..2e0f44e7 100644 --- a/src/state/stateObject.ts +++ b/src/state/stateObject.ts @@ -1,14 +1,14 @@ -import { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from './interface'; -import { defaults, values, find, inherit } from '../common/common'; -import { propEq } from '../common/hof'; -import { Param } from '../params/param'; -import { UrlMatcher } from '../url/urlMatcher'; -import { Resolvable } from '../resolve/resolvable'; -import { TransitionStateHookFn } from '../transition/interface'; -import { TargetState } from './targetState'; -import { Transition } from '../transition/transition'; -import { Glob } from '../common/glob'; -import { isObject, isFunction } from '../common/predicates'; +import { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from './interface.js'; +import { defaults, values, find, inherit } from '../common/common.js'; +import { propEq } from '../common/hof.js'; +import { Param } from '../params/param.js'; +import { UrlMatcher } from '../url/urlMatcher.js'; +import { Resolvable } from '../resolve/resolvable.js'; +import { TransitionStateHookFn } from '../transition/interface.js'; +import { TargetState } from './targetState.js'; +import { Transition } from '../transition/transition.js'; +import { Glob } from '../common/glob.js'; +import { isObject, isFunction } from '../common/predicates.js'; /** * Internal representation of a UI-Router state. diff --git a/src/state/stateQueueManager.ts b/src/state/stateQueueManager.ts index d7ca75f3..d5c9b15d 100644 --- a/src/state/stateQueueManager.ts +++ b/src/state/stateQueueManager.ts @@ -1,10 +1,10 @@ -import { inArray, isString, prop } from '../common'; -import { _StateDeclaration } from './interface'; -import { StateObject } from './stateObject'; -import { StateBuilder } from './stateBuilder'; -import { StateRegistryListener } from './stateRegistry'; -import { Disposable } from '../interface'; -import { UIRouter } from '../router'; +import { inArray, isString, prop } from '../common/index.js'; +import { _StateDeclaration } from './interface.js'; +import { StateObject } from './stateObject.js'; +import { StateBuilder } from './stateBuilder.js'; +import { StateRegistryListener } from './stateRegistry.js'; +import { Disposable } from '../interface.js'; +import { UIRouter } from '../router.js'; export class StateQueueManager implements Disposable { queue: StateObject[] = []; diff --git a/src/state/stateRegistry.ts b/src/state/stateRegistry.ts index e6ab1a9d..ee423dc4 100644 --- a/src/state/stateRegistry.ts +++ b/src/state/stateRegistry.ts @@ -1,13 +1,13 @@ -import { StateObject } from './stateObject'; -import { StateMatcher } from './stateMatcher'; -import { StateBuilder } from './stateBuilder'; -import { StateQueueManager } from './stateQueueManager'; -import { StateDeclaration, _StateDeclaration } from './interface'; -import { BuilderFunction } from './stateBuilder'; -import { StateOrName } from './interface'; -import { removeFrom } from '../common/common'; -import { UIRouter } from '../router'; -import { propEq } from '../common/hof'; +import { StateObject } from './stateObject.js'; +import { StateMatcher } from './stateMatcher.js'; +import { StateBuilder } from './stateBuilder.js'; +import { StateQueueManager } from './stateQueueManager.js'; +import { StateDeclaration, _StateDeclaration } from './interface.js'; +import { BuilderFunction } from './stateBuilder.js'; +import { StateOrName } from './interface.js'; +import { removeFrom } from '../common/common.js'; +import { UIRouter } from '../router.js'; +import { propEq } from '../common/hof.js'; /** * The signature for the callback function provided to [[StateRegistry.onStatesChanged]]. diff --git a/src/state/stateService.ts b/src/state/stateService.ts index e7d46333..c6eedd85 100644 --- a/src/state/stateService.ts +++ b/src/state/stateService.ts @@ -7,32 +7,32 @@ import { removeFrom, silenceUncaughtInPromise, silentRejection, -} from '../common/common'; -import { isDefined, isObject, isString } from '../common/predicates'; -import { Queue } from '../common/queue'; -import { services } from '../common/coreservices'; - -import { PathUtils } from '../path/pathUtils'; -import { PathNode } from '../path/pathNode'; - -import { HookResult, TransitionOptions } from '../transition/interface'; -import { defaultTransOpts } from '../transition/transitionService'; -import { Rejection, RejectType } from '../transition/rejectFactory'; -import { Transition } from '../transition/transition'; - -import { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface'; -import { StateObject } from './stateObject'; -import { TargetState } from './targetState'; - -import { RawParams } from '../params/interface'; -import { Param } from '../params/param'; -import { Glob } from '../common/glob'; -import { UIRouter } from '../router'; -import { UIInjector } from '../interface'; -import { ResolveContext } from '../resolve/resolveContext'; -import { lazyLoadState } from '../hooks/lazyLoad'; -import { not, val } from '../common/hof'; -import { StateParams } from '../params/stateParams'; +} from '../common/common.js'; +import { isDefined, isObject, isString } from '../common/predicates.js'; +import { Queue } from '../common/queue.js'; +import { services } from '../common/coreservices.js'; + +import { PathUtils } from '../path/pathUtils.js'; +import { PathNode } from '../path/pathNode.js'; + +import { HookResult, TransitionOptions } from '../transition/interface.js'; +import { defaultTransOpts } from '../transition/transitionService.js'; +import { Rejection, RejectType } from '../transition/rejectFactory.js'; +import { Transition } from '../transition/transition.js'; + +import { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface.js'; +import { StateObject } from './stateObject.js'; +import { TargetState } from './targetState.js'; + +import { RawParams } from '../params/interface.js'; +import { Param } from '../params/param.js'; +import { Glob } from '../common/glob.js'; +import { UIRouter } from '../router.js'; +import { UIInjector } from '../interface.js'; +import { ResolveContext } from '../resolve/resolveContext.js'; +import { lazyLoadState } from '../hooks/lazyLoad.js'; +import { not, val } from '../common/hof.js'; +import { StateParams } from '../params/stateParams.js'; export type OnInvalidCallback = (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult; @@ -354,35 +354,37 @@ export class StateService { * no error occurred. Likewise, the transition.run() promise may be rejected because of * a Redirect, but the transitionTo() promise is chained to the new Transition's promise. */ - const rejectedTransitionHandler = (trans: Transition) => (error: any): Promise => { - if (error instanceof Rejection) { - const isLatest = router.globals.lastStartedTransitionId <= trans.$id; - - if (error.type === RejectType.IGNORED) { - isLatest && router.urlRouter.update(); - // Consider ignored `Transition.run()` as a successful `transitionTo` - return services.$q.when(globals.current); + const rejectedTransitionHandler = + (trans: Transition) => + (error: any): Promise => { + if (error instanceof Rejection) { + const isLatest = router.globals.lastStartedTransitionId <= trans.$id; + + if (error.type === RejectType.IGNORED) { + isLatest && router.urlRouter.update(); + // Consider ignored `Transition.run()` as a successful `transitionTo` + return services.$q.when(globals.current); + } + + const detail: any = error.detail; + if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) { + // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully + // by returning the promise for the new (redirect) `Transition.run()`. + const redirect: Transition = trans.redirect(detail); + return redirect.run().catch(rejectedTransitionHandler(redirect)); + } + + if (error.type === RejectType.ABORTED) { + isLatest && router.urlRouter.update(); + return services.$q.reject(error); + } } - const detail: any = error.detail; - if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) { - // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully - // by returning the promise for the new (redirect) `Transition.run()`. - const redirect: Transition = trans.redirect(detail); - return redirect.run().catch(rejectedTransitionHandler(redirect)); - } - - if (error.type === RejectType.ABORTED) { - isLatest && router.urlRouter.update(); - return services.$q.reject(error); - } - } - - const errorHandler = this.defaultErrorHandler(); - errorHandler(error); + const errorHandler = this.defaultErrorHandler(); + errorHandler(error); - return services.$q.reject(error); - }; + return services.$q.reject(error); + }; const transition = this.router.transitionService.create(currentPath, ref); const transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition)); diff --git a/src/state/targetState.ts b/src/state/targetState.ts index cd03140a..707b0936 100644 --- a/src/state/targetState.ts +++ b/src/state/targetState.ts @@ -1,11 +1,11 @@ -import { StateDeclaration, StateOrName, TargetStateDef } from './interface'; -import { TransitionOptions } from '../transition/interface'; -import { StateObject } from './stateObject'; -import { isObject, isString } from '../common/predicates'; -import { stringify } from '../common/strings'; -import { extend } from '../common'; -import { StateRegistry } from './stateRegistry'; -import { RawParams } from '../params'; +import { StateDeclaration, StateOrName, TargetStateDef } from './interface.js'; +import { TransitionOptions } from '../transition/interface.js'; +import { StateObject } from './stateObject.js'; +import { isObject, isString } from '../common/predicates.js'; +import { stringify } from '../common/strings.js'; +import { extend } from '../common/index.js'; +import { StateRegistry } from './stateRegistry.js'; +import { RawParams } from '../params/index.js'; /** * Encapsulate the target (destination) state/params/options of a [[Transition]]. diff --git a/src/transition/hookBuilder.ts b/src/transition/hookBuilder.ts index 6f479708..22abde20 100644 --- a/src/transition/hookBuilder.ts +++ b/src/transition/hookBuilder.ts @@ -1,5 +1,5 @@ -import { extend, tail, assertPredicate, unnestR, identity } from '../common/common'; -import { isArray } from '../common/predicates'; +import { extend, tail, assertPredicate, unnestR, identity } from '../common/common.js'; +import { isArray } from '../common/predicates.js'; import { TransitionOptions, @@ -9,15 +9,15 @@ import { IMatchingNodes, TransitionHookPhase, TransitionHookScope, -} from './interface'; - -import { Transition } from './transition'; -import { TransitionHook } from './transitionHook'; -import { StateObject } from '../state/stateObject'; -import { PathNode } from '../path/pathNode'; -import { TransitionService } from './transitionService'; -import { TransitionEventType } from './transitionEventType'; -import { RegisteredHook } from './hookRegistry'; +} from './interface.js'; + +import { Transition } from './transition.js'; +import { TransitionHook } from './transitionHook.js'; +import { StateObject } from '../state/stateObject.js'; +import { PathNode } from '../path/pathNode.js'; +import { TransitionService } from './transitionService.js'; +import { TransitionEventType } from './transitionEventType.js'; +import { RegisteredHook } from './hookRegistry.js'; /** * This class returns applicable TransitionHooks for a specific Transition instance. diff --git a/src/transition/hookRegistry.ts b/src/transition/hookRegistry.ts index fd798317..e4f19638 100644 --- a/src/transition/hookRegistry.ts +++ b/src/transition/hookRegistry.ts @@ -1,5 +1,5 @@ -import { isString, isFunction, Glob, extend, removeFrom, tail, values, identity, mapObj } from '../common'; -import { PathNode } from '../path/pathNode'; +import { isString, isFunction, Glob, extend, removeFrom, tail, values, identity, mapObj } from '../common/index.js'; +import { PathNode } from '../path/pathNode.js'; import { TransitionStateHookFn, TransitionHookFn, @@ -7,7 +7,7 @@ import { TransitionHookScope, IHookRegistry, PathType, -} from './interface'; +} from './interface.js'; import { HookRegOptions, @@ -16,11 +16,11 @@ import { HookMatchCriterion, IMatchingNodes, HookFn, -} from './interface'; -import { Transition } from './transition'; -import { StateObject } from '../state/stateObject'; -import { TransitionEventType } from './transitionEventType'; -import { TransitionService } from './transitionService'; +} from './interface.js'; +import { Transition } from './transition.js'; +import { StateObject } from '../state/stateObject.js'; +import { TransitionEventType } from './transitionEventType.js'; +import { TransitionService } from './transitionService.js'; /** * Determines if the given state matches the matchCriteria diff --git a/src/transition/index.ts b/src/transition/index.ts index 56312da3..8147a4cd 100644 --- a/src/transition/index.ts +++ b/src/transition/index.ts @@ -10,11 +10,11 @@ * * @packageDocumentation @preferred */ -export * from './interface'; -export * from './hookBuilder'; -export * from './hookRegistry'; -export * from './rejectFactory'; -export * from './transition'; -export * from './transitionHook'; -export * from './transitionEventType'; -export * from './transitionService'; +export * from './interface.js'; +export * from './hookBuilder.js'; +export * from './hookRegistry.js'; +export * from './rejectFactory.js'; +export * from './transition.js'; +export * from './transitionHook.js'; +export * from './transitionEventType.js'; +export * from './transitionService.js'; diff --git a/src/transition/interface.ts b/src/transition/interface.ts index 854bc53d..16056a15 100644 --- a/src/transition/interface.ts +++ b/src/transition/interface.ts @@ -1,11 +1,11 @@ -import { StateDeclaration } from '../state/interface'; -import { PredicateBinary } from '../common/common'; - -import { Transition } from './transition'; -import { StateObject } from '../state/stateObject'; -import { PathNode } from '../path/pathNode'; -import { TargetState } from '../state/targetState'; -import { RegisteredHook } from './hookRegistry'; +import { StateDeclaration } from '../state/interface.js'; +import { PredicateBinary } from '../common/common.js'; + +import { Transition } from './transition.js'; +import { StateObject } from '../state/stateObject.js'; +import { PathNode } from '../path/pathNode.js'; +import { TargetState } from '../state/targetState.js'; +import { RegisteredHook } from './hookRegistry.js'; /** * The TransitionOptions object can be used to change the behavior of a transition. diff --git a/src/transition/rejectFactory.ts b/src/transition/rejectFactory.ts index 6a287365..f9ae30fb 100644 --- a/src/transition/rejectFactory.ts +++ b/src/transition/rejectFactory.ts @@ -1,7 +1,7 @@ 'use strict'; -import { extend, silentRejection } from '../common/common'; -import { stringify } from '../common/strings'; -import { is } from '../common/hof'; +import { extend, silentRejection } from '../common/common.js'; +import { stringify } from '../common/strings.js'; +import { is } from '../common/hof.js'; /** An enum for Transition Rejection reasons */ enum RejectType { diff --git a/src/transition/transition.ts b/src/transition/transition.ts index 79680cc5..6050bbd1 100644 --- a/src/transition/transition.ts +++ b/src/transition/transition.ts @@ -1,10 +1,10 @@ -import { trace } from '../common/trace'; -import { services } from '../common/coreservices'; -import { stringify } from '../common/strings'; -import { map, find, extend, mergeR, tail, omit, arrayTuples, unnestR, identity, anyTrueR } from '../common/common'; -import { isObject, isUndefined } from '../common/predicates'; -import { prop, propEq, val, not, is } from '../common/hof'; -import { StateDeclaration, StateOrName } from '../state/interface'; +import { trace } from '../common/trace.js'; +import { services } from '../common/coreservices.js'; +import { stringify } from '../common/strings.js'; +import { map, find, extend, mergeR, tail, omit, arrayTuples, unnestR, identity, anyTrueR } from '../common/common.js'; +import { isObject, isUndefined } from '../common/predicates.js'; +import { prop, propEq, val, not, is } from '../common/hof.js'; +import { StateDeclaration, StateOrName } from '../state/interface.js'; import { TransitionOptions, TreeChanges, @@ -15,24 +15,24 @@ import { HookMatchCriteria, TransitionStateHookFn, TransitionHookFn, -} from './interface'; // has or is using -import { TransitionHook } from './transitionHook'; -import { matchState, makeEvent, RegisteredHook } from './hookRegistry'; -import { HookBuilder } from './hookBuilder'; -import { PathNode } from '../path/pathNode'; -import { PathUtils } from '../path/pathUtils'; -import { StateObject } from '../state/stateObject'; -import { TargetState } from '../state/targetState'; -import { Param } from '../params/param'; -import { Resolvable } from '../resolve/resolvable'; -import { ViewConfig } from '../view/interface'; -import { ResolveContext } from '../resolve/resolveContext'; -import { UIRouter } from '../router'; -import { UIInjector } from '../interface'; -import { RawParams } from '../params/interface'; -import { ResolvableLiteral } from '../resolve/interface'; -import { Rejection } from './rejectFactory'; -import { applyPairs, flattenR, uniqR } from '../common'; +} from './interface.js'; // has or is using +import { TransitionHook } from './transitionHook.js'; +import { matchState, makeEvent, RegisteredHook } from './hookRegistry.js'; +import { HookBuilder } from './hookBuilder.js'; +import { PathNode } from '../path/pathNode.js'; +import { PathUtils } from '../path/pathUtils.js'; +import { StateObject } from '../state/stateObject.js'; +import { TargetState } from '../state/targetState.js'; +import { Param } from '../params/param.js'; +import { Resolvable } from '../resolve/resolvable.js'; +import { ViewConfig } from '../view/interface.js'; +import { ResolveContext } from '../resolve/resolveContext.js'; +import { UIRouter } from '../router.js'; +import { UIInjector } from '../interface.js'; +import { RawParams } from '../params/interface.js'; +import { ResolvableLiteral } from '../resolve/interface.js'; +import { Rejection } from './rejectFactory.js'; +import { applyPairs, flattenR, uniqR } from '../common/index.js'; /** @internal */ const stateSelf: (_state: StateObject) => StateDeclaration = prop('self'); diff --git a/src/transition/transitionEventType.ts b/src/transition/transitionEventType.ts index 4b3b6401..7bd43989 100644 --- a/src/transition/transitionEventType.ts +++ b/src/transition/transitionEventType.ts @@ -1,5 +1,5 @@ -import { TransitionHookPhase, PathType } from './interface'; -import { GetErrorHandler, GetResultHandler, TransitionHook } from './transitionHook'; +import { TransitionHookPhase, PathType } from './interface.js'; +import { GetErrorHandler, GetResultHandler, TransitionHook } from './transitionHook.js'; /** * This class defines a type of hook, such as `onBefore` or `onEnter`. * Plugins can define custom hook types, such as sticky states does for `onInactive`. diff --git a/src/transition/transitionHook.ts b/src/transition/transitionHook.ts index 8b31f47e..8ecac89c 100644 --- a/src/transition/transitionHook.ts +++ b/src/transition/transitionHook.ts @@ -1,16 +1,16 @@ -import { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface'; -import { defaults, noop, silentRejection } from '../common/common'; -import { fnToString, maxLength } from '../common/strings'; -import { isPromise } from '../common/predicates'; -import { is, parse } from '../common/hof'; -import { trace } from '../common/trace'; -import { services } from '../common/coreservices'; -import { Rejection } from './rejectFactory'; -import { TargetState } from '../state/targetState'; -import { Transition } from './transition'; -import { TransitionEventType } from './transitionEventType'; -import { RegisteredHook } from './hookRegistry'; -import { StateDeclaration } from '../state/interface'; +import { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface.js'; +import { defaults, noop, silentRejection } from '../common/common.js'; +import { fnToString, maxLength } from '../common/strings.js'; +import { isPromise } from '../common/predicates.js'; +import { is, parse } from '../common/hof.js'; +import { trace } from '../common/trace.js'; +import { services } from '../common/coreservices.js'; +import { Rejection } from './rejectFactory.js'; +import { TargetState } from '../state/targetState.js'; +import { Transition } from './transition.js'; +import { TransitionEventType } from './transitionEventType.js'; +import { RegisteredHook } from './hookRegistry.js'; +import { StateDeclaration } from '../state/interface.js'; const defaultOptions: TransitionHookOptions = { current: noop, diff --git a/src/transition/transitionService.ts b/src/transition/transitionService.ts index 22b91ee5..4ccec38c 100644 --- a/src/transition/transitionService.ts +++ b/src/transition/transitionService.ts @@ -11,29 +11,29 @@ import { RegisteredHooks, TransitionHookFn, TransitionStateHookFn, -} from './interface'; -import { Transition } from './transition'; -import { makeEvent, RegisteredHook } from './hookRegistry'; -import { TargetState } from '../state/targetState'; -import { PathNode } from '../path/pathNode'; -import { ViewService } from '../view/view'; -import { UIRouter } from '../router'; -import { registerAddCoreResolvables, treeChangesCleanup } from '../hooks/coreResolvables'; -import { registerRedirectToHook } from '../hooks/redirectTo'; -import { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from '../hooks/onEnterExitRetain'; -import { registerEagerResolvePath, registerLazyResolveState, registerResolveRemaining } from '../hooks/resolve'; -import { registerLoadEnteringViews, registerActivateViews } from '../hooks/views'; -import { registerUpdateGlobalState } from '../hooks/updateGlobals'; -import { registerUpdateUrl } from '../hooks/url'; -import { registerLazyLoadHook } from '../hooks/lazyLoad'; -import { TransitionEventType } from './transitionEventType'; -import { TransitionHook, GetResultHandler, GetErrorHandler } from './transitionHook'; -import { isDefined } from '../common/predicates'; -import { removeFrom, values, createProxyFunctions } from '../common/common'; -import { Disposable } from '../interface'; // has or is using -import { val } from '../common/hof'; -import { registerIgnoredTransitionHook } from '../hooks/ignoredTransition'; -import { registerInvalidTransitionHook } from '../hooks/invalidTransition'; +} from './interface.js'; +import { Transition } from './transition.js'; +import { makeEvent, RegisteredHook } from './hookRegistry.js'; +import { TargetState } from '../state/targetState.js'; +import { PathNode } from '../path/pathNode.js'; +import { ViewService } from '../view/view.js'; +import { UIRouter } from '../router.js'; +import { registerAddCoreResolvables, treeChangesCleanup } from '../hooks/coreResolvables.js'; +import { registerRedirectToHook } from '../hooks/redirectTo.js'; +import { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from '../hooks/onEnterExitRetain.js'; +import { registerEagerResolvePath, registerLazyResolveState, registerResolveRemaining } from '../hooks/resolve.js'; +import { registerLoadEnteringViews, registerActivateViews } from '../hooks/views.js'; +import { registerUpdateGlobalState } from '../hooks/updateGlobals.js'; +import { registerUpdateUrl } from '../hooks/url.js'; +import { registerLazyLoadHook } from '../hooks/lazyLoad.js'; +import { TransitionEventType } from './transitionEventType.js'; +import { TransitionHook, GetResultHandler, GetErrorHandler } from './transitionHook.js'; +import { isDefined } from '../common/predicates.js'; +import { removeFrom, values, createProxyFunctions } from '../common/common.js'; +import { Disposable } from '../interface.js'; // has or is using +import { val } from '../common/hof.js'; +import { registerIgnoredTransitionHook } from '../hooks/ignoredTransition.js'; +import { registerInvalidTransitionHook } from '../hooks/invalidTransition.js'; /** * The default [[Transition]] options. diff --git a/src/url/index.ts b/src/url/index.ts index fb1896e4..7d136be6 100644 --- a/src/url/index.ts +++ b/src/url/index.ts @@ -1,8 +1,8 @@ -export * from './interface'; -export * from './urlMatcher'; -export * from './urlMatcherFactory'; -export * from './urlRouter'; -export * from './urlRule'; -export * from './urlService'; -export { UrlRules } from './urlRules'; -export { UrlConfig } from './urlConfig'; +export * from './interface.js'; +export * from './urlMatcher.js'; +export * from './urlMatcherFactory.js'; +export * from './urlRouter.js'; +export * from './urlRule.js'; +export * from './urlService.js'; +export { UrlRules } from './urlRules.js'; +export { UrlConfig } from './urlConfig.js'; diff --git a/src/url/interface.ts b/src/url/interface.ts index 1e010030..f4cf7bc5 100644 --- a/src/url/interface.ts +++ b/src/url/interface.ts @@ -8,13 +8,13 @@ * @packageDocumentation * @preferred */ -import { LocationConfig } from '../common'; -import { UIRouter } from '../router'; -import { StateDeclaration, StateObject, TargetState, TargetStateDef } from '../state'; -import { UrlMatcher } from './urlMatcher'; -import { UrlConfig } from './urlConfig'; -import { UrlRules } from './urlRules'; -import { UrlService } from './urlService'; +import { LocationConfig } from '../common/index.js'; +import { UIRouter } from '../router.js'; +import { StateDeclaration, StateObject, TargetState, TargetStateDef } from '../state/index.js'; +import { UrlMatcher } from './urlMatcher.js'; +import { UrlConfig } from './urlConfig.js'; +import { UrlRules } from './urlRules.js'; +import { UrlService } from './urlService.js'; export interface UrlMatcherCompileConfig { // If state is provided, use the configuration in the `params` block diff --git a/src/url/urlConfig.ts b/src/url/urlConfig.ts index 613f8c5f..4ff0d640 100644 --- a/src/url/urlConfig.ts +++ b/src/url/urlConfig.ts @@ -1,7 +1,7 @@ -import { Disposable } from '../interface'; -import { UIRouter } from '../router'; -import { ParamTypeDefinition, ParamTypes } from '../params'; -import { isDefined, isString } from '../common'; +import { Disposable } from '../interface.js'; +import { UIRouter } from '../router.js'; +import { ParamTypeDefinition, ParamTypes } from '../params/index.js'; +import { isDefined, isString } from '../common/index.js'; /** * An API to customize the URL behavior and retrieve URL configuration diff --git a/src/url/urlMatcher.ts b/src/url/urlMatcher.ts index 599cccbd..e283534a 100644 --- a/src/url/urlMatcher.ts +++ b/src/url/urlMatcher.ts @@ -1,14 +1,14 @@ -import { map, inherit, identity, unnest, tail, find, Obj, allTrueR, unnestR, arrayTuples } from '../common/common'; -import { prop, propEq } from '../common/hof'; -import { isArray, isString, isDefined } from '../common/predicates'; -import { Param, DefType } from '../params/param'; -import { ParamTypes } from '../params/paramTypes'; -import { RawParams } from '../params/interface'; -import { UrlMatcherCompileConfig } from './interface'; -import { joinNeighborsR, splitOnDelim } from '../common/strings'; -import { ParamType } from '../params'; -import { defaults } from '../common'; -import { ParamFactory } from './urlMatcherFactory'; +import { map, inherit, identity, unnest, tail, find, Obj, allTrueR, unnestR, arrayTuples } from '../common/common.js'; +import { prop, propEq } from '../common/hof.js'; +import { isArray, isString, isDefined } from '../common/predicates.js'; +import { Param, DefType } from '../params/param.js'; +import { ParamTypes } from '../params/paramTypes.js'; +import { RawParams } from '../params/interface.js'; +import { UrlMatcherCompileConfig } from './interface.js'; +import { joinNeighborsR, splitOnDelim } from '../common/strings.js'; +import { ParamType } from '../params/index.js'; +import { defaults } from '../common/index.js'; +import { ParamFactory } from './urlMatcherFactory.js'; function quoteRegExp(str: any, param?: any) { let surroundPattern = ['', ''], @@ -240,7 +240,8 @@ export class UrlMatcher { // \\. - a backslash escape // \{(?:[^{}\\]+|\\.)*\} - a matched set of curly braces containing other atoms const placeholder = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; - const searchPlaceholder = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + const searchPlaceholder = + /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; const patterns: any[][] = []; let last = 0; let matchArray: RegExpExecArray; diff --git a/src/url/urlMatcherFactory.ts b/src/url/urlMatcherFactory.ts index 66a10427..380c23dd 100644 --- a/src/url/urlMatcherFactory.ts +++ b/src/url/urlMatcherFactory.ts @@ -1,9 +1,9 @@ -import { extend, forEach, isDefined, isFunction, isObject } from '../common'; -import { UrlMatcher } from './urlMatcher'; -import { DefType, Param, ParamType, ParamTypeDefinition } from '../params'; -import { UrlMatcherCompileConfig } from './interface'; -import { StateDeclaration } from '../state'; -import { UIRouter } from '../router'; +import { extend, forEach, isDefined, isFunction, isObject } from '../common/index.js'; +import { UrlMatcher } from './urlMatcher.js'; +import { DefType, Param, ParamType, ParamTypeDefinition } from '../params/index.js'; +import { UrlMatcherCompileConfig } from './interface.js'; +import { StateDeclaration } from '../state/index.js'; +import { UIRouter } from '../router.js'; export class ParamFactory { fromConfig(id: string, type: ParamType, state: StateDeclaration) { diff --git a/src/url/urlRouter.ts b/src/url/urlRouter.ts index ab3ca2d4..0e594f6e 100644 --- a/src/url/urlRouter.ts +++ b/src/url/urlRouter.ts @@ -1,10 +1,10 @@ -import { stripLastPathElement } from '../common'; -import { UrlMatcher } from './urlMatcher'; -import { RawParams } from '../params'; -import { UIRouter } from '../router'; -import { UrlRuleFactory } from './urlRule'; -import { MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn } from './interface'; -import { TargetState, TargetStateDef } from '../state'; +import { stripLastPathElement } from '../common/index.js'; +import { UrlMatcher } from './urlMatcher.js'; +import { RawParams } from '../params/index.js'; +import { UIRouter } from '../router.js'; +import { UrlRuleFactory } from './urlRule.js'; +import { MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn } from './interface.js'; +import { TargetState, TargetStateDef } from '../state/index.js'; function appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string { if (baseHref === '/') return url; diff --git a/src/url/urlRule.ts b/src/url/urlRule.ts index 952cc9e3..3c4501af 100644 --- a/src/url/urlRule.ts +++ b/src/url/urlRule.ts @@ -1,11 +1,11 @@ -import { StateDeclaration } from '../state'; -import { UrlMatcher } from './urlMatcher'; -import { isString, isDefined, isFunction } from '../common/predicates'; -import { UIRouter } from '../router'; -import { identity, extend } from '../common/common'; -import { is, or, pattern } from '../common/hof'; -import { StateObject } from '../state/stateObject'; -import { RawParams } from '../params/interface'; +import { StateDeclaration } from '../state/index.js'; +import { UrlMatcher } from './urlMatcher.js'; +import { isString, isDefined, isFunction } from '../common/predicates.js'; +import { UIRouter } from '../router.js'; +import { identity, extend } from '../common/common.js'; +import { is, or, pattern } from '../common/hof.js'; +import { StateObject } from '../state/stateObject.js'; +import { RawParams } from '../params/interface.js'; import { UrlRule, UrlRuleMatchFn, diff --git a/src/url/urlRules.ts b/src/url/urlRules.ts index 3e1e9869..f1857b25 100644 --- a/src/url/urlRules.ts +++ b/src/url/urlRules.ts @@ -1,10 +1,10 @@ -import { UIRouter } from '../router'; -import { Disposable } from '../interface'; -import { MatcherUrlRule, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi } from './interface'; -import { TargetState, TargetStateDef } from '../state'; -import { UrlMatcher } from './urlMatcher'; -import { is, isDefined, isFunction, isString, removeFrom, val } from '../common'; -import { UrlRuleFactory } from './urlRule'; +import { UIRouter } from '../router.js'; +import { Disposable } from '../interface.js'; +import { MatcherUrlRule, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi } from './interface.js'; +import { TargetState, TargetStateDef } from '../state/index.js'; +import { UrlMatcher } from './urlMatcher.js'; +import { is, isDefined, isFunction, isString, removeFrom, val } from '../common/index.js'; +import { UrlRuleFactory } from './urlRule.js'; const prioritySort = (a: UrlRule, b: UrlRule) => (b.priority || 0) - (a.priority || 0); diff --git a/src/url/urlService.ts b/src/url/urlService.ts index 3652d460..25ffb59c 100644 --- a/src/url/urlService.ts +++ b/src/url/urlService.ts @@ -1,9 +1,9 @@ -import { UIRouter } from '../router'; -import { extend, is, isString, LocationServices, pattern } from '../common'; -import { MatchResult, UrlParts, UrlRule, UrlSyncApi } from './interface'; -import { UrlRules } from './urlRules'; -import { UrlConfig } from './urlConfig'; -import { TargetState, TargetStateDef } from '../state'; +import { UIRouter } from '../router.js'; +import { extend, is, isString, LocationServices, pattern } from '../common/index.js'; +import { MatchResult, UrlParts, UrlRule, UrlSyncApi } from './interface.js'; +import { UrlRules } from './urlRules.js'; +import { UrlConfig } from './urlConfig.js'; +import { TargetState, TargetStateDef } from '../state/index.js'; /** * API for URL management diff --git a/src/vanilla.ts b/src/vanilla.ts index 3bf9d251..b7fc57c4 100644 --- a/src/vanilla.ts +++ b/src/vanilla.ts @@ -1 +1 @@ -export * from './vanilla/index'; +export * from './vanilla/index.js'; diff --git a/src/vanilla/baseLocationService.ts b/src/vanilla/baseLocationService.ts index 9086791e..0349617b 100644 --- a/src/vanilla/baseLocationService.ts +++ b/src/vanilla/baseLocationService.ts @@ -1,8 +1,8 @@ -import { deregAll, isDefined, LocationServices, removeFrom, root } from '../common'; -import { Disposable } from '../interface'; -import { UIRouter } from '../router'; -import { HistoryLike, LocationLike } from './interface'; -import { buildUrl, getParams, parseUrl } from './utils'; +import { deregAll, isDefined, LocationServices, removeFrom, root } from '../common/index.js'; +import { Disposable } from '../interface.js'; +import { UIRouter } from '../router.js'; +import { HistoryLike, LocationLike } from './interface.js'; +import { buildUrl, getParams, parseUrl } from './utils.js'; /** A base `LocationServices` */ export abstract class BaseLocationServices implements LocationServices, Disposable { diff --git a/src/vanilla/browserLocationConfig.ts b/src/vanilla/browserLocationConfig.ts index 945fb4de..76d2f35f 100644 --- a/src/vanilla/browserLocationConfig.ts +++ b/src/vanilla/browserLocationConfig.ts @@ -1,5 +1,5 @@ -import { isDefined, isUndefined } from '../common/predicates'; -import { LocationConfig } from '../common/coreservices'; +import { isDefined, isUndefined } from '../common/predicates.js'; +import { LocationConfig } from '../common/coreservices.js'; /** A `LocationConfig` that delegates to the browser's `location` object */ export class BrowserLocationConfig implements LocationConfig { diff --git a/src/vanilla/hashLocationService.ts b/src/vanilla/hashLocationService.ts index afa6ee49..75088cc0 100644 --- a/src/vanilla/hashLocationService.ts +++ b/src/vanilla/hashLocationService.ts @@ -1,6 +1,6 @@ -import { root, trimHashVal } from '../common'; -import { UIRouter } from '../router'; -import { BaseLocationServices } from './baseLocationService'; +import { root, trimHashVal } from '../common/index.js'; +import { UIRouter } from '../router.js'; +import { BaseLocationServices } from './baseLocationService.js'; /** A `LocationServices` that uses the browser hash "#" to get/set the current location */ export class HashLocationService extends BaseLocationServices { diff --git a/src/vanilla/index.ts b/src/vanilla/index.ts index 682ae6de..19696d47 100644 --- a/src/vanilla/index.ts +++ b/src/vanilla/index.ts @@ -3,18 +3,18 @@ * * @packageDocumentation */ -export * from './interface'; +export * from './interface.js'; -export * from './q'; -export * from './injector'; +export * from './q.js'; +export * from './injector.js'; -export * from './baseLocationService'; -export * from './hashLocationService'; -export * from './memoryLocationService'; -export * from './pushStateLocationService'; +export * from './baseLocationService.js'; +export * from './hashLocationService.js'; +export * from './memoryLocationService.js'; +export * from './pushStateLocationService.js'; -export * from './memoryLocationConfig'; -export * from './browserLocationConfig'; +export * from './memoryLocationConfig.js'; +export * from './browserLocationConfig.js'; -export * from './utils'; -export * from './plugins'; +export * from './utils.js'; +export * from './plugins.js'; diff --git a/src/vanilla/injector.ts b/src/vanilla/injector.ts index cb9a5cf6..58cfa6e1 100644 --- a/src/vanilla/injector.ts +++ b/src/vanilla/injector.ts @@ -6,7 +6,7 @@ import { isInjectable, $InjectorLike, IInjectable, -} from '../common/index'; +} from '../common/index.js'; // globally available injectables const globals = {}; diff --git a/src/vanilla/interface.ts b/src/vanilla/interface.ts index 8ca3cab7..21f32a19 100644 --- a/src/vanilla/interface.ts +++ b/src/vanilla/interface.ts @@ -1,6 +1,6 @@ -import { LocationConfig, LocationServices } from '../common/coreservices'; -import { UIRouterPlugin } from '../interface'; -import { $InjectorLike, $QLike } from '../common/index'; +import { LocationConfig, LocationServices } from '../common/coreservices.js'; +import { UIRouterPlugin } from '../interface.js'; +import { $InjectorLike, $QLike } from '../common/index.js'; export interface LocationPlugin extends UIRouterPlugin { service: LocationServices; diff --git a/src/vanilla/memoryLocationConfig.ts b/src/vanilla/memoryLocationConfig.ts index 17c381a0..7ffec04a 100644 --- a/src/vanilla/memoryLocationConfig.ts +++ b/src/vanilla/memoryLocationConfig.ts @@ -1,6 +1,6 @@ -import { LocationConfig } from '../common/coreservices'; -import { isDefined } from '../common/predicates'; -import { noop } from '../common/common'; +import { LocationConfig } from '../common/coreservices.js'; +import { isDefined } from '../common/predicates.js'; +import { noop } from '../common/common.js'; /** A `LocationConfig` mock that gets/sets all config from an in-memory object */ export class MemoryLocationConfig implements LocationConfig { diff --git a/src/vanilla/memoryLocationService.ts b/src/vanilla/memoryLocationService.ts index 83d63d6c..db461109 100644 --- a/src/vanilla/memoryLocationService.ts +++ b/src/vanilla/memoryLocationService.ts @@ -1,5 +1,5 @@ -import { BaseLocationServices } from './baseLocationService'; -import { UIRouter } from '../router'; +import { BaseLocationServices } from './baseLocationService.js'; +import { UIRouter } from '../router.js'; /** A `LocationServices` that gets/sets the current location from an in-memory object */ export class MemoryLocationService extends BaseLocationServices { diff --git a/src/vanilla/plugins.ts b/src/vanilla/plugins.ts index 3b9f9680..de7eef1f 100644 --- a/src/vanilla/plugins.ts +++ b/src/vanilla/plugins.ts @@ -1,14 +1,14 @@ -import { BrowserLocationConfig } from './browserLocationConfig'; -import { HashLocationService } from './hashLocationService'; -import { locationPluginFactory } from './utils'; -import { LocationPlugin, ServicesPlugin } from './interface'; -import { UIRouter } from '../router'; -import { PushStateLocationService } from './pushStateLocationService'; -import { MemoryLocationService } from './memoryLocationService'; -import { MemoryLocationConfig } from './memoryLocationConfig'; -import { $injector } from './injector'; -import { $q } from './q'; -import { services } from '../common/coreservices'; +import { BrowserLocationConfig } from './browserLocationConfig.js'; +import { HashLocationService } from './hashLocationService.js'; +import { locationPluginFactory } from './utils.js'; +import { LocationPlugin, ServicesPlugin } from './interface.js'; +import { UIRouter } from '../router.js'; +import { PushStateLocationService } from './pushStateLocationService.js'; +import { MemoryLocationService } from './memoryLocationService.js'; +import { MemoryLocationConfig } from './memoryLocationConfig.js'; +import { $injector } from './injector.js'; +import { $q } from './q.js'; +import { services } from '../common/coreservices.js'; export function servicesPlugin(router: UIRouter): ServicesPlugin { services.$injector = $injector; diff --git a/src/vanilla/pushStateLocationService.ts b/src/vanilla/pushStateLocationService.ts index ff30695d..f05bd4f2 100644 --- a/src/vanilla/pushStateLocationService.ts +++ b/src/vanilla/pushStateLocationService.ts @@ -1,6 +1,6 @@ -import { UIRouter } from '../router'; -import { BaseLocationServices } from './baseLocationService'; -import { LocationConfig, root, splitHash, splitQuery, stripLastPathElement } from '../common'; +import { UIRouter } from '../router.js'; +import { BaseLocationServices } from './baseLocationService.js'; +import { LocationConfig, root, splitHash, splitQuery, stripLastPathElement } from '../common/index.js'; /** * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis diff --git a/src/vanilla/q.ts b/src/vanilla/q.ts index 43555f8e..579f7727 100644 --- a/src/vanilla/q.ts +++ b/src/vanilla/q.ts @@ -1,4 +1,4 @@ -import { isArray, isObject, $QLike } from '../common/index'; +import { isArray, isObject, $QLike } from '../common/index.js'; /** * An angular1-like promise api diff --git a/src/vanilla/utils.ts b/src/vanilla/utils.ts index 046623f5..19f90234 100644 --- a/src/vanilla/utils.ts +++ b/src/vanilla/utils.ts @@ -7,8 +7,8 @@ import { splitEqual, splitHash, splitQuery, -} from '../common'; -import { UIRouter } from '../router'; +} from '../common/index.js'; +import { UIRouter } from '../router.js'; export const keyValsToObjectR = (accum, [key, val]) => { if (!accum.hasOwnProperty(key)) { diff --git a/src/view/index.ts b/src/view/index.ts index b7c8b4de..5afeeea4 100644 --- a/src/view/index.ts +++ b/src/view/index.ts @@ -1,2 +1,2 @@ -export * from './interface'; -export * from './view'; +export * from './interface.js'; +export * from './view.js'; diff --git a/src/view/interface.ts b/src/view/interface.ts index 93281c5c..637830b7 100644 --- a/src/view/interface.ts +++ b/src/view/interface.ts @@ -1,5 +1,5 @@ -import { _ViewDeclaration } from '../state/interface'; -import { PathNode } from '../path/pathNode'; +import { _ViewDeclaration } from '../state/interface.js'; +import { PathNode } from '../path/pathNode.js'; /** The context ref can be anything that has a `name` and a `parent` reference to another IContextRef */ export interface ViewContext { diff --git a/src/view/view.ts b/src/view/view.ts index f0ac0885..27e5bf47 100644 --- a/src/view/view.ts +++ b/src/view/view.ts @@ -1,11 +1,11 @@ -import { equals, applyPairs, removeFrom, TypedMap, inArray, find } from '../common/common'; -import { curry, prop } from '../common/hof'; -import { isString, isArray } from '../common/predicates'; -import { trace } from '../common/trace'; -import { PathNode } from '../path/pathNode'; -import { ActiveUIView, ViewContext, ViewConfig } from './interface'; -import { _ViewDeclaration } from '../state/interface'; -import { UIRouter } from '../router'; +import { equals, applyPairs, removeFrom, TypedMap, inArray, find } from '../common/common.js'; +import { curry, prop } from '../common/hof.js'; +import { isString, isArray } from '../common/predicates.js'; +import { trace } from '../common/trace.js'; +import { PathNode } from '../path/pathNode.js'; +import { ActiveUIView, ViewContext, ViewConfig } from './interface.js'; +import { _ViewDeclaration } from '../state/interface.js'; +import { UIRouter } from '../router.js'; export type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig | ViewConfig[];