Skip to content

Commit

Permalink
feat(bundle-utils): support AST minify option
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Aug 29, 2023
1 parent 61fb06e commit 063cd0f
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 62 deletions.
4 changes: 2 additions & 2 deletions packages/bundle-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
}
},
"dependencies": {
"@intlify/message-compiler": "9.3.0-beta.24",
"@intlify/shared": "9.3.0-beta.24",
"@intlify/message-compiler": "9.3.0-beta.26",
"@intlify/shared": "9.3.0-beta.26",
"acorn": "^8.8.2",
"escodegen": "^2.0.0",
"estree-walker": "^2.0.2",
Expand Down
6 changes: 5 additions & 1 deletion packages/bundle-utils/src/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface CodeGenOptions {
strictMessage?: boolean
escapeHtml?: boolean
jit?: boolean
minify?: boolean
onWarn?: (msg: string) => void
onError?: (
msg: string,
Expand Down Expand Up @@ -418,7 +419,10 @@ export function generateResourceAst(
const _msg = detecteHtmlInMsg && escapeHtml ? sanitizeHtml(msg) : msg

const newOptions = Object.assign(
{ location: env === 'development' },
{
location: env === 'development',
minify: isBoolean(options.minify) ? options.minify : env === 'production'
},
options
) as CompileOptions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,18 @@ exports[`generateResourceAst > development 1`] = `
exports[`generateResourceAst > production 1`] = `
{
"ast": {
"body": {
"items": [
"b": {
"i": [
{
"type": 3,
"value": "hello",
"t": 3,
},
],
"type": 2,
"s": "hello",
"t": 2,
},
"type": 0,
"t": 0,
},
"code": "{\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hello\\"}]}}",
"code": "{\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hello\\"}}",
"errors": [],
"map": undefined,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ Node {

exports[`AST code generation > code 1`] = `
"const resource = {
\\"hi\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"hi there!\\"}},
\\"hello\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"hello world!\\"}},
\\"named\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hi, \\"},{\\"type\\":4,\\"key\\":\\"name\\"},{\\"type\\":3,\\"value\\":\\" !\\"}]}},
\\"list\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hi, \\"},{\\"type\\":5,\\"index\\":0},{\\"type\\":3,\\"value\\":\\" !\\"}]}},
\\"literal\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3},{\\"type\\":9},{\\"type\\":3}],\\"static\\":\\"hi, kazupon !\\"}},
\\"linked\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hi, \\"},{\\"type\\":6,\\"key\\":{\\"type\\":7,\\"value\\":\\"name\\"}},{\\"type\\":3,\\"value\\":\\" !\\"}]}},
\\"plural\\": {\\"type\\":0,\\"body\\":{\\"type\\":1,\\"cases\\":[{\\"type\\":2,\\"items\\":[{\\"type\\":6,\\"modifier\\":{\\"type\\":8,\\"value\\":\\"caml\\"},\\"key\\":{\\"type\\":9,\\"value\\":\\"no apples\\"}}]},{\\"type\\":2,\\"items\\":[{\\"type\\":5,\\"index\\":0},{\\"type\\":3,\\"value\\":\\" apple\\"}]},{\\"type\\":2,\\"items\\":[{\\"type\\":4,\\"key\\":\\"n\\"},{\\"type\\":3,\\"value\\":\\" apples\\"}]}]}}
\\"hi\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hi there!\\"}},
\\"hello\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hello world!\\"}},
\\"named\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"hi, \\"},{\\"t\\":4,\\"k\\":\\"name\\"},{\\"t\\":3,\\"v\\":\\" !\\"}]}},
\\"list\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"hi, \\"},{\\"t\\":5,\\"i\\":0},{\\"t\\":3,\\"v\\":\\" !\\"}]}},
\\"literal\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3},{\\"t\\":9},{\\"t\\":3}],\\"s\\":\\"hi, kazupon !\\"}},
\\"linked\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"hi, \\"},{\\"t\\":6,\\"k\\":{\\"t\\":7,\\"v\\":\\"name\\"}},{\\"t\\":3,\\"v\\":\\" !\\"}]}},
\\"plural\\": {\\"t\\":0,\\"b\\":{\\"t\\":1,\\"c\\":[{\\"t\\":2,\\"i\\":[{\\"t\\":6,\\"k\\":{\\"t\\":9,\\"v\\":\\"no apples\\"},\\"m\\":{\\"t\\":8,\\"v\\":\\"caml\\"}}]},{\\"t\\":2,\\"i\\":[{\\"t\\":5,\\"i\\":0},{\\"t\\":3,\\"v\\":\\" apple\\"}]},{\\"t\\":2,\\"i\\":[{\\"t\\":4,\\"k\\":\\"n\\"},{\\"t\\":3,\\"v\\":\\" apples\\"}]}]}}
}
export default resource"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,13 @@ exports[`AST code generation > legacy > code 1`] = `
exports[`AST code generation > production > code 1`] = `
"const resource = {
\\"hi\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"hi there!\\"}},
\\"hello\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"hello world!\\"}},
\\"named\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hi, \\"},{\\"type\\":4,\\"key\\":\\"name\\"},{\\"type\\":3,\\"value\\":\\" !\\"}]}},
\\"list\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hi, \\"},{\\"type\\":5,\\"index\\":0},{\\"type\\":3,\\"value\\":\\" !\\"}]}},
\\"literal\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3},{\\"type\\":9},{\\"type\\":3}],\\"static\\":\\"hi, kazupon !\\"}},
\\"linked\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hi, \\"},{\\"type\\":6,\\"key\\":{\\"type\\":7,\\"value\\":\\"name\\"}},{\\"type\\":3,\\"value\\":\\" !\\"}]}},
\\"plural\\": {\\"type\\":0,\\"body\\":{\\"type\\":1,\\"cases\\":[{\\"type\\":2,\\"items\\":[{\\"type\\":6,\\"modifier\\":{\\"type\\":8,\\"value\\":\\"caml\\"},\\"key\\":{\\"type\\":9,\\"value\\":\\"no apples\\"}}]},{\\"type\\":2,\\"items\\":[{\\"type\\":5,\\"index\\":0},{\\"type\\":3,\\"value\\":\\" apple\\"}]},{\\"type\\":2,\\"items\\":[{\\"type\\":4,\\"key\\":\\"n\\"},{\\"type\\":3,\\"value\\":\\" apples\\"}]}]}}
\\"hi\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hi there!\\"}},
\\"hello\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hello world!\\"}},
\\"named\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"hi, \\"},{\\"t\\":4,\\"k\\":\\"name\\"},{\\"t\\":3,\\"v\\":\\" !\\"}]}},
\\"list\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"hi, \\"},{\\"t\\":5,\\"i\\":0},{\\"t\\":3,\\"v\\":\\" !\\"}]}},
\\"literal\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3},{\\"t\\":9},{\\"t\\":3}],\\"s\\":\\"hi, kazupon !\\"}},
\\"linked\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"hi, \\"},{\\"t\\":6,\\"k\\":{\\"t\\":7,\\"v\\":\\"name\\"}},{\\"t\\":3,\\"v\\":\\" !\\"}]}},
\\"plural\\": {\\"t\\":0,\\"b\\":{\\"t\\":1,\\"c\\":[{\\"t\\":2,\\"i\\":[{\\"t\\":6,\\"k\\":{\\"t\\":9,\\"v\\":\\"no apples\\"},\\"m\\":{\\"t\\":8,\\"v\\":\\"caml\\"}}]},{\\"t\\":2,\\"i\\":[{\\"t\\":5,\\"i\\":0},{\\"t\\":3,\\"v\\":\\" apple\\"}]},{\\"t\\":2,\\"i\\":[{\\"t\\":4,\\"k\\":\\"n\\"},{\\"t\\":3,\\"v\\":\\" apples\\"}]}]}}
}
export default resource"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

exports[`AST code generation > code 1`] = `
"const resource = {
\\"hi\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"hi there!\\"}},
\\"hi\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hi there!\\"}},
\\"nested\\": {
\\"hello\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"hello world!\\"}},
\\"hello\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hello world!\\"}},
\\"more\\": {
\\"plural\\": {\\"type\\":0,\\"body\\":{\\"type\\":1,\\"cases\\":[{\\"type\\":2,\\"items\\":[{\\"type\\":6,\\"modifier\\":{\\"type\\":8,\\"value\\":\\"caml\\"},\\"key\\":{\\"type\\":9,\\"value\\":\\"no apples\\"}}]},{\\"type\\":2,\\"items\\":[{\\"type\\":5,\\"index\\":0},{\\"type\\":3,\\"value\\":\\" apple\\"}]},{\\"type\\":2,\\"items\\":[{\\"type\\":4,\\"key\\":\\"n\\"},{\\"type\\":3,\\"value\\":\\" apples\\"}]}]}}
\\"plural\\": {\\"t\\":0,\\"b\\":{\\"t\\":1,\\"c\\":[{\\"t\\":2,\\"i\\":[{\\"t\\":6,\\"k\\":{\\"t\\":9,\\"v\\":\\"no apples\\"},\\"m\\":{\\"t\\":8,\\"v\\":\\"caml\\"}}]},{\\"t\\":2,\\"i\\":[{\\"t\\":5,\\"i\\":0},{\\"t\\":3,\\"v\\":\\" apple\\"}]},{\\"t\\":2,\\"i\\":[{\\"t\\":4,\\"k\\":\\"n\\"},{\\"t\\":3,\\"v\\":\\" apples\\"}]}]}}
},
\\"list\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hi, \\"},{\\"type\\":5,\\"index\\":0},{\\"type\\":3,\\"value\\":\\" !\\"}]}}
\\"list\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"hi, \\"},{\\"t\\":5,\\"i\\":0},{\\"t\\":3,\\"v\\":\\" !\\"}]}}
},
\\"こんにちは\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"こんにちは!\\"}},
\\"single-quote\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"I don\\\\u0027t know!\\"}},
\\"emoji\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"😺\\"}},
\\"unicode\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"A\\"}},
\\"unicode-escape\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"\\\\\\\\u0041\\"}},
\\"backslash-single-quote\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"\\\\\\\\\\\\u0027\\"}},
\\"backslash-backslash\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"\\\\\\\\\\\\\\\\\\"}},
\\"こんにちは\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"こんにちは!\\"}},
\\"single-quote\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"I don\\\\u0027t know!\\"}},
\\"emoji\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"😺\\"}},
\\"unicode\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"A\\"}},
\\"unicode-escape\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"\\\\\\\\u0041\\"}},
\\"backslash-single-quote\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"\\\\\\\\\\\\u0027\\"}},
\\"backslash-backslash\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"\\\\\\\\\\\\\\\\\\"}},
\\"errors\\": [
{\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"ERROR1001\\"}},
{\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"ERROR1002\\"}},
{\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"ERROR1001\\"}},
{\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"ERROR1002\\"}},
],
\\"complex\\": {
\\"warnings\\": [
{\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"NOTE: This is warning\\"}},
{\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"NOTE: This is warning\\"}},
{
\\"named-waring\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"this is \\"},{\\"type\\":4,\\"key\\":\\"type\\"},{\\"type\\":3,\\"value\\":\\" warining\\"}]}}
\\"named-waring\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"this is \\"},{\\"t\\":4,\\"k\\":\\"type\\"},{\\"t\\":3,\\"v\\":\\" warining\\"}]}}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

exports[`AST code generation > code 1`] = `
"const resource = {
\\"hi\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"hi there!\\"}},
\\"hi\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hi there!\\"}},
\\"nested\\": {
\\"hello\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"hello world!\\"}},
\\"hello\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"hello world!\\"}},
\\"more\\": {
\\"plural\\": {\\"type\\":0,\\"body\\":{\\"type\\":1,\\"cases\\":[{\\"type\\":2,\\"items\\":[{\\"type\\":6,\\"modifier\\":{\\"type\\":8,\\"value\\":\\"caml\\"},\\"key\\":{\\"type\\":9,\\"value\\":\\"no apples\\"}}]},{\\"type\\":2,\\"items\\":[{\\"type\\":5,\\"index\\":0},{\\"type\\":3,\\"value\\":\\" apple\\"}]},{\\"type\\":2,\\"items\\":[{\\"type\\":4,\\"key\\":\\"n\\"},{\\"type\\":3,\\"value\\":\\" apples\\"}]}]}}
\\"plural\\": {\\"t\\":0,\\"b\\":{\\"t\\":1,\\"c\\":[{\\"t\\":2,\\"i\\":[{\\"t\\":6,\\"k\\":{\\"t\\":9,\\"v\\":\\"no apples\\"},\\"m\\":{\\"t\\":8,\\"v\\":\\"caml\\"}}]},{\\"t\\":2,\\"i\\":[{\\"t\\":5,\\"i\\":0},{\\"t\\":3,\\"v\\":\\" apple\\"}]},{\\"t\\":2,\\"i\\":[{\\"t\\":4,\\"k\\":\\"n\\"},{\\"t\\":3,\\"v\\":\\" apples\\"}]}]}}
},
\\"list\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"hi, \\"},{\\"type\\":5,\\"index\\":0},{\\"type\\":3,\\"value\\":\\" !\\"}]}}
\\"list\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"hi, \\"},{\\"t\\":5,\\"i\\":0},{\\"t\\":3,\\"v\\":\\" !\\"}]}}
},
\\"こんにちは\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"こんにちは!\\"}},
\\"single-quote\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"I don\\\\u0027t know!\\"}},
\\"emoji\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"😺\\"}},
\\"unicode\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"A\\"}},
\\"unicode-escape\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"\\\\\\\\u0041\\"}},
\\"backslash-single-quote\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"\\\\\\\\\\\\u0027\\"}},
\\"backslash-backslash\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"\\\\\\\\\\\\\\\\\\"}},
\\"こんにちは\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"こんにちは!\\"}},
\\"single-quote\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"I don\\\\u0027t know!\\"}},
\\"emoji\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"😺\\"}},
\\"unicode\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"A\\"}},
\\"unicode-escape\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"\\\\\\\\u0041\\"}},
\\"backslash-single-quote\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"\\\\\\\\\\\\u0027\\"}},
\\"backslash-backslash\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"\\\\\\\\\\\\\\\\\\"}},
\\"errors\\": [
{\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"ERROR1001\\"}},
{\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"ERROR1002\\"}},
{\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"ERROR1001\\"}},
{\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"ERROR1002\\"}},
],
\\"complex\\": {
\\"warnings\\": [
{\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3}],\\"static\\":\\"NOTE: This is warning\\"}},
{\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3}],\\"s\\":\\"NOTE: This is warning\\"}},
{
\\"named-waring\\": {\\"type\\":0,\\"body\\":{\\"type\\":2,\\"items\\":[{\\"type\\":3,\\"value\\":\\"this is \\"},{\\"type\\":4,\\"key\\":\\"type\\"},{\\"type\\":3,\\"value\\":\\" warining\\"}]}}
\\"named-waring\\": {\\"t\\":0,\\"b\\":{\\"t\\":2,\\"i\\":[{\\"t\\":3,\\"v\\":\\"this is \\"},{\\"t\\":4,\\"k\\":\\"type\\"},{\\"t\\":3,\\"v\\":\\" warining\\"}]}}
}
]
}
Expand Down
6 changes: 5 additions & 1 deletion packages/bundle-utils/test/generator/codegen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ describe('generateResourceAst', () => {
})
test('production', () => {
expect(
generateResourceAst('hello', { env: 'production' })
generateResourceAst('hello', {
env: 'production',
jit: true,
minify: true
})
).toMatchSnapshot()
})
test('syntax error', () => {
Expand Down
21 changes: 14 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@intlify/bundle-utils@workspace:packages/bundle-utils"
dependencies:
"@intlify/message-compiler": 9.3.0-beta.24
"@intlify/shared": 9.3.0-beta.24
"@intlify/message-compiler": 9.3.0-beta.26
"@intlify/shared": 9.3.0-beta.26
"@types/escodegen": ^0.0.7
"@types/estree": ^1.0.0
acorn: ^8.8.2
Expand Down Expand Up @@ -1221,13 +1221,13 @@ __metadata:
languageName: node
linkType: hard

"@intlify/message-compiler@npm:9.3.0-beta.24":
version: 9.3.0-beta.24
resolution: "@intlify/message-compiler@npm:9.3.0-beta.24"
"@intlify/message-compiler@npm:9.3.0-beta.26":
version: 9.3.0-beta.26
resolution: "@intlify/message-compiler@npm:9.3.0-beta.26"
dependencies:
"@intlify/shared": 9.3.0-beta.24
"@intlify/shared": 9.3.0-beta.26
source-map-js: ^1.0.2
checksum: 780a35df65dea03e94ec0303820fdd03684d9ef3c942a6c47a792d51620a6ffab8975919482f26023d1b8115fd01e40b397d558cf779febc6af9e0c889208d2c
checksum: 95e3b27840cf0f6a6703bca461924a698a6f0088b642f927573870941d69ceb5216fc9ff5ae54edc075319fb0ce91745429a3c0d0ff64c282b0d191ccdd36356
languageName: node
linkType: hard

Expand Down Expand Up @@ -1282,6 +1282,13 @@ __metadata:
languageName: node
linkType: hard

"@intlify/shared@npm:9.3.0-beta.26":
version: 9.3.0-beta.26
resolution: "@intlify/shared@npm:9.3.0-beta.26"
checksum: bbf0c8c461888f8794ae4610829ceb20eacff253608f9e87e0f476a1318b9f3cea3e2c46c6cbd976afdee38a9fe5291dc91ab41581cebaf6cf43cab135a474cd
languageName: node
linkType: hard

"@intlify/shared@npm:^9.2.2":
version: 9.2.2
resolution: "@intlify/shared@npm:9.2.2"
Expand Down

0 comments on commit 063cd0f

Please sign in to comment.