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

@lit/localize-tools

Package Overview
Dependencies
Maintainers
6
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lit/localize-tools - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

9

CHANGELOG.md

@@ -10,2 +10,11 @@ # Changelog

## [0.3.0] - 2021-04-19
### Changed
- **[BREAKING]** Lit dependency upgraded to v2.
- **[BREAKING]** Replaces `Localized` mixin transform with `@localized`
decorator and `updateWhenLocaleChanges` transforms.
## [0.2.1] - 2021-04-02

@@ -12,0 +21,0 @@

2

lib/cli.js

@@ -28,3 +28,3 @@ /**

Default: ./lit-localize.json
See https://github.com/Polymer/lit-html/tree/lit-next/packages/localize#readme for details.
See https://github.com/Polymer/lit-html/tree/main/packages/localize#readme for details.
`;

@@ -31,0 +31,0 @@ const commands = ['build', 'extract'];

@@ -42,4 +42,4 @@ /**

/**
* True if this message was tagged as a lit-html template, or was a function
* that returned a lit-html template.
* True if this message was tagged as a Lit template, or was a function that
* returned a Lit template.
*/

@@ -57,4 +57,4 @@ isLitTemplate: boolean;

* A placeholder is a allows a bit of untranslatable text to be re-positioned by
* the translator, but not modified. We use placeholders to contain embedded HTML
* extracted from lit-html templates.
* the translator, but not modified. We use placeholders to contain embedded
* HTML extracted from Lit templates.
*/

@@ -61,0 +61,0 @@ export interface Placeholder {

@@ -77,3 +77,3 @@ /**

const translatedMsgNames = new Set();
// Whether we'll need to import the lit-html "html" function.
// Whether we'll need to import the lit "html" function.
let importLit = false;

@@ -107,3 +107,3 @@ const entries = [];

${importLit ? "import {html} from 'lit-html';" : ''}
${importLit ? "import {html} from 'lit';" : ''}

@@ -127,4 +127,4 @@ /* eslint-disable no-irregular-whitespace */

/**
* Convert the contents of a message to a TypeScript string, possibly using
* lit-html if there is embedded HTML.
* Convert the contents of a message to a TypeScript string, possibly using lit
* if there is embedded HTML.
*/

@@ -131,0 +131,0 @@ function makeMessageString(contents, canon) {

@@ -142,12 +142,13 @@ /**

}
// Localized(LitElement) -> LitElement
if (this.typeHasProperty(node.expression, '_LIT_LOCALIZE_LOCALIZED_')) {
if (node.arguments.length !== 1) {
// TODO(aomarks) Surface as diagnostic instead.
throw new KnownError(`Expected Localized mixin call to have one argument, ` +
`got ${node.arguments.length}`);
}
return node.arguments[0];
// updateWhenLocaleChanges() -> undefined
if (this.typeHasProperty(node.expression, '_LIT_LOCALIZE_CONTROLLER_FN_')) {
return ts.createIdentifier('undefined');
}
}
// @localized -> removed
if (ts.isDecorator(node) &&
ts.isCallExpression(node.expression) &&
this.typeHasProperty(node.expression.expression, '_LIT_LOCALIZE_DECORATOR_')) {
return undefined;
}
// LOCALE_STATUS_EVENT -> "lit-localize-status"

@@ -351,3 +352,4 @@ //

if (props.some((prop) => prop.escapedName === '_LIT_LOCALIZE_MSG_' ||
prop.escapedName === '_LIT_LOCALIZE_LOCALIZED_')) {
prop.escapedName === '_LIT_LOCALIZE_CONTROLLER_FN_' ||
prop.escapedName === '_LIT_LOCALIZE_DECORATOR_')) {
return true;

@@ -369,3 +371,3 @@ }

/**
* Wrap a TemplateLiteral in the lit-html `html` tag.
* Wrap a TemplateLiteral in the lit `html` tag.
*/

@@ -372,0 +374,0 @@ function tagLit(template) {

@@ -181,4 +181,3 @@ /**

return {
error: createDiagnostic(file, templateArg, `Expected first argument to msg() to be a string or lit-html ` +
`template.`),
error: createDiagnostic(file, templateArg, `Expected first argument to msg() to be a string or Lit template.`),
};

@@ -253,3 +252,3 @@ }

*
* [1] Valid anywhere a lit-html expression binding can go without changing the
* [1] Valid anywhere a Lit expression binding can go without changing the
* structure of the HTML.

@@ -256,0 +255,0 @@ * [2] Unambiguous, so that existing code wouldn't accidentally look like this.

{
"name": "@lit/localize-tools",
"version": "0.2.1",
"version": "0.3.0",
"publishConfig": {

@@ -10,3 +10,3 @@ "access": "public"

"author": "Google LLC",
"homepage": "https://github.com/Polymer/lit-html/tree/lit-next/packages/localize-tools",
"homepage": "https://github.com/Polymer/lit-html/tree/main/packages/localize-tools",
"repository": {

@@ -41,8 +41,7 @@ "type": "git",

"dependencies": {
"@lit/localize": "^0.9.0",
"@lit/localize": "^0.10.0",
"fs-extra": "^9.0.0",
"glob": "^7.1.6",
"jsonschema": "^1.4.0",
"lit-element": "^2.3.1",
"lit-html": "^1.2.1",
"lit": "^2.0.0-pre.2",
"minimist": "^1.2.5",

@@ -49,0 +48,0 @@ "parse5": "^6.0.0",

@@ -12,3 +12,3 @@ # @lit/localize-tools

Tooling for @lit/localize. See the [@lit/localize
README](https://github.com/Polymer/lit-html/tree/lit-next/packages/localize#readme)
README](https://github.com/Polymer/lit-html/tree/main/packages/localize#readme)
for documentation.

@@ -36,3 +36,3 @@ /**

Default: ./lit-localize.json
See https://github.com/Polymer/lit-html/tree/lit-next/packages/localize#readme for details.
See https://github.com/Polymer/lit-html/tree/main/packages/localize#readme for details.
`;

@@ -39,0 +39,0 @@

@@ -49,4 +49,4 @@ /**

/**
* True if this message was tagged as a lit-html template, or was a function
* that returned a lit-html template.
* True if this message was tagged as a Lit template, or was a function that
* returned a Lit template.
*/

@@ -66,4 +66,4 @@ isLitTemplate: boolean;

* A placeholder is a allows a bit of untranslatable text to be re-positioned by
* the translator, but not modified. We use placeholders to contain embedded HTML
* extracted from lit-html templates.
* the translator, but not modified. We use placeholders to contain embedded
* HTML extracted from Lit templates.
*/

@@ -70,0 +70,0 @@ export interface Placeholder {

@@ -126,3 +126,3 @@ /**

// Whether we'll need to import the lit-html "html" function.
// Whether we'll need to import the lit "html" function.
let importLit = false;

@@ -161,3 +161,3 @@

${importLit ? "import {html} from 'lit-html';" : ''}
${importLit ? "import {html} from 'lit';" : ''}

@@ -183,4 +183,4 @@ /* eslint-disable no-irregular-whitespace */

/**
* Convert the contents of a message to a TypeScript string, possibly using
* lit-html if there is embedded HTML.
* Convert the contents of a message to a TypeScript string, possibly using lit
* if there is embedded HTML.
*/

@@ -187,0 +187,0 @@ function makeMessageString(

@@ -249,15 +249,22 @@ /**

// Localized(LitElement) -> LitElement
if (this.typeHasProperty(node.expression, '_LIT_LOCALIZE_LOCALIZED_')) {
if (node.arguments.length !== 1) {
// TODO(aomarks) Surface as diagnostic instead.
throw new KnownError(
`Expected Localized mixin call to have one argument, ` +
`got ${node.arguments.length}`
);
}
return node.arguments[0];
// updateWhenLocaleChanges() -> undefined
if (
this.typeHasProperty(node.expression, '_LIT_LOCALIZE_CONTROLLER_FN_')
) {
return ts.createIdentifier('undefined');
}
}
// @localized -> removed
if (
ts.isDecorator(node) &&
ts.isCallExpression(node.expression) &&
this.typeHasProperty(
node.expression.expression,
'_LIT_LOCALIZE_DECORATOR_'
)
) {
return undefined;
}
// LOCALE_STATUS_EVENT -> "lit-localize-status"

@@ -511,3 +518,4 @@ //

prop.escapedName === '_LIT_LOCALIZE_MSG_' ||
prop.escapedName === '_LIT_LOCALIZE_LOCALIZED_'
prop.escapedName === '_LIT_LOCALIZE_CONTROLLER_FN_' ||
prop.escapedName === '_LIT_LOCALIZE_DECORATOR_'
)

@@ -536,3 +544,3 @@ ) {

/**
* Wrap a TemplateLiteral in the lit-html `html` tag.
* Wrap a TemplateLiteral in the lit `html` tag.
*/

@@ -539,0 +547,0 @@ function tagLit(template: ts.TemplateLiteral): ts.TaggedTemplateExpression {

@@ -272,4 +272,3 @@ /**

templateArg,
`Expected first argument to msg() to be a string or lit-html ` +
`template.`
`Expected first argument to msg() to be a string or Lit template.`
),

@@ -364,3 +363,3 @@ };

*
* [1] Valid anywhere a lit-html expression binding can go without changing the
* [1] Valid anywhere a Lit expression binding can go without changing the
* structure of the HTML.

@@ -367,0 +366,0 @@ * [2] Unambiguous, so that existing code wouldn't accidentally look like this.

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