Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

piral-blazor

Package Overview
Dependencies
Maintainers
1
Versions
805
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

piral-blazor - npm Package Compare versions

Comparing version 1.0.0-pre.1746 to 1.0.0-pre.1758

convert.js

1

lib/converter.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConverter = void 0;
var tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ var internal_1 = require("./internal");

4

lib/create.d.ts

@@ -1,3 +0,3 @@

import { PiralPlugin } from 'piral-core';
import { PiletBlazorApi } from './types';
import type { PiralPlugin } from 'piral-core';
import type { PiletBlazorApi } from './types';
/**

@@ -4,0 +4,0 @@ * Available configuration options for the Blazor plugin.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var internal_1 = require("./internal");
exports.createBlazorApi = void 0;
var converter_1 = require("./converter");
var dependencies_1 = require("./dependencies");
/**

@@ -10,3 +11,3 @@ * Creates new Pilet API extensions for integration of Blazor.

if (config === void 0) { config = {}; }
var _a = config.lazy, lazy = _a === void 0 ? true : _a;
var lazy = config.lazy;
return function (context) {

@@ -19,19 +20,9 @@ var convert = converter_1.createConverter(lazy);

return function () {
var dependency;
var loader = dependencies_1.createDependencyLoader(convert, lazy);
return {
defineBlazorReferences: function (references) {
var load = function () {
return Promise.all(references.map(function (reference) {
return fetch(reference)
.then(function (res) { return res.blob(); })
.then(internal_1.addReference);
}));
};
var result = !lazy && convert.loader.then(load);
dependency = function () { return result || (result = load()); };
},
defineBlazorReferences: loader.defineBlazorReferences,
fromBlazor: function (moduleName, args) {
return {
type: 'blazor',
dependency: dependency,
dependency: loader.getDependency(),
moduleName: moduleName,

@@ -38,0 +29,0 @@ args: args,

@@ -5,2 +5,3 @@ "use strict";

tslib_1.__exportStar(require("./create"), exports);
tslib_1.__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setPlatform = exports.platform = void 0;
function setPlatform(platformInstance) {

@@ -4,0 +5,0 @@ exports.platform = platformInstance;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialize = exports.attachEvents = exports.removeReference = exports.addReference = exports.deactivate = exports.activate = exports.eventNames = void 0;
var tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ require("./globals");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BootConfigResult = void 0;
var BootConfigResult = /** @class */ (function () {

@@ -4,0 +5,0 @@ function BootConfigResult(bootConfig, applicationEnvironment) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.attachDebuggerHotkey = exports.hasDebuggingEnabled = void 0;
var currentBrowserIsChrome = window.chrome && navigator.userAgent.indexOf('Edge') < 0; // Edge pretends to be Chrome

@@ -4,0 +5,0 @@ var hasReferencedPdbs = false;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.monoPlatform = void 0;
var tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ var MonoDebugger_1 = require("./MonoDebugger");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAssemblyNameFromUrl = exports.getFileNameFromUrl = void 0;
function getFileNameFromUrl(url) {

@@ -4,0 +5,0 @@ // This could also be called "get last path segment from URL", but the primary

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebAssemblyConfigLoader = void 0;
var tslib_1 = require("tslib");

@@ -37,11 +38,16 @@ var WebAssemblyConfigLoader = /** @class */ (function () {

return [4 /*yield*/, Promise.all((bootConfigResult.bootConfig.config || [])
.filter(function (name) { return name === 'appsettings.json' || name === "appsettings." + bootConfigResult.applicationEnvironment + ".json"; })
.map(function (name) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var _a; return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = { name: name };
return [4 /*yield*/, getConfigBytes(name)];
case 1: return [2 /*return*/, (_a.content = _b.sent(), _a)];
}
}); }); }))];
.filter(function (name) {
return name === 'appsettings.json' || name === "appsettings." + bootConfigResult.applicationEnvironment + ".json";
})
.map(function (name) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var _a;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = { name: name };
return [4 /*yield*/, getConfigBytes(name)];
case 1: return [2 /*return*/, (_a.content = _b.sent(), _a)];
}
});
}); }))];
case 1:

@@ -48,0 +54,0 @@ configFiles = _a.sent();

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebAssemblyResourceLoader = void 0;
var tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ var NavigationManager_1 = require("../Services/NavigationManager");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrowserRenderer = void 0;
var RenderBatch_1 = require("./RenderBatch/RenderBatch");

@@ -4,0 +5,0 @@ var EventDelegator_1 = require("./EventDelegator");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyCaptureIdToElement = void 0;
function applyCaptureIdToElement(element, referenceCaptureId) {

@@ -4,0 +5,0 @@ element.setAttribute(getCaptureIdAttributeName(referenceCaptureId), '');

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventDelegator = void 0;
var EventForDotNet_1 = require("./EventForDotNet");

@@ -4,0 +5,0 @@ var EventFieldInfo_1 = require("./EventFieldInfo");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventFieldInfo = void 0;
var EventFieldInfo = /** @class */ (function () {

@@ -4,0 +5,0 @@ function EventFieldInfo(componentId, fieldValue) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventForDotNet = void 0;
var tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ var EventForDotNet = /** @class */ (function () {

@@ -29,2 +29,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getClosestDomElement = exports.permuteLogicalChildren = exports.getLogicalChildrenArray = exports.isSvgElement = exports.getLogicalChild = exports.getLogicalSiblingEnd = exports.getLogicalParent = exports.removeLogicalChild = exports.insertLogicalChild = exports.createAndInsertLogicalContainer = exports.toLogicalElement = exports.toLogicalRootCommentElement = void 0;
var logicalChildrenPropname = createSymbolOrFallback('_blazorLogicalChildren');

@@ -31,0 +32,0 @@ var logicalParentPropname = createSymbolOrFallback('_blazorLogicalParent');

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OutOfProcessRenderBatch = void 0;
var Utf8Decoder_1 = require("./Utf8Decoder");

@@ -4,0 +5,0 @@ var updatedComponentsEntryLength = 4; // Each is a single int32 giving the location of the data

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FrameType = exports.EditType = void 0;
var EditType;

@@ -4,0 +5,0 @@ (function (EditType) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SharedMemoryRenderBatch = void 0;
var Environment_1 = require("../../Environment");

@@ -4,0 +5,0 @@ // Used when running on Mono WebAssembly for shared-memory interop. The code here encapsulates

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeUtf8 = void 0;
var nativeDecoder = typeof TextDecoder === 'function' ? new TextDecoder('utf-8') : null;

@@ -4,0 +5,0 @@ exports.decodeUtf8 = nativeDecoder

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resetScrollAfterNextBatch = exports.renderBatch = exports.attachRootComponentToElement = exports.attachRootComponentToLogicalElement = void 0;
/* eslint-disable @typescript-eslint/camelcase */

@@ -4,0 +5,0 @@ require("../Platform/Platform");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setEventDispatcher = exports.dispatchEvent = void 0;
var eventDispatcherInstance;

@@ -4,0 +5,0 @@ function dispatchEvent(eventDescriptor, eventArgs) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toAbsoluteUri = exports.navigateTo = exports.attachToEventDelegator = exports.navigationManager = void 0;
var tslib_1 = require("tslib");

@@ -4,0 +5,0 @@ var Renderer_1 = require("../Rendering/Renderer");

@@ -1,2 +0,2 @@

import { ForeignComponent } from 'piral-core';
import type { ForeignComponent } from 'piral-core';
declare module 'piral-core/lib/types/custom' {

@@ -3,0 +3,0 @@ interface PiletCustomApi extends PiletBlazorApi {

{
"name": "piral-blazor",
"version": "1.0.0-pre.1746",
"version": "1.0.0-pre.1758",
"description": "Plugin for integrating Blazor components in Piral.",

@@ -27,3 +27,4 @@ "keywords": [

"lib",
"src"
"src",
"convert.js"
],

@@ -49,8 +50,8 @@ "repository": {

"@types/emscripten": "0.0.34",
"piral-core": "^1.0.0-pre.1746"
"piral-core": "^1.0.0-pre.1758"
},
"peerDependencies": {
"piral-core": "^1.0.0"
"piral-core": "0.12.x || 1.x"
},
"gitHead": "afcd06699b9ef8e041ff984d6fa6c5c94bb33638"
"gitHead": "b73ae118f029dfa6ea6c24be553e490869bd21b6"
}

@@ -7,3 +7,3 @@ [![Piral Logo](https://github.com/smapiot/piral/raw/master/docs/assets/logo.png)](https://piral.io)

The set includes an Blazor loader and converter for any component registration, as well as a `fromBlazor` shortcut together with some Blazor component coming in the `Piral.Blazor.Utils` NuGet package.
The set includes a Blazor loader and converter for any component registration, as well as a `fromBlazor` shortcut together with some Blazor component coming in the `Piral.Blazor.Utils` NuGet package.

@@ -98,2 +98,17 @@ By default, these API extensions are not integrated in `piral`, so you'd need to add them to your Piral instance.

Alternatively, if `piral-blazor` has not been added to the Piral instance you can install and use the package also from a pilet directly.
```ts
import { PiletApi } from '<name-of-piral-instance>';
import { defineBlazorReferences, fromBlazor } from 'piral-blazor';
export function setup(piral: PiletApi) {
defineBlazorReferences([
require.resolve('./My.Dependency.dll'),
require.resolve('./My.Components.dll'),
])
piral.registerPage('/sample', fromBlazor('sample-page'));
}
```
:::

@@ -100,0 +115,0 @@

@@ -31,3 +31,3 @@ import { ForeignComponent, BaseComponentProps } from 'piral-core';

.then(() => activate(moduleName, props))
.then(refId => {
.then((refId) => {
if (state === 'fresh') {

@@ -40,7 +40,7 @@ id = `${moduleName}-${refId}`;

})
.catch(err => console.error(err));
.catch((err) => console.error(err));
dispose = attachEvents(
el,
ev => data.piral.renderHtmlExtension(ev.detail.target, ev.detail.props),
ev => ctx.router.history.push(ev.detail.to),
(ev) => data.piral.renderHtmlExtension(ev.detail.target, ev.detail.props),
(ev) => ctx.router.history.push(ev.detail.to),
);

@@ -47,0 +47,0 @@ state = 'fresh';

@@ -1,5 +0,5 @@

import { PiralPlugin } from 'piral-core';
import { addReference } from './internal';
import type { PiralPlugin } from 'piral-core';
import { createConverter } from './converter';
import { PiletBlazorApi } from './types';
import { createDependencyLoader } from './dependencies';
import type { PiletBlazorApi } from './types';

@@ -21,5 +21,5 @@ /**

export function createBlazorApi(config: BlazorConfig = {}): PiralPlugin<PiletBlazorApi> {
const { lazy = true } = config;
const { lazy } = config;
return context => {
return (context) => {
const convert = createConverter(lazy);

@@ -29,21 +29,10 @@ context.converters.blazor = ({ moduleName, args, dependency }) => convert(moduleName, dependency, args);

return () => {
let dependency: () => Promise<any>;
const loader = createDependencyLoader(convert, lazy);
return {
defineBlazorReferences(references) {
const load = () =>
Promise.all(
references.map(reference =>
fetch(reference)
.then(res => res.blob())
.then(addReference),
),
);
let result = !lazy && convert.loader.then(load);
dependency = () => result || (result = load());
},
defineBlazorReferences: loader.defineBlazorReferences,
fromBlazor(moduleName, args) {
return {
type: 'blazor',
dependency,
dependency: loader.getDependency(),
moduleName,

@@ -50,0 +39,0 @@ args,

@@ -46,3 +46,3 @@ import './globals';

export function addReference(blob: Blob) {
return new Promise(resolve => {
return new Promise((resolve) => {
var reader = new FileReader();

@@ -49,0 +49,0 @@ reader.onload = () => {

@@ -22,3 +22,3 @@ import { WebAssemblyResourceLoader } from '../WebAssemblyResourceLoader';

// Even if debugging isn't enabled, we register the hotkey so we can report why it's not enabled
document.addEventListener('keydown', evt => {
document.addEventListener('keydown', (evt) => {
if (evt.shiftKey && (evt.metaKey || evt.altKey) && evt.code === 'KeyD') {

@@ -25,0 +25,0 @@ if (!hasReferencedPdbs) {

@@ -142,3 +142,3 @@ import { attachDebuggerHotkey, hasDebuggingEnabled } from './MonoDebugger';

const dotnetJsResourceName = Object.keys(resourceLoader.bootConfig.resources.runtime).filter(
n => n.startsWith('dotnet.') && n.endsWith('.js'),
(n) => n.startsWith('dotnet.') && n.endsWith('.js'),
)[0];

@@ -185,5 +185,5 @@ const scriptElem = document.createElement('script');

module.print = line => suppressMessages.indexOf(line) < 0 && console.log(line);
module.print = (line) => suppressMessages.indexOf(line) < 0 && console.log(line);
module.printErr = line => {
module.printErr = (line) => {
console.error(line);

@@ -199,5 +199,8 @@ };

resources.assembly,
filename => `_framework/_bin/${filename}`,
(filename) => `_framework/_bin/${filename}`,
);
const pdbsBeingLoaded = resourceLoader.loadResources(resources.pdb || {}, filename => `_framework/_bin/${filename}`);
const pdbsBeingLoaded = resourceLoader.loadResources(
resources.pdb || {},
(filename) => `_framework/_bin/${filename}`,
);
const wasmBeingLoaded = resourceLoader.loadResource(

@@ -235,4 +238,4 @@ /* name */ dotnetWasmResourceName,

// of the extensions in the URLs. This allows loading assemblies with arbitrary filenames.
assembliesBeingLoaded.forEach(r => addResourceAsAssembly(r, changeExtension(r.name, '.dll')));
pdbsBeingLoaded.forEach(r => addResourceAsAssembly(r, r.name));
assembliesBeingLoaded.forEach((r) => addResourceAsAssembly(r, changeExtension(r.name, '.dll')));
pdbsBeingLoaded.forEach((r) => addResourceAsAssembly(r, r.name));

@@ -250,12 +253,12 @@ // Wire-up callbacks for satellite assemblies. Blazor will call these as part of the application

culturesToLoad
.filter(culture => satelliteResources.hasOwnProperty(culture))
.map(culture =>
resourceLoader.loadResources(satelliteResources[culture], fileName => `_framework/_bin/${fileName}`),
.filter((culture) => satelliteResources.hasOwnProperty(culture))
.map((culture) =>
resourceLoader.loadResources(satelliteResources[culture], (fileName) => `_framework/_bin/${fileName}`),
)
.reduce((previous, next) => previous.concat(next), new Array<LoadingResource>())
.map(async resource => (await resource.response).arrayBuffer()),
.map(async (resource) => (await resource.response).arrayBuffer()),
);
return BINDING.js_to_mono_obj(
resourcePromises.then(resourcesToLoad => {
resourcePromises.then((resourcesToLoad) => {
if (resourcesToLoad.length) {

@@ -305,3 +308,3 @@ window['Blazor']._internal.readSatelliteAssemblies = () => {

// Wait for the data to be loaded and verified
const dataBuffer = await dependency.response.then(r => r.arrayBuffer());
const dataBuffer = await dependency.response.then((r) => r.arrayBuffer());

@@ -409,3 +412,3 @@ // Load it into the Mono runtime

// fall back to ArrayBuffer instantiation
const arrayBuffer = await wasmResource.response.then(r => r.arrayBuffer());
const arrayBuffer = await wasmResource.response.then((r) => r.arrayBuffer());
const arrayBufferResult = await WebAssembly.instantiate(arrayBuffer, imports);

@@ -412,0 +415,0 @@ return arrayBufferResult.instance;

@@ -12,5 +12,6 @@ import { BootConfigResult } from './BootConfig';

.filter(
name => name === 'appsettings.json' || name === `appsettings.${bootConfigResult.applicationEnvironment}.json`,
(name) =>
name === 'appsettings.json' || name === `appsettings.${bootConfigResult.applicationEnvironment}.json`,
)
.map(async name => ({ name, content: await getConfigBytes(name) })),
.map(async (name) => ({ name, content: await getConfigBytes(name) })),
);

@@ -20,3 +21,3 @@

const fileName = BINDING.conv_string(dotNetFileName);
const resolvedFile = configFiles.find(f => f.name === fileName);
const resolvedFile = configFiles.find((f) => f.name === fileName);
return resolvedFile ? BINDING.js_typed_array_to_array(resolvedFile.content) : undefined;

@@ -23,0 +24,0 @@ };

@@ -19,3 +19,3 @@ import { BootJsonData, ResourceList } from './BootConfig';

loadResources(resources: ResourceList, url: (name: string) => string): LoadingResource[] {
return Object.keys(resources).map(name => this.loadResource(name, url(name), resources[name]));
return Object.keys(resources).map((name) => this.loadResource(name, url(name), resources[name]));
}

@@ -80,3 +80,3 @@

const cachedRequests = await cache.keys();
const deletionPromises = cachedRequests.map(async cachedRequest => {
const deletionPromises = cachedRequests.map(async (cachedRequest) => {
if (!(cachedRequest.url in this.usedCacheKeys)) {

@@ -83,0 +83,0 @@ await cache.delete(cachedRequest);

@@ -141,3 +141,3 @@ import { EventForDotNet, UIEventArgs } from './EventForDotNet';

if (evt.type === 'click') {
this.afterClickCallbacks.forEach(callback => callback(evt as MouseEvent));
this.afterClickCallbacks.forEach((callback) => callback(evt as MouseEvent));
}

@@ -277,3 +277,3 @@ }

const result = {};
items.forEach(value => {
items.forEach((value) => {
result[value] = true;

@@ -280,0 +280,0 @@ });

@@ -56,3 +56,3 @@ /*

const children = getLogicalChildrenArray(parentLogicalElement);
Array.from(parent.childNodes).forEach(n => children.push((n as unknown) as LogicalElement));
Array.from(parent.childNodes).forEach((n) => children.push((n as unknown) as LogicalElement));
start[logicalParentPropname] = parentLogicalElement;

@@ -59,0 +59,0 @@ // We might not have an end comment in the case of non-prerendered components.

@@ -38,3 +38,3 @@ import { resetScrollAfterNextBatch } from '../Rendering/Renderer';

// So instead of registering our own native event, register using the EventDelegator.
eventDelegator.notifyAfterClick(event => {
eventDelegator.notifyAfterClick((event) => {
if (!hasEnabledNavigationInterception) {

@@ -41,0 +41,0 @@ return;

@@ -1,2 +0,2 @@

import { ForeignComponent } from 'piral-core';
import type { ForeignComponent } from 'piral-core';

@@ -3,0 +3,0 @@ declare module 'piral-core/lib/types/custom' {

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 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 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 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 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 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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc