New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lwrjs/app-service

Package Overview
Dependencies
Maintainers
7
Versions
495
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwrjs/app-service - npm Package Compare versions

Comparing version 0.0.2-alpha13 to 0.0.2-alpha14

3

cjs/moduleProvider/index.d.ts

@@ -8,3 +8,4 @@ import { CompiledModule, ModuleEntry, ModuleIdentifier, ModuleProvider, ModuleSource, NormalizedLwrApplicationConfig, ProviderContext, PublicViewRegistry, ResolverConfig, RuntimeContext } from '@lwrjs/types';

private compiler;
constructor({ compiler, viewRegistry, config: { application } }: ProviderContext);
private moduleRegistry;
constructor({ compiler, moduleRegistry, viewRegistry, config: { application } }: ProviderContext);
getModuleEntry({ specifier }: ResolverConfig): Promise<ModuleEntry | undefined>;

@@ -11,0 +12,0 @@ getModuleSource<T extends ModuleIdentifier, R extends RuntimeContext>(moduleId: T, runtimeContext: R): Promise<ModuleSource | undefined>;

@@ -12,3 +12,3 @@ "use strict";

class AppService {
constructor({ compiler, viewRegistry, config: { application } }) {
constructor({ compiler, moduleRegistry, viewRegistry, config: { application } }) {
this.name = 'app-provider';

@@ -18,2 +18,3 @@ this.appContext = application;

this.compiler = compiler;
this.moduleRegistry = moduleRegistry;
// Get version of this Provider from package.json

@@ -54,3 +55,3 @@ const json = shared_utils_1.readFile(path_1.default.join(__dirname, '../../package.json'));

// Generate the ABS module
const { root, init, loaderServices, syntheticShadow } = this.appContext;
const { root } = this.appContext;
const rootModules = [];

@@ -69,8 +70,3 @@ // Get the array of root components in the view

}
const originalSource = utils_1.createVirtualSource(rootModules, {
initModule: init,
format: runtimeContext.format,
loaderServices,
syntheticShadow,
});
const originalSource = await utils_1.createVirtualSource(rootModules, this.appContext, runtimeContext.format, this.moduleRegistry);
return {

@@ -77,0 +73,0 @@ namespace,

@@ -1,7 +0,13 @@

export declare function createVirtualSource(rootComponents: string[], { initModule, format, loaderServices, syntheticShadow, }: {
initModule: string;
format: string;
loaderServices?: string[];
syntheticShadow: boolean;
}): string;
import { PublicModuleRegistry, NormalizedLwrApplicationConfig } from '@lwrjs/types';
/**
* Create the virtual source for the application module
*
* @param rootComponents - the application's root components
* @param applicationConfig - the normalized application config
* @param format - the module format
* @param moduleRegistry - the public module registry
*
* @returns the generated source
*/
export declare function createVirtualSource(rootComponents: string[], { init: initModule, loaderServices, syntheticShadow }: NormalizedLwrApplicationConfig, format: string, moduleRegistry: PublicModuleRegistry): Promise<string>;
//# sourceMappingURL=utils.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createVirtualSource = void 0;
const shared_utils_1 = require("@lwrjs/shared-utils");
function getDefaultImportName(service) {

@@ -18,3 +19,13 @@ return `loaderService_${service.replace(/\//gi, '_').replace(/@/gi, '')}`;

}
function createVirtualSource(rootComponents, { initModule, format, loaderServices = [], syntheticShadow, }) {
/**
* Create the virtual source for the application module
*
* @param rootComponents - the application's root components
* @param applicationConfig - the normalized application config
* @param format - the module format
* @param moduleRegistry - the public module registry
*
* @returns the generated source
*/
async function createVirtualSource(rootComponents, { init: initModule, loaderServices = [], syntheticShadow }, format, moduleRegistry) {
const isAMD = format === 'amd';

@@ -35,2 +46,3 @@ const isESM = format === 'esm';

isESM && `import { initHMR } from 'lwr/hmr';`,
isESM && `import { initESM } from 'lwr/moduleInvalidationInitESM';`,
// init module

@@ -41,6 +53,6 @@ `import { init } from '${initModule}';`,

// initialize
format === 'esm'
? `init([${rootComponents.map((r, i) => `["${r}", Ctor${i}]`)}]); initHMR();`
isESM
? `init([${rootComponents.map((r, i) => `["${r}", Ctor${i}]`)}]); initHMR(); initESM();`
: // TODO: This only initializes the first of the root components
`const rootCmp = globalThis.LWR.rootComponent || '${rootComponents[0]}';\nload(rootCmp).then(({ default: Ctor }) => { init([[rootCmp, Ctor]]); });`,
`const rootCmp = globalThis.LWR.rootComponent || '${await shared_utils_1.getVersionedSpecifier(rootComponents[0], moduleRegistry)}';\nload(rootCmp).then(({ default: Ctor }) => { init([[rootCmp, Ctor]]); });`,
]

@@ -47,0 +59,0 @@ .filter(Boolean)

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

const shared_utils_1 = require("@lwrjs/shared-utils");
async function createVersionedSpecifier(specifier, moduleRegistry) {
const moduleEntry = await moduleRegistry.getModuleEntry({ specifier });
const [namespace, name] = shared_utils_1.explodeSpecifier(specifier);
const encodedSpecifier = shared_utils_1.getSpecifier({ namespace, name: encodeURIComponent(name) });
return moduleEntry ? `${encodedSpecifier}/v/${moduleEntry.version}` : encodedSpecifier;
}
exports.CONFIG_PACKAGE = '@webruntime/config/';

@@ -40,6 +34,3 @@ async function getBootstrapModuleDependencies({ appRoot, loaderServices, version }, runtimeContext, moduleRegistry) {

// Build specifiers for the ABS module and Root App Component
const [bootstrapModuleSpecifier, rootComponentSpecifier] = await Promise.all([
createVersionedSpecifier(`${appRoot}/bootstrap`, moduleRegistry),
createVersionedSpecifier(appRoot, moduleRegistry),
]);
const bootstrapModuleSpecifier = await shared_utils_1.getVersionedSpecifier(`${appRoot}/bootstrap`, moduleRegistry);
// If loader services/hooks are used, add all ABS module dependencies to requiredModules[]

@@ -51,3 +42,2 @@ const requiredModules = await getBootstrapModuleDependencies(context, runtimeContext, moduleRegistry);

bootstrapModule: bootstrapModuleSpecifier,
rootComponent: rootComponentSpecifier,
// The loader shim will not initialize the app until all of these modules are defined

@@ -54,0 +44,0 @@ // The AMD loader is IMPLIED to be in this list by the shim

@@ -7,3 +7,3 @@ {

},
"version": "0.0.2-alpha13",
"version": "0.0.2-alpha14",
"homepage": "https://lwr.dev/",

@@ -27,5 +27,5 @@ "repository": {

"dependencies": {
"@lwrjs/shared-utils": "0.0.2-alpha13"
"@lwrjs/shared-utils": "0.0.2-alpha14"
},
"gitHead": "5c87da5546845ca928155bbcfbdbd9fea2420c8b"
"gitHead": "1c76575ab5ee559f57860a17763fff6874d21e5a"
}
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