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

@intlify/bundle-utils

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intlify/bundle-utils - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

9

CHANGELOG.md
## @intlify/bundle-utils@3.1.0 (2022-05-06)
#### :zap: Improvement Features
* [#116](https://github.com/intlify/bundle-tools/pull/116) improvement(bundle-utils): support ESM exporting on bridge ([@kazupon](https://github.com/kazupon))
#### Committers: 1
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
## @intlify/bundle-utils@3.0.0 (2022-04-05)

@@ -3,0 +12,0 @@

1

lib/codegen.d.ts

@@ -27,2 +27,3 @@ import { ResourceNode } from '@intlify/message-compiler';

bridge?: boolean;
exportESM?: boolean;
source?: string;

@@ -29,0 +30,0 @@ sourceMap?: boolean;

2

lib/codegen.js

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

};
const { code, ast, map } = message_compiler_1.baseCompile(msg, newOptions);
const { code, ast, map } = (0, message_compiler_1.baseCompile)(msg, newOptions);
const genCode = !occured

@@ -108,0 +108,0 @@ ? env === 'development'

@@ -10,2 +10,2 @@ /**

*/
export declare function generate(targetSource: string | Buffer, { type, bridge, filename, inSourceMap, locale, isGlobal, sourceMap, env, forceStringify, useClassComponent }: CodeGenOptions, injector?: () => string): CodeGenResult<JSONProgram>;
export declare function generate(targetSource: string | Buffer, { type, bridge, exportESM, filename, inSourceMap, locale, isGlobal, sourceMap, env, forceStringify, useClassComponent }: CodeGenOptions, injector?: () => string): CodeGenResult<JSONProgram>;

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

*/
function generate(targetSource, { type = 'plain', bridge = false, filename = 'vue-i18n-loader.json', inSourceMap = undefined, locale = '', isGlobal = false, sourceMap = false, env = 'development', forceStringify = false, useClassComponent = false }, injector) {
function generate(targetSource, { type = 'plain', bridge = false, exportESM = false, filename = 'vue-i18n-loader.json', inSourceMap = undefined, locale = '', isGlobal = false, sourceMap = false, env = 'development', forceStringify = false, useClassComponent = false }, injector) {
const target = Buffer.isBuffer(targetSource)

@@ -25,2 +25,3 @@ ? targetSource.toString()

bridge,
exportESM,
source: value,

@@ -36,4 +37,4 @@ sourceMap,

};
const generator = codegen_1.createCodeGenerator(options);
const ast = jsonc_eslint_parser_1.parseJSON(value, { filePath: filename });
const generator = (0, codegen_1.createCodeGenerator)(options);
const ast = (0, jsonc_eslint_parser_1.parseJSON)(value, { filePath: filename });
const codeMaps = generateNode(generator, ast, options, injector);

@@ -49,3 +50,3 @@ const { code, map } = generator.context();

const newMap = map
? codegen_1.mapLinesColumns(map.toJSON(), codeMaps, inSourceMap) || null // eslint-disable-line @typescript-eslint/no-explicit-any
? (0, codegen_1.mapLinesColumns)(map.toJSON(), codeMaps, inSourceMap) || null // eslint-disable-line @typescript-eslint/no-explicit-any
: null;

@@ -64,3 +65,4 @@ return {

const codeMaps = new Map();
const { type, bridge, sourceMap, isGlobal, locale, useClassComponent } = options;
const { type, bridge, exportESM, sourceMap, isGlobal, locale, useClassComponent } = options;
// prettier-ignore
const componentNamespace = bridge

@@ -71,3 +73,3 @@ ? `Component.options`

: `Component`;
jsonc_eslint_parser_1.traverseNodes(node, {
(0, jsonc_eslint_parser_1.traverseNodes)(node, {
enterNode(node, parent) {

@@ -83,3 +85,7 @@ switch (node.type) {

const localeName = type === 'sfc' ? (locale != null ? locale : `""`) : '';
const exportSyntax = bridge ? `module.exports =` : `export default`;
const exportSyntax = bridge
? exportESM
? `export default`
: `module.exports =`
: `export default`;
generator.push(`${exportSyntax} function (Component) {`);

@@ -109,5 +115,5 @@ generator.indent();

const value = node.value.value;
if (shared_1.isString(value)) {
if ((0, shared_1.isString)(value)) {
generator.push(`${JSON.stringify(name)}: `);
const { code, map } = codegen_1.generateMessageFunction(value, options);
const { code, map } = (0, codegen_1.generateMessageFunction)(value, options);
sourceMap && map != null && codeMaps.set(value, map);

@@ -120,3 +126,3 @@ generator.push(`${code}`, node.value, value);

generator.push(`${JSON.stringify(name)}: `);
const { code, map } = codegen_1.generateMessageFunction(strValue, options);
const { code, map } = (0, codegen_1.generateMessageFunction)(strValue, options);
sourceMap && map != null && codeMaps.set(strValue, map);

@@ -149,4 +155,4 @@ generator.push(`${code}`, node.value, strValue);

const value = node.value;
if (shared_1.isString(value)) {
const { code, map } = codegen_1.generateMessageFunction(value, options);
if ((0, shared_1.isString)(value)) {
const { code, map } = (0, codegen_1.generateMessageFunction)(value, options);
sourceMap && map != null && codeMaps.set(value, map);

@@ -158,3 +164,3 @@ generator.push(`${code}`, node, value);

const strValue = JSON.stringify(value);
const { code, map } = codegen_1.generateMessageFunction(strValue, options);
const { code, map } = (0, codegen_1.generateMessageFunction)(strValue, options);
sourceMap && map != null && codeMaps.set(strValue, map);

@@ -161,0 +167,0 @@ generator.push(`${code}`, node, strValue);

@@ -10,2 +10,2 @@ /**

*/
export declare function generate(targetSource: string | Buffer, { type, bridge, useClassComponent, filename, inSourceMap, locale, isGlobal, sourceMap, env, forceStringify }: CodeGenOptions, injector?: () => string): CodeGenResult<YAMLProgram>;
export declare function generate(targetSource: string | Buffer, { type, bridge, exportESM, useClassComponent, filename, inSourceMap, locale, isGlobal, sourceMap, env, forceStringify }: CodeGenOptions, injector?: () => string): CodeGenResult<YAMLProgram>;

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

*/
function generate(targetSource, { type = 'plain', bridge = false, useClassComponent = false, filename = 'vue-i18n-loader.yaml', inSourceMap = undefined, locale = '', isGlobal = false, sourceMap = false, env = 'development', forceStringify = false }, injector) {
function generate(targetSource, { type = 'plain', bridge = false, exportESM = false, useClassComponent = false, filename = 'vue-i18n-loader.yaml', inSourceMap = undefined, locale = '', isGlobal = false, sourceMap = false, env = 'development', forceStringify = false }, injector) {
const value = Buffer.isBuffer(targetSource)

@@ -21,2 +21,3 @@ ? targetSource.toString()

bridge,
exportESM,
source: value,

@@ -32,4 +33,4 @@ sourceMap,

};
const generator = codegen_1.createCodeGenerator(options);
const ast = yaml_eslint_parser_1.parseYAML(value, { filePath: filename });
const generator = (0, codegen_1.createCodeGenerator)(options);
const ast = (0, yaml_eslint_parser_1.parseYAML)(value, { filePath: filename });
const codeMaps = generateNode(generator, ast, options, injector);

@@ -39,3 +40,3 @@ const { code, map } = generator.context();

const newMap = map
? codegen_1.mapLinesColumns(map.toJSON(), codeMaps, inSourceMap) || null // eslint-disable-line @typescript-eslint/no-explicit-any
? (0, codegen_1.mapLinesColumns)(map.toJSON(), codeMaps, inSourceMap) || null // eslint-disable-line @typescript-eslint/no-explicit-any
: null;

@@ -54,3 +55,4 @@ return {

const codeMaps = new Map();
const { type, bridge, sourceMap, isGlobal, locale, useClassComponent } = options;
const { type, bridge, exportESM, sourceMap, isGlobal, locale, useClassComponent } = options;
// prettier-ignore
const componentNamespace = bridge

@@ -61,3 +63,3 @@ ? `Component.options`

: `Component`;
yaml_eslint_parser_1.traverseNodes(node, {
(0, yaml_eslint_parser_1.traverseNodes)(node, {
enterNode(node, parent) {

@@ -72,3 +74,7 @@ switch (node.type) {

const localeName = type === 'sfc' ? (locale != null ? locale : `""`) : '';
const exportSyntax = bridge ? `module.exports =` : `export default`;
const exportSyntax = bridge
? exportESM
? `export default`
: `module.exports =`
: `export default`;
generator.push(`${exportSyntax} function (Component) {`);

@@ -99,5 +105,5 @@ generator.indent();

const value = node.value.value;
if (shared_1.isString(value)) {
if ((0, shared_1.isString)(value)) {
generator.push(`${JSON.stringify(name)}: `);
const { code, map } = codegen_1.generateMessageFunction(value, options);
const { code, map } = (0, codegen_1.generateMessageFunction)(value, options);
sourceMap && map != null && codeMaps.set(value, map);

@@ -110,3 +116,3 @@ generator.push(`${code}`, node.value, value);

generator.push(`${JSON.stringify(name)}: `);
const { code, map } = codegen_1.generateMessageFunction(strValue, options);
const { code, map } = (0, codegen_1.generateMessageFunction)(strValue, options);
sourceMap && map != null && codeMaps.set(strValue, map);

@@ -140,4 +146,4 @@ generator.push(`${code}`, node.value, strValue);

const value = node.value;
if (shared_1.isString(value)) {
const { code, map } = codegen_1.generateMessageFunction(value, options);
if ((0, shared_1.isString)(value)) {
const { code, map } = (0, codegen_1.generateMessageFunction)(value, options);
sourceMap && map != null && codeMaps.set(value, map);

@@ -149,3 +155,3 @@ generator.push(`${code}`, node, value);

const strValue = JSON.stringify(value);
const { code, map } = codegen_1.generateMessageFunction(strValue, options);
const { code, map } = (0, codegen_1.generateMessageFunction)(strValue, options);
sourceMap && map != null && codeMaps.set(strValue, map);

@@ -152,0 +158,0 @@ generator.push(`${code}`, node, strValue);

{
"name": "@intlify/bundle-utils",
"description": "Bundle utilities for Intlify project",
"version": "3.0.0",
"version": "3.1.0",
"author": {

@@ -12,8 +12,7 @@ "name": "kazuya kawaguchi",

},
"peerDependencies": {},
"peerDependenciesMeta": {
"vue-i18n": {
"petite-vue-i18n": {
"optional": true
},
"petite-vue-i18n": {
"vue-i18n": {
"optional": true

@@ -26,6 +25,5 @@ }

"jsonc-eslint-parser": "^1.0.1",
"source-map": "^0.6.1",
"source-map": "0.6.1",
"yaml-eslint-parser": "^0.3.2"
},
"devDependencies": {},
"engines": {

@@ -47,9 +45,9 @@ "node": ">= 12"

"build": "tsc -p .",
"clean": "npm-run-all clean:*",
"clean": "npm-run-all \"clean:*\"",
"clean:lib": "rm -rf ./lib",
"watch": "tsc -p . --watch",
"changelog": "esmo ../../scripts/changelog.ts",
"release": "esmo ../../scripts/release.ts"
"changelog": "jiti ../../scripts/changelog.ts",
"release": "jiti ../../scripts/release.ts"
},
"types": "lib/index.d.ts"
}
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