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

@vocab/core

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vocab/core - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

9

CHANGELOG.md
# @vocab/core
## 1.0.2
### Patch Changes
- [`3ec6dba`](https://github.com/seek-oss/vocab/commit/3ec6dbaad590299cc33e2d9d4a877576eb05853a) [#63](https://github.com/seek-oss/vocab/pull/63) Thanks [@jahredhope](https://github.com/jahredhope)! - Migrate to new @formatjs/icu-messageformat-parser as intl-messageformat-parser has been deprecated
- Updated dependencies [[`3ec6dba`](https://github.com/seek-oss/vocab/commit/3ec6dbaad590299cc33e2d9d4a877576eb05853a)]:
- @vocab/types@1.0.1
## 1.0.1

@@ -4,0 +13,0 @@

22

dist/vocab-core.cjs.dev.js

@@ -7,3 +7,3 @@ 'use strict';

var path = require('path');
var intlMessageformatParser = require('intl-messageformat-parser');
var icuMessageformatParser = require('@formatjs/icu-messageformat-parser');
var prettier = require('prettier');

@@ -374,3 +374,3 @@ var chokidar = require('chokidar');

return ast.some(element => {
if (intlMessageformatParser.isSelectElement(element)) {
if (icuMessageformatParser.isSelectElement(element)) {
const children = Object.values(element.options).map(o => o.value);

@@ -380,3 +380,3 @@ return children.some(child => extractHasTags(child));

return intlMessageformatParser.isTagElement(element);
return icuMessageformatParser.isTagElement(element);
});

@@ -390,11 +390,11 @@ }

for (const element of ast) {
if (intlMessageformatParser.isArgumentElement(element)) {
if (icuMessageformatParser.isArgumentElement(element)) {
params[element.value] = 'string';
} else if (intlMessageformatParser.isNumberElement(element)) {
} else if (icuMessageformatParser.isNumberElement(element)) {
params[element.value] = 'number';
} else if (intlMessageformatParser.isPluralElement(element)) {
} else if (icuMessageformatParser.isPluralElement(element)) {
params[element.value] = 'number';
} else if (intlMessageformatParser.isDateElement(element) || intlMessageformatParser.isTimeElement(element)) {
} else if (icuMessageformatParser.isDateElement(element) || icuMessageformatParser.isTimeElement(element)) {
params[element.value] = 'Date | number';
} else if (intlMessageformatParser.isTagElement(element)) {
} else if (icuMessageformatParser.isTagElement(element)) {
params[element.value] = 'FormatXMLElementFn<T>';

@@ -407,3 +407,3 @@ imports.add(`import { FormatXMLElementFn } from '@vocab/types';`);

};
} else if (intlMessageformatParser.isSelectElement(element)) {
} else if (icuMessageformatParser.isSelectElement(element)) {
params[element.value] = Object.keys(element.options).map(o => `'${o}'`).join(' | ');

@@ -489,3 +489,3 @@ const children = Object.values(element.options).map(o => o.value);

if (translatedLanguage[key]) {
const ast = intlMessageformatParser.parse(translatedLanguage[key].message);
const ast = icuMessageformatParser.parse(translatedLanguage[key].message);
hasTags = hasTags || extractHasTags(ast);

@@ -706,3 +706,3 @@ const [parsedParams, parsedImports] = extractParamTypes(ast);

if (isValid !== true) {
throw new ValidationError('InvalidStructure', isValid.map(v => {
throw new ValidationError('InvalidStructure', (Array.isArray(isValid) ? isValid : []).map(v => {
if (v.type === 'objectStrict') {

@@ -709,0 +709,0 @@ return `Invalid key(s) ${splitMap(v.actual, m => `"${chalk__default['default'].cyan(m)}"`)}. Expected one of ${splitMap(v.expected, chalk__default['default'].green)}`;

@@ -7,3 +7,3 @@ 'use strict';

var path = require('path');
var intlMessageformatParser = require('intl-messageformat-parser');
var icuMessageformatParser = require('@formatjs/icu-messageformat-parser');
var prettier = require('prettier');

@@ -374,3 +374,3 @@ var chokidar = require('chokidar');

return ast.some(element => {
if (intlMessageformatParser.isSelectElement(element)) {
if (icuMessageformatParser.isSelectElement(element)) {
const children = Object.values(element.options).map(o => o.value);

@@ -380,3 +380,3 @@ return children.some(child => extractHasTags(child));

return intlMessageformatParser.isTagElement(element);
return icuMessageformatParser.isTagElement(element);
});

@@ -390,11 +390,11 @@ }

for (const element of ast) {
if (intlMessageformatParser.isArgumentElement(element)) {
if (icuMessageformatParser.isArgumentElement(element)) {
params[element.value] = 'string';
} else if (intlMessageformatParser.isNumberElement(element)) {
} else if (icuMessageformatParser.isNumberElement(element)) {
params[element.value] = 'number';
} else if (intlMessageformatParser.isPluralElement(element)) {
} else if (icuMessageformatParser.isPluralElement(element)) {
params[element.value] = 'number';
} else if (intlMessageformatParser.isDateElement(element) || intlMessageformatParser.isTimeElement(element)) {
} else if (icuMessageformatParser.isDateElement(element) || icuMessageformatParser.isTimeElement(element)) {
params[element.value] = 'Date | number';
} else if (intlMessageformatParser.isTagElement(element)) {
} else if (icuMessageformatParser.isTagElement(element)) {
params[element.value] = 'FormatXMLElementFn<T>';

@@ -407,3 +407,3 @@ imports.add(`import { FormatXMLElementFn } from '@vocab/types';`);

};
} else if (intlMessageformatParser.isSelectElement(element)) {
} else if (icuMessageformatParser.isSelectElement(element)) {
params[element.value] = Object.keys(element.options).map(o => `'${o}'`).join(' | ');

@@ -489,3 +489,3 @@ const children = Object.values(element.options).map(o => o.value);

if (translatedLanguage[key]) {
const ast = intlMessageformatParser.parse(translatedLanguage[key].message);
const ast = icuMessageformatParser.parse(translatedLanguage[key].message);
hasTags = hasTags || extractHasTags(ast);

@@ -706,3 +706,3 @@ const [parsedParams, parsedImports] = extractParamTypes(ast);

if (isValid !== true) {
throw new ValidationError('InvalidStructure', isValid.map(v => {
throw new ValidationError('InvalidStructure', (Array.isArray(isValid) ? isValid : []).map(v => {
if (v.type === 'objectStrict') {

@@ -709,0 +709,0 @@ return `Invalid key(s) ${splitMap(v.actual, m => `"${chalk__default['default'].cyan(m)}"`)}. Expected one of ${splitMap(v.expected, chalk__default['default'].green)}`;

import { promises, existsSync } from 'fs';
import path from 'path';
import { parse, isSelectElement, isTagElement, isArgumentElement, isNumberElement, isPluralElement, isDateElement, isTimeElement } from 'intl-messageformat-parser';
import { parse, isSelectElement, isTagElement, isArgumentElement, isNumberElement, isPluralElement, isDateElement, isTimeElement } from '@formatjs/icu-messageformat-parser';
import prettier from 'prettier';

@@ -685,3 +685,3 @@ import chokidar from 'chokidar';

if (isValid !== true) {
throw new ValidationError('InvalidStructure', isValid.map(v => {
throw new ValidationError('InvalidStructure', (Array.isArray(isValid) ? isValid : []).map(v => {
if (v.type === 'objectStrict') {

@@ -688,0 +688,0 @@ return `Invalid key(s) ${splitMap(v.actual, m => `"${chalk.cyan(m)}"`)}. Expected one of ${splitMap(v.expected, chalk.green)}`;

{
"name": "@vocab/core",
"version": "1.0.1",
"version": "1.0.2",
"main": "dist/vocab-core.cjs.js",

@@ -17,3 +17,4 @@ "module": "dist/vocab-core.esm.js",

"dependencies": {
"@vocab/types": "^1.0.0",
"@formatjs/icu-messageformat-parser": "^2.0.10",
"@vocab/types": "^1.0.1",
"chalk": "^4.1.0",

@@ -25,4 +26,3 @@ "chokidar": "^3.4.3",

"find-up": "^5.0.0",
"intl-messageformat": "^9.3.18",
"intl-messageformat-parser": "^6.0.16",
"intl-messageformat": "^9.9.0",
"prettier": "^2.1.2"

@@ -29,0 +29,0 @@ },

@@ -113,3 +113,3 @@ # Vocab

### Step 6: [Optional] Setup Webpack plugin
### Step 6: [Optional] Set up Webpack plugin

@@ -175,4 +175,6 @@ Right now every language is loaded into your web application all the time, which could lead to a large bundle size. Ideally you will want to switch out the Node/default runtime for web runtime that will load only the active language.

```tsx
t('my key with param', {name: 'Vocab'});
t('my key with component', {Link: children => (<a href="/foo">{children}</Link>)});
t('my key with param', { name: 'Vocab' });
t('my key with component', {
Link: (children) => <a href="/foo">{children}</a>
});
```

@@ -199,3 +201,3 @@

*/
projectRoot: ['./example/'];
projectRoot: './example/';
/**

@@ -202,0 +204,0 @@ * A custom suffix to name vocab translation directories

@@ -5,5 +5,5 @@ 'use strict';

require('intl-messageformat');
var icuHandler_dist_vocabCoreIcuHandler = require('../../icu-handler/dist/vocab-core-icu-handler.cjs.dev.js');
var translationFile_dist_vocabCoreTranslationFile = require('../../translation-file/dist/vocab-core-translation-file.cjs.dev.js');
require('intl-messageformat');

@@ -10,0 +10,0 @@ const createLanguage = module => ({

@@ -5,5 +5,5 @@ 'use strict';

require('intl-messageformat');
var icuHandler_dist_vocabCoreIcuHandler = require('../../icu-handler/dist/vocab-core-icu-handler.cjs.prod.js');
var translationFile_dist_vocabCoreTranslationFile = require('../../translation-file/dist/vocab-core-translation-file.cjs.prod.js');
require('intl-messageformat');

@@ -10,0 +10,0 @@ const createLanguage = module => ({

@@ -1,4 +0,4 @@

import 'intl-messageformat';
import { getParsedICUMessages } from '../../icu-handler/dist/vocab-core-icu-handler.esm.js';
export { createTranslationFile } from '../../translation-file/dist/vocab-core-translation-file.esm.js';
import 'intl-messageformat';

@@ -5,0 +5,0 @@ const createLanguage = module => ({

@@ -15,3 +15,3 @@ import { promises as fs, existsSync } from 'fs';

parse,
} from 'intl-messageformat-parser';
} from '@formatjs/icu-messageformat-parser';
import prettier from 'prettier';

@@ -18,0 +18,0 @@ import chokidar from 'chokidar';

@@ -49,3 +49,3 @@ import { UserConfig } from '@vocab/types';

'InvalidStructure',
isValid
(Array.isArray(isValid) ? isValid : [])
.map((v) => {

@@ -52,0 +52,0 @@ if (v.type === 'objectStrict') {

@@ -12,3 +12,3 @@ import {

Language extends LanguageName,
FormatFnByKey extends ParsedFormatFnByKey
FormatFnByKey extends ParsedFormatFnByKey,
>(

@@ -15,0 +15,0 @@ translationsByLanguage: TranslationModuleByLanguage<Language, FormatFnByKey>,

@@ -60,2 +60,3 @@ import { LoadedTranslation, LanguageName } from '@vocab/types';

if (missingKeys) {
// eslint-disable-next-line jest/no-conditional-expect
expect(result[1]).toMatchObject(missingKeys);

@@ -62,0 +63,0 @@ }

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