update periscopic (#6471)

pull/6473/head
Tan Li Hau 3 years ago committed by GitHub
parent 7eebe6e7d0
commit 98ddf8b588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

33
package-lock.json generated

@ -956,6 +956,24 @@
"is-reference": "^1.1.4",
"periscopic": "^2.0.1",
"sourcemap-codec": "^1.4.6"
},
"dependencies": {
"estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
},
"periscopic": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/periscopic/-/periscopic-2.0.3.tgz",
"integrity": "sha512-FuCZe61mWxQOJAQFEfmt9FjzebRlcpFz8sFPbyaCKtdusPkMEbA9ey0eARnRav5zAhmXznhaQkKGFAPn7X9NUw==",
"dev": true,
"requires": {
"estree-walker": "^2.0.2",
"is-reference": "^1.1.4"
}
}
}
},
"codecov": {
@ -3440,12 +3458,21 @@
"dev": true
},
"periscopic": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/periscopic/-/periscopic-2.0.1.tgz",
"integrity": "sha512-twJ8e4RatllMAcbmBqKj8cvZ94HtqSzbb8hJoGj4iSCcCHXxKb06HRxOq4heyq2x/6mKynJDvTTreHCz+m6lJw==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/periscopic/-/periscopic-2.0.3.tgz",
"integrity": "sha512-FuCZe61mWxQOJAQFEfmt9FjzebRlcpFz8sFPbyaCKtdusPkMEbA9ey0eARnRav5zAhmXznhaQkKGFAPn7X9NUw==",
"dev": true,
"requires": {
"estree-walker": "^2.0.2",
"is-reference": "^1.1.4"
},
"dependencies": {
"estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
}
}
},
"picomatch": {

@ -127,7 +127,7 @@
"locate-character": "^2.0.5",
"magic-string": "^0.25.3",
"mocha": "^7.0.0",
"periscopic": "^2.0.1",
"periscopic": "^2.0.3",
"puppeteer": "^2.1.1",
"rollup": "^1.27.14",
"source-map": "^0.7.3",

@ -10,6 +10,7 @@ import {
Scope,
extract_identifiers
} from './utils/scope';
import { Node as PeriscopicNode } from 'periscopic';
import Stylesheet from './css/Stylesheet';
import { test } from '../config';
import Fragment from './nodes/Fragment';
@ -829,7 +830,7 @@ export default class Component {
if (node.type === 'AssignmentExpression' || node.type === 'UpdateExpression') {
const assignee = node.type === 'AssignmentExpression' ? node.left : node.argument;
const names = extract_names(assignee);
const names = extract_names(assignee as PeriscopicNode);
const deep = assignee.type === 'MemberExpression';

@ -17,6 +17,7 @@ import replace_object from '../../utils/replace_object';
import is_contextual from './is_contextual';
import EachBlock from '../EachBlock';
import { clone } from '../../../utils/clone';
import { Node as PeriscopicNode } from 'periscopic';
type Owner = INode;
@ -356,7 +357,7 @@ export default class Expression {
// (a or b). In destructuring cases (`[d, e] = [e, d]`) there
// may be more, in which case we need to tack the extra ones
// onto the initial function call
const names = new Set(extract_names(assignee));
const names = new Set(extract_names(assignee as PeriscopicNode));
const traced: Set<string> = new Set();
names.forEach(name => {

@ -9,6 +9,7 @@ import Block from './Block';
import { ClassDeclaration, FunctionExpression, Node, Statement, ObjectExpression, Expression } from 'estree';
import { apply_preprocessor_sourcemap } from '../../utils/mapped_code';
import { RawSourceMap, DecodedSourceMap } from '@ampproject/remapping/dist/types/types';
import { Node as PeriscopicNode } from 'periscopic';
export default function dom(
component: Component,
@ -252,7 +253,7 @@ export default function dom(
// (a or b). In destructuring cases (`[d, e] = [e, d]`) there
// may be more, in which case we need to tack the extra ones
// onto the initial function call
const names = new Set(extract_names(assignee));
const names = new Set(extract_names(assignee as PeriscopicNode));
this.replace(invalidate(renderer, scope, node, names, execution_context === null));
}

@ -6,8 +6,9 @@ import Renderer from './Renderer';
import { INode as TemplateNode } from '../nodes/interfaces'; // TODO
import Text from '../nodes/Text';
import { LabeledStatement, Statement, Node } from 'estree';
import { Node as PeriscopicNode , extract_names } from 'periscopic';
import { walk } from 'estree-walker';
import { extract_names } from 'periscopic';
import { invalidate } from '../render_dom/invalidate';
export default function ssr(
@ -89,7 +90,7 @@ export default function ssr(
if (node.type === 'AssignmentExpression' || node.type === 'UpdateExpression') {
const assignee = node.type === 'AssignmentExpression' ? node.left : node.argument;
const names = new Set(extract_names(assignee));
const names = new Set(extract_names(assignee as PeriscopicNode));
const to_invalidate = new Set<string>();
for (const name of names) {

@ -1,8 +1,8 @@
import { Node } from 'estree';
import { analyze, Scope, extract_names, extract_identifiers } from 'periscopic';
import { Node as PeriscopicNode, analyze, Scope, extract_names, extract_identifiers } from 'periscopic';
export function create_scopes(expression: Node) {
return analyze(expression);
return analyze(expression as PeriscopicNode);
}
export { Scope, extract_names, extract_identifiers };

@ -0,0 +1,15 @@
[{
"code": "default-export",
"message": "A component cannot have a default export",
"pos": 10,
"start": {
"line": 2,
"column": 1,
"character": 10
},
"end": {
"line": 2,
"column": 30,
"character": 39
}
}]

@ -0,0 +1,3 @@
<script>
export default function () {};
</script>

@ -0,0 +1,15 @@
[{
"code": "default-export",
"message": "A component cannot have a default export",
"pos": 10,
"start": {
"line": 2,
"column": 1,
"character": 10
},
"end": {
"line": 2,
"column": 24,
"character": 33
}
}]

@ -0,0 +1,3 @@
<script>
export default class {};
</script>
Loading…
Cancel
Save