pull/4742/head
pushkine 5 years ago
parent 510ad4da3b
commit 28b160f2fc

@ -15,30 +15,28 @@ module.exports = {
'no-var': 2,
'no-unreachable': 2,
'valid-typeof': 2,
'quote-props': [2, 'as-needed'],
'quote-props': 'off',
'prefer-arrow-callback': 2,
'prefer-const': [2, { destructuring: 'all' }],
'arrow-spacing': 2,
'no-inner-declarations': 0,
'require-atomic-updates': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/prefer-interface': 'off',
},
globals: {
globalThis: false,
__VERSION__: true,
},
env: {
es6: true,

@ -82,9 +82,9 @@
"code-red": "0.1.1",
"codecov": "^3.6.5",
"css-tree": "1.0.0-alpha22",
"eslint": "^7.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-svelte3": "^2.7.3",
"eslint": "^7.0.0",
"esm": "^3.2.25",
"estree-walker": "^2.0.1",
"is-reference": "^1.1.4",
@ -96,8 +96,9 @@
"periscopic": "^2.0.1",
"puppeteer": "^3.0.4",
"rollup": "^2.10.2",
"source-map": "^0.7.3",
"source-map-support": "^0.5.19",
"source-map": "^0.7.3",
"tiny-glob": "^0.2.6",
"ts-mocha": "^7.0.0",
"tslib": "^2.0.0",
"typescript": "^3.9.2"

@ -1 +1,2 @@
/* eslint-disable no-var */
declare var __VERSION__: string;

@ -454,7 +454,7 @@ export default class Block {
: fn;
}
render_listeners(chunk: string = '') {
render_listeners(chunk = '') {
if (this.event_listeners.length > 0) {
const dispose: Identifier = {
type: 'Identifier',

@ -10,7 +10,7 @@ export function invalidate(
scope: Scope,
node: Node,
names: Set<string>,
main_execution_context: boolean = false
main_execution_context = false
) {
const { component } = renderer;

@ -337,7 +337,7 @@ export default class InlineComponentWrapper extends Wrapper {
}
const params = [x`#value`];
let args = [];
const args = [];
contextual_dependencies.forEach((name) => {
params.push({ type: 'Identifier', name });
renderer.add_to_context(name, true);

@ -0,0 +1,5 @@
{
"rules": {
"import/no-unresolved": "off"
}
}

@ -12,7 +12,7 @@ export const is_cors =
}
})();
export const has_Symbol = typeof Symbol === 'function';
/* eslint-disable no-var */
declare var global: any;
export const globals = is_browser ? window : typeof globalThis !== 'undefined' ? globalThis : global;
export const resolved_promise = Promise.resolve();

@ -44,8 +44,8 @@ export function bind({ $$: { props, bound, ctx } }, name: string, callback: (pro
export function mount_component({ $$ }, target, anchor) {
if ($$.fragment) $$.fragment.m(target, anchor);
add_render_callback(() => {
let { on_mount, on_destroy, after_update } = $$,
i = 0,
const { on_mount, on_destroy, after_update } = $$;
let i = 0,
res;
for (; i < on_mount.length; i++)
if ('function' === typeof (res = on_mount[i]()))

@ -184,7 +184,9 @@ export function set_input_value(input, value) {
export function set_input_type(input, type) {
try {
input.type = type;
} catch (e) {}
} catch (e) {
//
}
}
export function set_style(node, property, value, is_important?) {

@ -155,13 +155,13 @@ const parseStructure = <T>(
): initCreateMotionTick<T> | initCreateTweenTick<T> => {
const isArray = Array.isArray(obj);
if (typeof obj === 'object' && obj !== null && (isArray || Object.prototype === Object.getPrototypeOf(obj))) {
const keys = Object.keys(obj);
let i = 0,
l = keys.length,
k = '',
createTickers = keys.map((key) => parseStructure(obj[key], schema)((next_value) => (obj[key] = next_value))),
tickers = new Array(l),
pending = 0;
const keys = Object.keys(obj),
l = keys.length,
createTickers = keys.map((key) => parseStructure(obj[key], schema)((next_value) => (obj[key] = next_value))),
tickers = new Array(l);
const target = { ...obj };
obj = isArray ? [...(obj as T[])] : { ...obj };
return (set) => (_, to_value) => {

@ -1,5 +1,7 @@
{
"rules": {
"no-console": "off"
}
"rules": {
"no-console": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-namespace": "off"
}
}

@ -51,13 +51,11 @@ describe('hydration', () => {
try {
global.window = window;
let SvelteComponent;
try {
SvelteComponent = require(`${cwd}/main.svelte`).default;
} catch (err) {
throw err;
}
// try {
const SvelteComponent = require(`${cwd}/main.svelte`).default;
// } catch (err) {
// throw err;
// }
const target = window.document.body;
const head = window.document.head;
@ -68,7 +66,9 @@ describe('hydration', () => {
try {
before_head = fs.readFileSync(`${cwd}/_before_head.html`, 'utf-8');
head.innerHTML = before_head;
} catch (err) {}
} catch (_err) {
//
}
const snapshot = config.snapshot ? config.snapshot(target) : {};

@ -1,8 +0,0 @@
type Test = {
test({ assert, component, mod, target, window, raf, compileOptions }): void | Promise<void>;
html: string;
skip: boolean;
};
declare module 'samples/*/_config.js' {
export default Test;
}

@ -4,7 +4,6 @@ import { rollup } from 'rollup';
import virtual from '@rollup/plugin-virtual';
import { clear_loops, flush, SvelteComponent } from '../../internal';
import { set_now, set_raf, set_framerate } from '../../environment';
import './ambient';
import { showOutput, loadConfig, loadSvelte, cleanRequireCache, env, setupHtmlEqual, mkdirp } from '../helpers';
import { glob } from '../tiny-glob';
import { assert } from '../test';

@ -1,8 +1,7 @@
import './ambient';
import * as assert$1 from 'assert';
import { readFileSync } from 'fs';
export const assert = (assert$1 as unknown) as typeof assert$1 & { htmlEqual: (actual, expected, message?) => void };
const { glob } = require('./tiny-glob.ts');
import { glob } from './tiny-glob';
// require('./setup.ts');

@ -14,17 +14,17 @@ const GLOBSTAR = `((?:[^/]*(?:/|$))*)`;
const WILDCARD = `([^/]*)`;
const GLOBSTAR_SEGMENT = `((?:[^${SEP_ESC}]*(?:${SEP_ESC}|$))*)`;
const WILDCARD_SEGMENT = `([^${SEP_ESC}]*)`;
const isHidden = /(^|[\\\/])\.[^\\\/\.]/g;
const isHidden = /(^|[\\/])\.[^\\/.]/g;
let CACHE = {};
function isglob(str, { strict = true } = {}) {
if (str === '') return false;
let match,
rgx = strict ? STRICT : RELAXED;
let match;
const rgx = strict ? STRICT : RELAXED;
while ((match = rgx.exec(str))) {
if (match[2]) return true;
let idx = match.index + match[0].length;
let open = match[1];
let close = open ? CHARS[open] : null;
const open = match[1];
const close = open ? CHARS[open] : null;
let n;
if (open && close) if ((n = str.indexOf(close, idx)) !== -1) idx = n + 1;
str = str.slice(idx);
@ -33,15 +33,15 @@ function isglob(str, { strict = true } = {}) {
}
function parent(str, { strict = false } = {}) {
str = normalize(str).replace(/\/|\\/, '/');
if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/';
if (/[{[].*[/]*.*[}]]$/.test(str)) str += '/';
str += 'a';
do str = dirname(str);
while (isglob(str, { strict }) || /(^|[^\\])([\{\[]|\([^\)]+$)/.test(str));
return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
while (isglob(str, { strict }) || /(^|[^\\])([{[]|\([^)]+$)/.test(str));
return str.replace(/\\([*?|[\](){}])/g, '$1');
}
function globalyzer(pattern, opts = {}) {
let base = parent(pattern, opts);
let isGlob = isglob(pattern, opts);
const isGlob = isglob(pattern, opts);
let glob;
if (base != '.') {
if ((glob = pattern.substr(base.length)).startsWith('/')) glob = glob.substr(1);
@ -54,7 +54,7 @@ function globalyzer(pattern, opts = {}) {
function globrex(glob, { extended = false, globstar = false, strict = false, filepath = false, flags = '' } = {}) {
let regex = '';
let segment = '';
let path = {
const path = {
regex: '',
segments: [],
globstar: undefined,
@ -101,7 +101,7 @@ function globrex(glob, { extended = false, globstar = false, strict = false, fil
case ')': {
if (ext.length) {
add(c);
let type = ext.pop();
const type = ext.pop();
if (type === '@') {
add('{1}');
} else if (type === '!') {
@ -177,16 +177,16 @@ function globrex(glob, { extended = false, globstar = false, strict = false, fil
ext.push(c);
break;
}
let prevChar = glob[i - 1];
const prevChar = glob[i - 1];
let starCount = 1;
while (glob[i + 1] === '*') {
starCount++;
i++;
}
let nextChar = glob[i + 1];
const nextChar = glob[i + 1];
if (!globstar) add('.*');
else {
let isGlobstar =
const isGlobstar =
starCount > 1 && (prevChar === '/' || prevChar === void 0) && (nextChar === '/' || nextChar === void 0);
if (isGlobstar) {
add(GLOBSTAR, { only: 'regex' });
@ -225,8 +225,9 @@ function walk(output, prefix, lexer, filesOnly, dot, cwd, dirname = '', level =
const dir = join(cwd, prefix, dirname);
const files = readdirSync(dir);
let i = 0,
len = files.length,
file;
const len = files.length;
let fullpath, relpath, stats, isMatch;
for (; i < len; i++) {
fullpath = join(dir, (file = files[i]));
@ -245,11 +246,11 @@ function walk(output, prefix, lexer, filesOnly, dot, cwd, dirname = '', level =
}
export function glob(str: string, { cwd = '.', absolute = false, filesOnly = false, dot = false, flush = false }) {
if (!str) return [];
let glob = globalyzer(str);
const glob = globalyzer(str);
if (!glob.isGlob) {
try {
let resolved = resolve(cwd, str);
let dirent = statSync(resolved);
const resolved = resolve(cwd, str);
const dirent = statSync(resolved);
if (filesOnly && !dirent.isFile()) return [];
return absolute ? [resolved] : [str];
@ -260,7 +261,7 @@ export function glob(str: string, { cwd = '.', absolute = false, filesOnly = fal
}
}
if (flush) CACHE = {};
let matches = [];
const matches = [];
const { path } = globrex(glob.glob, { filepath: true, globstar: true, extended: true });
//@ts-ignore
path.globstar = path.globstar.toString();

Loading…
Cancel
Save