piral-blazor
Advanced tools
Comparing version 1.3.0-beta.5959 to 1.3.0-beta.6001
@@ -15,3 +15,3 @@ import type { BlazorOptions } from './esm/types'; | ||
export declare const fromBlazor: BlazorConverter; | ||
export declare const defineBlazorReferences: (references: string[], meta?: PiletMetadata, satellites?: {}, prio?: number, kind?: string) => void; | ||
export declare const defineBlazorReferences: (references: string[], meta?: PiletMetadata, satellites?: {}, prio?: number, kind?: string, sharedDependencies?: any[]) => void; | ||
export declare const releaseBlazorReferences: () => Promise<void>; |
@@ -25,4 +25,4 @@ import { createConverter } from './converter'; | ||
return { | ||
defineBlazorReferences(references, satellites, prio, kind) { | ||
return loader.defineBlazorReferences(references, meta, satellites, prio, kind); | ||
defineBlazorReferences(references, satellites, prio, kind, sharedDependencies) { | ||
return loader.defineBlazorReferences(references, meta, satellites, prio, kind, sharedDependencies); | ||
}, | ||
@@ -29,0 +29,0 @@ defineBlazorOptions(blazorOptions) { |
@@ -6,4 +6,4 @@ import type { PiletMetadata } from 'piral-core'; | ||
getDependency(): BlazorDependencyLoader; | ||
defineBlazorReferences(references: Array<string>, meta?: Partial<PiletMetadata>, satellites?: {}, prio?: number, kind?: string): void; | ||
defineBlazorReferences(references: Array<string>, meta?: Partial<PiletMetadata>, satellites?: {}, prio?: number, kind?: string, sharedDependencies?: any[]): void; | ||
releaseBlazorReferences(): Promise<void>; | ||
}; |
@@ -6,6 +6,21 @@ var _a, _b; | ||
const depsWithPrios = ((_b = window.$blazorDependencyPrios) !== null && _b !== void 0 ? _b : (window.$blazorDependencyPrios = [])); | ||
function toExtLessUrl(url) { | ||
const idx = url.lastIndexOf('.'); | ||
const sep = url.lastIndexOf('/'); | ||
if (idx > sep) { | ||
return url.substring(0, idx); | ||
} | ||
return url; | ||
} | ||
function toPdb(url) { | ||
const front = url.substring(0, url.length - 4); | ||
return `${front}.pdb`; | ||
return `${toExtLessUrl(url)}.pdb`; | ||
} | ||
function toDepName(url) { | ||
const front = toExtLessUrl(url); | ||
const idx = front.lastIndexOf('/'); | ||
if (idx >= 0) { | ||
return front.substring(idx + 1); | ||
} | ||
return front; | ||
} | ||
export function createDependencyLoader(convert) { | ||
@@ -19,3 +34,3 @@ const definedBlazorReferences = []; | ||
}, | ||
defineBlazorReferences(references, meta = {}, satellites = {}, prio = 0, kind = 'local') { | ||
defineBlazorReferences(references, meta = {}, satellites = {}, prio = 0, kind = 'local', sharedDependencies = []) { | ||
prio = Math.max(prio, 0); | ||
@@ -39,2 +54,3 @@ const depWithPrio = { | ||
} | ||
const supportsCore = capabilities.includes('core-pilet'); | ||
const dependencies = references.filter((m) => m.endsWith('.dll')); | ||
@@ -45,2 +61,14 @@ const dllUrl = dependencies.pop(); | ||
const id = Math.random().toString(26).substring(2); | ||
if (supportsCore) { | ||
for (let i = dependencies.length; i--;) { | ||
const name = toDepName(dependencies[i]); | ||
for (const dep of sharedDependencies) { | ||
// OK we want to share this one - remove it from the given dependencies | ||
if (name === dep) { | ||
dependencies.splice(i, 1); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
yield loadBlazorPilet(id, { | ||
@@ -53,4 +81,4 @@ name: meta.name || '(unknown)', | ||
dependencySymbols: capabilities.includes('dependency-symbols') ? dependencySymbols : undefined, | ||
sharedDependencies: capabilities.includes('core-pilet') ? [] : undefined, | ||
kind: capabilities.includes('core-pilet') ? 'local' : undefined, | ||
sharedDependencies: supportsCore ? sharedDependencies : undefined, | ||
kind: supportsCore ? kind : undefined, | ||
satellites, | ||
@@ -57,0 +85,0 @@ dllUrl, |
@@ -25,3 +25,3 @@ import type { BlazorLogLevel, BlazorRootConfig, WebAssemblyStartOptions } from './types'; | ||
dependencies: Array<string>; | ||
kind?: 'global' | 'local'; | ||
kind?: string; | ||
sharedDependencies?: Array<string>; | ||
@@ -28,0 +28,0 @@ dependencySymbols?: Array<string>; |
@@ -119,4 +119,5 @@ import type { ForeignComponent, PiletApi } from 'piral-core'; | ||
* @param kind The kind of pilet to use. Global pilets will always be loaded before local pilets. | ||
* @param sharedDependencies The names of the dependencies that should be put in the global context. | ||
*/ | ||
defineBlazorReferences(referenceUrls: Array<string>, satellites?: Record<string, Array<string>>, prio?: number, kind?: 'global' | 'local'): void; | ||
defineBlazorReferences(referenceUrls: Array<string>, satellites?: Record<string, Array<string>>, prio?: number, kind?: 'global' | 'local', sharedDependencies?: Array<string>): void; | ||
/** | ||
@@ -123,0 +124,0 @@ * Wraps a Blazor module for use in Piral. |
@@ -28,4 +28,4 @@ "use strict"; | ||
return { | ||
defineBlazorReferences(references, satellites, prio, kind) { | ||
return loader.defineBlazorReferences(references, meta, satellites, prio, kind); | ||
defineBlazorReferences(references, satellites, prio, kind, sharedDependencies) { | ||
return loader.defineBlazorReferences(references, meta, satellites, prio, kind, sharedDependencies); | ||
}, | ||
@@ -32,0 +32,0 @@ defineBlazorOptions(blazorOptions) { |
@@ -6,4 +6,4 @@ import type { PiletMetadata } from 'piral-core'; | ||
getDependency(): BlazorDependencyLoader; | ||
defineBlazorReferences(references: Array<string>, meta?: Partial<PiletMetadata>, satellites?: {}, prio?: number, kind?: string): void; | ||
defineBlazorReferences(references: Array<string>, meta?: Partial<PiletMetadata>, satellites?: {}, prio?: number, kind?: string, sharedDependencies?: any[]): void; | ||
releaseBlazorReferences(): Promise<void>; | ||
}; |
@@ -9,6 +9,21 @@ "use strict"; | ||
const depsWithPrios = ((_b = window.$blazorDependencyPrios) !== null && _b !== void 0 ? _b : (window.$blazorDependencyPrios = [])); | ||
function toExtLessUrl(url) { | ||
const idx = url.lastIndexOf('.'); | ||
const sep = url.lastIndexOf('/'); | ||
if (idx > sep) { | ||
return url.substring(0, idx); | ||
} | ||
return url; | ||
} | ||
function toPdb(url) { | ||
const front = url.substring(0, url.length - 4); | ||
return `${front}.pdb`; | ||
return `${toExtLessUrl(url)}.pdb`; | ||
} | ||
function toDepName(url) { | ||
const front = toExtLessUrl(url); | ||
const idx = front.lastIndexOf('/'); | ||
if (idx >= 0) { | ||
return front.substring(idx + 1); | ||
} | ||
return front; | ||
} | ||
function createDependencyLoader(convert) { | ||
@@ -22,3 +37,3 @@ const definedBlazorReferences = []; | ||
}, | ||
defineBlazorReferences(references, meta = {}, satellites = {}, prio = 0, kind = 'local') { | ||
defineBlazorReferences(references, meta = {}, satellites = {}, prio = 0, kind = 'local', sharedDependencies = []) { | ||
prio = Math.max(prio, 0); | ||
@@ -42,2 +57,3 @@ const depWithPrio = { | ||
} | ||
const supportsCore = capabilities.includes('core-pilet'); | ||
const dependencies = references.filter((m) => m.endsWith('.dll')); | ||
@@ -48,2 +64,14 @@ const dllUrl = dependencies.pop(); | ||
const id = Math.random().toString(26).substring(2); | ||
if (supportsCore) { | ||
for (let i = dependencies.length; i--;) { | ||
const name = toDepName(dependencies[i]); | ||
for (const dep of sharedDependencies) { | ||
// OK we want to share this one - remove it from the given dependencies | ||
if (name === dep) { | ||
dependencies.splice(i, 1); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
yield (0, interop_1.loadBlazorPilet)(id, { | ||
@@ -56,4 +84,4 @@ name: meta.name || '(unknown)', | ||
dependencySymbols: capabilities.includes('dependency-symbols') ? dependencySymbols : undefined, | ||
sharedDependencies: capabilities.includes('core-pilet') ? [] : undefined, | ||
kind: capabilities.includes('core-pilet') ? 'local' : undefined, | ||
sharedDependencies: supportsCore ? sharedDependencies : undefined, | ||
kind: supportsCore ? kind : undefined, | ||
satellites, | ||
@@ -60,0 +88,0 @@ dllUrl, |
@@ -25,3 +25,3 @@ import type { BlazorLogLevel, BlazorRootConfig, WebAssemblyStartOptions } from './types'; | ||
dependencies: Array<string>; | ||
kind?: 'global' | 'local'; | ||
kind?: string; | ||
sharedDependencies?: Array<string>; | ||
@@ -28,0 +28,0 @@ dependencySymbols?: Array<string>; |
@@ -119,4 +119,5 @@ import type { ForeignComponent, PiletApi } from 'piral-core'; | ||
* @param kind The kind of pilet to use. Global pilets will always be loaded before local pilets. | ||
* @param sharedDependencies The names of the dependencies that should be put in the global context. | ||
*/ | ||
defineBlazorReferences(referenceUrls: Array<string>, satellites?: Record<string, Array<string>>, prio?: number, kind?: 'global' | 'local'): void; | ||
defineBlazorReferences(referenceUrls: Array<string>, satellites?: Record<string, Array<string>>, prio?: number, kind?: 'global' | 'local', sharedDependencies?: Array<string>): void; | ||
/** | ||
@@ -123,0 +124,0 @@ * Wraps a Blazor module for use in Piral. |
{ | ||
"name": "piral-blazor", | ||
"version": "1.3.0-beta.5959", | ||
"version": "1.3.0-beta.6001", | ||
"description": "Plugin for integrating Blazor components in Piral.", | ||
@@ -70,5 +70,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"piral-core": "1.3.0-beta.5959" | ||
"piral-core": "1.3.0-beta.6001" | ||
}, | ||
"gitHead": "a8fda2d21be0fe7b8e1245496bf2a2eb33f82135" | ||
"gitHead": "ea22bb317f7bfb648f0fe8ed747c6a13faff54e5" | ||
} |
@@ -68,4 +68,4 @@ import type { EventEmitter, PiralPlugin } from 'piral-core'; | ||
return { | ||
defineBlazorReferences(references, satellites, prio, kind) { | ||
return loader.defineBlazorReferences(references, meta, satellites, prio, kind); | ||
defineBlazorReferences(references, satellites, prio, kind, sharedDependencies) { | ||
return loader.defineBlazorReferences(references, meta, satellites, prio, kind, sharedDependencies); | ||
}, | ||
@@ -72,0 +72,0 @@ defineBlazorOptions(blazorOptions: BlazorOptions) { |
@@ -9,7 +9,28 @@ import type { PiletMetadata } from 'piral-core'; | ||
function toExtLessUrl(url: string) { | ||
const idx = url.lastIndexOf('.'); | ||
const sep = url.lastIndexOf('/'); | ||
if (idx > sep) { | ||
return url.substring(0, idx); | ||
} | ||
return url; | ||
} | ||
function toPdb(url: string) { | ||
const front = url.substring(0, url.length - 4); | ||
return `${front}.pdb`; | ||
return `${toExtLessUrl(url)}.pdb`; | ||
} | ||
function toDepName(url: string) { | ||
const front = toExtLessUrl(url); | ||
const idx = front.lastIndexOf('/'); | ||
if (idx >= 0) { | ||
return front.substring(idx + 1); | ||
} | ||
return front; | ||
} | ||
export function createDependencyLoader(convert: ReturnType<typeof createConverter>) { | ||
@@ -24,3 +45,3 @@ const definedBlazorReferences: Array<string> = []; | ||
}, | ||
defineBlazorReferences(references: Array<string>, meta: Partial<PiletMetadata> = {}, satellites = {}, prio = 0, kind = 'local') { | ||
defineBlazorReferences(references: Array<string>, meta: Partial<PiletMetadata> = {}, satellites = {}, prio = 0, kind = 'local', sharedDependencies = []) { | ||
prio = Math.max(prio, 0); | ||
@@ -50,2 +71,3 @@ | ||
const supportsCore = capabilities.includes('core-pilet'); | ||
const dependencies = references.filter((m) => m.endsWith('.dll')); | ||
@@ -57,2 +79,16 @@ const dllUrl = dependencies.pop(); | ||
if (supportsCore) { | ||
for (let i = dependencies.length; i--; ) { | ||
const name = toDepName(dependencies[i]); | ||
for (const dep of sharedDependencies) { | ||
// OK we want to share this one - remove it from the given dependencies | ||
if (name === dep) { | ||
dependencies.splice(i, 1); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
await loadBlazorPilet(id, { | ||
@@ -65,4 +101,4 @@ name: meta.name || '(unknown)', | ||
dependencySymbols: capabilities.includes('dependency-symbols') ? dependencySymbols : undefined, | ||
sharedDependencies: capabilities.includes('core-pilet') ? [] : undefined, | ||
kind: capabilities.includes('core-pilet') ? 'local' : undefined, | ||
sharedDependencies: supportsCore ? sharedDependencies : undefined, | ||
kind: supportsCore ? kind : undefined, | ||
satellites, | ||
@@ -69,0 +105,0 @@ dllUrl, |
@@ -221,3 +221,3 @@ import { PiletApi } from 'piral-core'; | ||
dependencies: Array<string>; | ||
kind?: 'global' | 'local'; | ||
kind?: string; | ||
sharedDependencies?: Array<string>; | ||
@@ -224,0 +224,0 @@ dependencySymbols?: Array<string>; |
@@ -140,2 +140,3 @@ import type { ForeignComponent, PiletApi } from 'piral-core'; | ||
* @param kind The kind of pilet to use. Global pilets will always be loaded before local pilets. | ||
* @param sharedDependencies The names of the dependencies that should be put in the global context. | ||
*/ | ||
@@ -147,2 +148,3 @@ defineBlazorReferences( | ||
kind?: 'global' | 'local', | ||
sharedDependencies?: Array<string>, | ||
): void; | ||
@@ -149,0 +151,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
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
192634
3048