@lit-labs/ssr
Advanced tools
Comparing version 3.1.8 to 3.1.9
@@ -74,4 +74,5 @@ /** | ||
/** | ||
* Performs the actual loading of module source from disk, creates the | ||
* Module instance, and maintains the module cache. | ||
* Performs the actual loading of module source from disk, creates the Module | ||
* instance, and maintains the module cache. Also loads all dependencies of | ||
* the module. | ||
* | ||
@@ -87,2 +88,6 @@ * Used directly by `importModule` and by the linker and dynamic import() | ||
private _getBuiltInIdentifier; | ||
/** | ||
* `getModulePath` returns the file path for a provided module. | ||
*/ | ||
private getModulePath; | ||
} | ||
@@ -89,0 +94,0 @@ /** |
@@ -15,2 +15,7 @@ /** | ||
/** | ||
* We store Module identifiers as `${modulePath}:${this._vmContextId}`. | ||
* This regex matches the vm context id. | ||
*/ | ||
const CONTEXT_ID = /:\d+$/; | ||
/** | ||
* Creates a new object that provides a basic set of globals suitable for use as | ||
@@ -133,7 +138,3 @@ * the default context object for a VM module. | ||
this._linker = async (specifier, referencingModule) => { | ||
const { identifier } = referencingModule; | ||
if (!/:\d+$/.test(identifier)) { | ||
throw new Error('Unexpected file:// URL identifier without context ID'); | ||
} | ||
const referrerPath = identifier.split(/:\d+$/)[0]; | ||
const referrerPath = this.getModulePath(referencingModule); | ||
const result = await this._loadModule(specifier, referrerPath); | ||
@@ -167,4 +168,5 @@ const referrerModule = this.cache.get(referrerPath); | ||
/** | ||
* Performs the actual loading of module source from disk, creates the | ||
* Module instance, and maintains the module cache. | ||
* Performs the actual loading of module source from disk, creates the Module | ||
* instance, and maintains the module cache. Also loads all dependencies of | ||
* the module. | ||
* | ||
@@ -209,2 +211,7 @@ * Used directly by `importModule` and by the linker and dynamic import() | ||
const module = await modulePromise; | ||
// Modules must be fully loaded before linking. Therefore `_loadModule` must | ||
// also load its dependencies. | ||
// Reference: https://tc39.es/ecma262/#table-abstract-methods-of-module-records | ||
const moduleReferrerPath = this.getModulePath(module); | ||
await Promise.all(module.dependencySpecifiers.map((s) => this._loadModule(s, moduleReferrerPath))); | ||
return { | ||
@@ -254,2 +261,13 @@ path: modulePath, | ||
} | ||
/** | ||
* `getModulePath` returns the file path for a provided module. | ||
*/ | ||
getModulePath(module) { | ||
const { identifier } = module; | ||
if (!CONTEXT_ID.test(identifier)) { | ||
throw new Error('Internal error: Unexpected file:// URL identifier without context ID. ' + | ||
'Expected identifier in form: "/packages/lit-element.js:8".'); | ||
} | ||
return identifier.split(CONTEXT_ID)[0]; | ||
} | ||
} | ||
@@ -256,0 +274,0 @@ ModuleLoader._nextVmContextId = 0; |
/// <reference lib="dom" /> | ||
import { nothing, noChange } from 'lit'; | ||
import { PartType } from 'lit/directive.js'; | ||
import { isPrimitive, isTemplateResult, getDirectiveClass, } from 'lit/directive-helpers.js'; | ||
import { isPrimitive, isTemplateResult, getDirectiveClass, TemplateResultType, } from 'lit/directive-helpers.js'; | ||
import { _$LH } from 'lit-html/private-ssr-support.js'; | ||
@@ -120,3 +120,7 @@ const { getTemplateHtml, marker, markerMatch, boundAttributeSuffix, overrideDirectiveResolve, setDirectiveClass, getAttributePartCommittedValue, resolveDirective, AttributePart, PropertyPart, BooleanAttributePart, EventPart, connectedDisconnectable, isIterable, } = _$LH; | ||
// The property '_$litType$' needs to remain unminified. | ||
const [html, attrNames] = getTemplateHtml(result.strings, result['_$litType$']); | ||
const [html, attrNames] = getTemplateHtml(result.strings, | ||
// SVG TemplateResultType functionality is only required on the client, | ||
// which instantiates SVG elements within a svg namespace. Using SVG | ||
// on the server results in unneccesary svg containers being emitted. | ||
TemplateResultType.HTML); | ||
/** | ||
@@ -123,0 +127,0 @@ * The html string is parsed into a parse5 AST with source code information |
{ | ||
"name": "@lit-labs/ssr", | ||
"type": "module", | ||
"version": "3.1.8", | ||
"version": "3.1.9", | ||
"publishConfig": { | ||
@@ -190,3 +190,3 @@ "access": "public" | ||
"@koa/router": "^12.0.0", | ||
"@open-wc/testing": "^3.0.0-next.1", | ||
"@open-wc/testing": "^3.2.0", | ||
"@open-wc/testing-karma": "^4.0.9", | ||
@@ -210,11 +210,11 @@ "@types/command-line-args": "^5.0.0", | ||
"dependencies": { | ||
"@lit-labs/ssr-client": "^1.1.4-pre.0", | ||
"@lit-labs/ssr-dom-shim": "^1.1.2-pre.0", | ||
"@lit/reactive-element": "^2.0.0", | ||
"@lit-labs/ssr-client": "^1.1.4", | ||
"@lit-labs/ssr-dom-shim": "^1.1.2", | ||
"@lit/reactive-element": "^1.6.1 || ^2.0.0", | ||
"@parse5/tools": "^0.3.0", | ||
"@types/node": "^16.0.0", | ||
"enhanced-resolve": "^5.10.0", | ||
"lit": "^3.0.0", | ||
"lit-element": "^4.0.0", | ||
"lit-html": "^3.0.0", | ||
"lit": "^2.7.0 || ^3.0.0", | ||
"lit-element": "^3.3.0 || ^4.0.0", | ||
"lit-html": "^2.7.0 || ^3.0.0", | ||
"node-fetch": "^3.2.8", | ||
@@ -221,0 +221,0 @@ "parse5": "^7.1.1" |
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
228773
2146
Updated@lit-labs/ssr-client@^1.1.4
Updatedlit@^2.7.0 || ^3.0.0
Updatedlit-element@^3.3.0 || ^4.0.0
Updatedlit-html@^2.7.0 || ^3.0.0