-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Revert vueOptionsNamespace changes from <script setup> commit #501
Merged
lmiller1990
merged 3 commits into
vuejs:master
from
wolfgangwalther:vueOptionsNamespace
Sep 26, 2022
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Basic 1`] = ` | ||
[ | ||
{ | ||
"en": { | ||
"hello": "Hello!", | ||
}, | ||
"ja": { | ||
"hello": "こんにちは!", | ||
}, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`Multiple blocks 1`] = ` | ||
[ | ||
{ | ||
"en": { | ||
"hello": "Hello!", | ||
}, | ||
"ja": { | ||
"hello": "こんにちは!", | ||
}, | ||
}, | ||
{ | ||
"foo": "foo", | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ['@babel/preset-env'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template> | ||
<p>basic custom block</p> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'Basic' | ||
} | ||
</script> | ||
|
||
<custom> | ||
{ | ||
"en": { | ||
"hello": "Hello!" | ||
}, | ||
"ja": { | ||
"hello": "こんにちは!" | ||
} | ||
} | ||
</custom> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<p>multiple custom block</p> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'Multiple' | ||
} | ||
</script> | ||
|
||
<custom> | ||
{ | ||
"en": { | ||
"hello": "Hello!" | ||
}, | ||
"ja": { | ||
"hello": "こんにちは!" | ||
} | ||
} | ||
</custom> | ||
|
||
<custom> | ||
{ | ||
"foo": "foo" | ||
} | ||
</custom> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "vue2-custom-block", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"private": true, | ||
"scripts": { | ||
"test": "jest --no-cache --coverage test.js" | ||
}, | ||
"dependencies": { | ||
"vue": "^2.7.7", | ||
"vue-template-compiler": "^2.7.7" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "^7.9.0", | ||
"@vue/vue2-jest": "^29.0.0", | ||
"jest": "29.x", | ||
"jest-environment-jsdom": "29.x" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"vue" | ||
], | ||
"transform": { | ||
"^.+\\.js$": "babel-jest", | ||
"^.+\\.vue$": "@vue/vue2-jest" | ||
}, | ||
"moduleNameMapper": { | ||
"^~?__styles/(.*)$": "<rootDir>/components/styles/$1" | ||
}, | ||
"globals": { | ||
"vue-jest": { | ||
"transform": { | ||
"custom": "./transformer.js" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Basic from './components/Basic.vue' | ||
import Multiple from './components/Multiple.vue' | ||
|
||
test('Basic', () => { | ||
expect(Basic.__custom).toMatchObject([ | ||
{ | ||
en: { | ||
hello: 'Hello!' | ||
}, | ||
ja: { | ||
hello: 'こんにちは!' | ||
} | ||
} | ||
]) | ||
expect(Basic.__custom).toMatchSnapshot() | ||
}) | ||
|
||
test('Multiple blocks', () => { | ||
expect(Multiple.__custom).toMatchObject([ | ||
{ | ||
en: { | ||
hello: 'Hello!' | ||
}, | ||
ja: { | ||
hello: 'こんにちは!' | ||
} | ||
}, | ||
{ | ||
foo: 'foo' | ||
} | ||
]) | ||
expect(Multiple.__custom).toMatchSnapshot() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function convert(content) { | ||
return JSON.stringify(JSON.parse(content)) | ||
.replace(/\u2028/g, '\\u2028') // LINE SEPARATOR | ||
.replace(/\u2029/g, '\\u2029') // PARAGRAPH SEPARATOR | ||
.replace(/\\/g, '\\\\') | ||
.replace(/'/g, "\\'") | ||
} | ||
|
||
module.exports = { | ||
process({ blocks, vueOptionsNamespace, filename, config }) { | ||
const ret = blocks.reduce((codes, block) => { | ||
codes.push( | ||
`${vueOptionsNamespace}.__custom = ${vueOptionsNamespace}.__custom || [];${vueOptionsNamespace}.__custom.push(${convert( | ||
block.content | ||
)});` | ||
) | ||
return codes | ||
}, []) | ||
return ret.join('') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stumbled across this.. and removed it as well. No
this
in<template>
!