@wixc3/engine-core
Advanced tools
Comparing version 45.7.3 to 45.8.0
@@ -0,2 +1,21 @@ | ||
import { IRunOptions } from '../types'; | ||
export declare function injectScript(win: Window, rootComId: string, scriptUrl: string): Promise<Window>; | ||
interface EngineWebEntryGlobalObj { | ||
document?: { | ||
currentScript: { | ||
dataset: { | ||
engineRunOptions?: string | null; | ||
}; | ||
} | null; | ||
}; | ||
location?: { | ||
search?: string; | ||
}; | ||
engineEntryOptions?: (options: { | ||
currentRunOptions: IRunOptions; | ||
envName: string; | ||
}) => IRunOptions; | ||
} | ||
export declare function getEngineEntryOptions(envName: string, globalObj: EngineWebEntryGlobalObj): IRunOptions; | ||
export {}; | ||
//# sourceMappingURL=web.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.injectScript = injectScript; | ||
exports.getEngineEntryOptions = getEngineEntryOptions; | ||
function injectScript(win, rootComId, scriptUrl) { | ||
@@ -15,2 +16,13 @@ return new Promise((res, rej) => { | ||
} | ||
function getEngineEntryOptions(envName, globalObj) { | ||
const urlParams = new URLSearchParams(globalObj?.location?.search); | ||
const currentScript = globalObj?.document?.currentScript; | ||
const optionsFromScript = new URLSearchParams(currentScript && currentScript.dataset.engineRunOptions || undefined); | ||
const optionsBeforeInject = new Map([...optionsFromScript, ...urlParams]); | ||
const optionsAfterInject = globalObj?.engineEntryOptions?.({ | ||
currentRunOptions: optionsBeforeInject, | ||
envName | ||
}); | ||
return optionsAfterInject || optionsBeforeInject; | ||
} | ||
//# sourceMappingURL=web.js.map |
@@ -96,2 +96,3 @@ import type { LogMessage } from './common-types.js'; | ||
entries(): IterableIterator<[string, string | string[] | boolean | null | undefined]>; | ||
[Symbol.iterator](): IterableIterator<[string, string | string[] | boolean | null | undefined]>; | ||
} | ||
@@ -98,0 +99,0 @@ export type RegisteringFeature<API extends EntityRecord, ENV extends AnyEnvironment, ProvidedOutputs extends MapTypesForEnv<GetOutputs<API>, ENV, 'providedFrom'> = MapTypesForEnv<GetOutputs<API>, ENV, 'providedFrom'>> = keyof ProvidedOutputs extends never ? undefined | void : ProvidedOutputs; |
{ | ||
"name": "@wixc3/engine-core", | ||
"version": "45.7.3", | ||
"version": "45.8.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -0,1 +1,3 @@ | ||
import { IRunOptions } from '../types'; | ||
export function injectScript(win: Window, rootComId: string, scriptUrl: string) { | ||
@@ -12,1 +14,21 @@ return new Promise<Window>((res, rej) => { | ||
} | ||
interface EngineWebEntryGlobalObj { | ||
document?: { currentScript: { dataset: { engineRunOptions?: string | null } } | null }, | ||
location?: { search?: string } | ||
engineEntryOptions?: (options: { currentRunOptions: IRunOptions; envName: string }) => IRunOptions; | ||
} | ||
export function getEngineEntryOptions(envName: string, globalObj: EngineWebEntryGlobalObj): IRunOptions { | ||
const urlParams = new URLSearchParams(globalObj?.location?.search); | ||
const currentScript = globalObj?.document?.currentScript; | ||
const optionsFromScript = new URLSearchParams(currentScript && currentScript.dataset.engineRunOptions || undefined); | ||
const optionsBeforeInject = new Map([...optionsFromScript, ...urlParams]); | ||
const optionsAfterInject = globalObj?.engineEntryOptions?.({ | ||
currentRunOptions: optionsBeforeInject, | ||
envName | ||
}); | ||
return optionsAfterInject || optionsBeforeInject; | ||
} |
@@ -174,2 +174,4 @@ import type { LogMessage } from './common-types.js'; | ||
entries(): IterableIterator<[string, string | string[] | boolean | null | undefined]>; | ||
[Symbol.iterator](): IterableIterator<[string, string | string[] | boolean | null | undefined]>; | ||
} | ||
@@ -176,0 +178,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1361435
13499
2