update folder structure - #2790

pull/2887/head
Richard Harris 6 years ago
parent b0b86f7e26
commit 5161dfb950

14
.gitignore vendored

@ -5,13 +5,13 @@ node_modules
*.map
/src/compile/internal-exports.ts
/compiler.*js
/index.*js
/internal.*js
/store.*js
/easing.*js
/motion.*js
/transition.*js
/animate.*js
/index
/internal
/store
/easing
/motion
/transition
/animate
/scratch/
/coverage/
/coverage.lcov/

1
animate.d.ts vendored

@ -1 +0,0 @@
export * from './types/animate';

1
easing.d.ts vendored

@ -1 +0,0 @@
export * from './types/easing';

1
index.d.ts vendored

@ -1 +0,0 @@
export * from './types/index';

@ -0,0 +1,16 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var internal = require('./internal');
exports.onMount = internal.onMount;
exports.onDestroy = internal.onDestroy;
exports.beforeUpdate = internal.beforeUpdate;
exports.afterUpdate = internal.afterUpdate;
exports.setContext = internal.setContext;
exports.getContext = internal.getContext;
exports.tick = internal.tick;
exports.createEventDispatcher = internal.createEventDispatcher;

@ -0,0 +1 @@
export { onMount, onDestroy, beforeUpdate, afterUpdate, setContext, getContext, tick, createEventDispatcher } from './internal';

1
internal.d.ts vendored

@ -1 +0,0 @@
export * from './types/internal';

1
motion.d.ts vendored

@ -1 +0,0 @@
export * from './types/motion';

@ -9,15 +9,16 @@
"compiler.js",
"register.js",
"index.*",
"internal.*",
"store.*",
"animate.*",
"transition.*",
"easing.*",
"motion.*",
"internal",
"store",
"animate",
"transition",
"easing",
"motion",
"svelte",
"README.md"
],
"types": "types/runtime",
"scripts": {
"test": "mocha --opts mocha.opts",
"test:unit": "mocha --require sucrase/register --recursive ./**/__test__.ts",
@ -30,8 +31,9 @@
"prepare": "npm run build && npm run tsd",
"dev": "rollup -cw",
"pretest": "npm run build",
"posttest": "agadoo internal.mjs",
"prepublishOnly": "export PUBLISH=true && npm test",
"posttest": "agadoo internal/index.mjs",
"prepublishOnly": "export PUBLISH=true && npm test && npm run create-stubs",
"create-stubs": "node scripts/create-stubs.js",
"tsd": "tsc -p . --emitDeclarationOnly",
"typecheck": "tsc -p . --noEmit"
},

@ -9,7 +9,7 @@ import pkg from './package.json';
const is_publish = !!process.env.PUBLISH;
const tsPlugin = is_publish
const ts_plugin = is_publish
? typescript({
include: 'src/**',
typescript: require('typescript')
@ -18,39 +18,12 @@ const tsPlugin = is_publish
transforms: ['typescript']
});
export default [
/* internal.[m]js */
{
input: `src/internal/index.ts`,
output: [
{
file: `internal.mjs`,
format: 'esm',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
},
{
file: `internal.js`,
format: 'cjs',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
}
],
external: id => id.startsWith('svelte/'),
plugins: [
tsPlugin,
{
generateBundle(options, bundle) {
const mod = bundle['internal.mjs'];
if (mod) {
fs.writeFileSync('src/compile/internal-exports.ts', `// This file is automatically generated\nexport default new Set(${JSON.stringify(mod.exports)});`);
}
}
}]
},
const external = id => id.startsWith('svelte/');
export default [
/* compiler.js */
{
input: 'src/compiler.ts',
input: 'src/compiler/index.ts',
plugins: [
replace({
__VERSION__: pkg.version
@ -60,7 +33,7 @@ export default [
include: ['node_modules/**']
}),
json(),
tsPlugin
ts_plugin
],
output: {
file: 'compiler.js',
@ -73,45 +46,42 @@ export default [
: id => id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree')
},
/* motion.mjs */
/* runtime */
{
input: `src/motion/index.ts`,
input: `src/runtime/index.ts`,
output: [
{
file: `motion.mjs`,
file: `index.mjs`,
format: 'esm',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}`
},
{
file: `motion.js`,
file: `index.js`,
format: 'cjs',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}`
}
],
plugins: [
tsPlugin
],
external: id => id.startsWith('svelte/')
external,
plugins: [ts_plugin]
},
// everything else
...['index', 'easing', 'transition', 'animate', 'store'].map(name => ({
input: `src/${name}.ts`,
output: [
{
file: `${name}.mjs`,
format: 'esm',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
},
{
file: `${name}.js`,
format: 'cjs',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
}
],
plugins: [
tsPlugin
],
external: id => id.startsWith('svelte/')
}))
...fs.readdirSync('src/runtime')
.filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory())
.map(dir => ({
input: `src/runtime/${dir}/index.ts`,
output: [
{
file: `${dir}/index.mjs`,
format: 'esm',
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '..')}`
},
{
file: `${dir}/index.js`,
format: 'cjs',
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '..')}`
}
],
external,
plugins: [ts_plugin]
}))
];

@ -0,0 +1,12 @@
const fs = require('fs');
fs.readdirSync('src/runtime')
.filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory())
.forEach(dir => {
fs.writeFileSync(`${dir}/package.json`, JSON.stringify({
main: './index.js',
module: './index.mjs'
}, null, ' '));
fs.writeFileSync(`${dir}/index.d.ts`, `export * from '../types/runtime/${dir}/index.d.ts';`);
});

@ -1,4 +1,4 @@
import { assign } from '../internal/index';
import { assign } from '../../runtime/internal/index';
import Stats from '../Stats';
import parse from '../parse/index';
import render_dom from './render-dom/index';

@ -0,0 +1,2 @@
// This file is automatically generated
export default new Set(["create_animation","fix_position","handle_promise","append","insert","detach","detach_between","detach_before","detach_after","destroy_each","element","object_without_properties","svg_element","text","space","empty","listen","prevent_default","stop_propagation","attr","set_attributes","set_custom_element_data","xlink_attr","get_binding_group_value","to_number","time_ranges_to_array","children","claim_element","claim_text","set_data","set_input_type","set_style","select_option","select_options","select_value","select_multiple_value","add_resize_listener","toggle_class","custom_event","destroy_block","outro_and_destroy_block","fix_and_outro_and_destroy_block","update_keyed_each","measure","current_component","set_current_component","beforeUpdate","onMount","afterUpdate","onDestroy","createEventDispatcher","setContext","getContext","bubble","clear_loops","loop","dirty_components","intros","schedule_update","tick","add_binding_callback","add_render_callback","add_flush_callback","flush","get_spread_update","invalid_attribute_name_character","spread","escaped","escape","each","missing_component","validate_component","debug","create_ssr_component","get_store_value","group_outros","check_outros","on_outro","create_in_transition","create_out_transition","create_bidirectional_transition","noop","identity","assign","is_promise","add_location","run","blank_object","run_all","is_function","safe_not_equal","not_equal","validate_store","subscribe","create_slot","get_slot_context","get_slot_changes","exclude_internal_props","now","raf","set_now","set_raf","bind","mount_component","init","SvelteElement","SvelteComponent","SvelteComponentDev"]);

@ -1,5 +1,5 @@
import Block from '../../render-dom/Block';
import Component from './../../Component';
import Component from '../../Component';
import Node from './Node';
import { INode } from '../interfaces';

@ -1,5 +1,5 @@
import Attribute from './../Attribute';
import Component from './../../Component';
import Attribute from '../Attribute';
import Component from '../../Component';
import { INode } from '../interfaces';
import Text from '../Text';

@ -1,5 +1,5 @@
import Binding from '../../../nodes/Binding';
import ElementWrapper from '.';
import ElementWrapper from '../Element';
import { dimensions } from '../../../../utils/patterns';
import get_object from '../../../utils/get_object';
import Block from '../../Block';

@ -1,7 +1,7 @@
import Attribute from '../../../nodes/Attribute';
import Block from '../../Block';
import AttributeWrapper from './Attribute';
import ElementWrapper from '.';
import ElementWrapper from '../Element';
import { stringify } from '../../../utils/stringify';
import add_to_set from '../../../utils/add_to_set';
import Expression from '../../../nodes/shared/Expression';

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save