pinstripe 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component.js +1 -22
- package/lib/components/{pinstripe_anchor.js → anchor.js} +5 -3
- package/lib/components/{pinstripe_body.js → body.js} +4 -2
- package/lib/components/{pinstripe_document.js → document.js} +4 -2
- package/lib/components/{pinstripe_form.js → form.js} +4 -2
- package/lib/components/{pinstripe_frame.js → frame.js} +4 -2
- package/lib/components/index.js +9 -0
- package/lib/components/{pinstripe_markdown_editor.js → markdown_editor.js} +2 -2
- package/lib/components/{pinstripe_overlay.js → overlay.js} +4 -2
- package/lib/components/{pinstripe_progress_bar.js → progress_bar.js} +4 -2
- package/lib/index.js +1 -11
- package/package.json +7 -31
- package/cli.js +0 -46
- package/lib/class.js +0 -64
- package/lib/client.js +0 -21
- package/lib/command.js +0 -39
- package/lib/commands/_file_importer.js +0 -1
- package/lib/commands/drop_database.js +0 -6
- package/lib/commands/generate_command.js +0 -39
- package/lib/commands/generate_component.js +0 -37
- package/lib/commands/generate_migration.js +0 -47
- package/lib/commands/generate_model.js +0 -43
- package/lib/commands/generate_project.js +0 -131
- package/lib/commands/generate_service.js +0 -32
- package/lib/commands/generate_static_site.js +0 -74
- package/lib/commands/generate_view.js +0 -44
- package/lib/commands/init_database.js +0 -9
- package/lib/commands/list_commands.js +0 -15
- package/lib/commands/list_components.js +0 -16
- package/lib/commands/list_migrations.js +0 -15
- package/lib/commands/list_models.js +0 -15
- package/lib/commands/list_services.js +0 -15
- package/lib/commands/list_views.js +0 -16
- package/lib/commands/migrate_database.js +0 -6
- package/lib/commands/purge_old_sessions.js +0 -12
- package/lib/commands/reset_database.js +0 -9
- package/lib/commands/seed_database.js +0 -6
- package/lib/commands/show_config.js +0 -6
- package/lib/commands/start_repl.js +0 -6
- package/lib/commands/start_server.js +0 -9
- package/lib/components/_file_importer.js +0 -1
- package/lib/constants.js +0 -22
- package/lib/context.js +0 -40
- package/lib/database/client.js +0 -199
- package/lib/database/column_reference.js +0 -13
- package/lib/database/constants.js +0 -87
- package/lib/database/index.js +0 -7
- package/lib/database/migration.js +0 -30
- package/lib/database/migrator.js +0 -28
- package/lib/database/row.js +0 -383
- package/lib/database/singleton.js +0 -12
- package/lib/database/table.js +0 -514
- package/lib/database/table_reference.js +0 -33
- package/lib/database/union.js +0 -128
- package/lib/database.js +0 -135
- package/lib/defer.js +0 -35
- package/lib/defer.test.js +0 -37
- package/lib/extensions/_file_importer.js +0 -2
- package/lib/extensions/multi-app/index.js +0 -4
- package/lib/extensions/multi-app/views/_file_importer.js +0 -2
- package/lib/extensions/multi-app/views/apps/default.js +0 -6
- package/lib/extensions/multi-app/views/apps/guard.js +0 -7
- package/lib/extensions/multi-app/views/guard.js +0 -21
- package/lib/extensions/multi-tenant/database/row.js +0 -27
- package/lib/extensions/multi-tenant/database/table.js +0 -30
- package/lib/extensions/multi-tenant/database.js +0 -8
- package/lib/extensions/multi-tenant/index.js +0 -4
- package/lib/extensions/multi-tenant/migrations/1627976174_create_tenant_table_and_add_tenant_id_to_existing_tables.js +0 -20
- package/lib/extensions/multi-tenant/migrations/_file_importer.js +0 -2
- package/lib/extensions/multi-tenant/services/_file_importer.js +0 -2
- package/lib/extensions/multi-tenant/services/database.js +0 -32
- package/lib/html.js +0 -73
- package/lib/import_all.js +0 -81
- package/lib/inflector.js +0 -173
- package/lib/migrations/1627976184_create_user.js +0 -13
- package/lib/migrations/1628057822_create_session.js +0 -10
- package/lib/migrations/_file_importer.js +0 -1
- package/lib/model.js +0 -110
- package/lib/models/_file_importer.js +0 -1
- package/lib/models/session.js +0 -9
- package/lib/models/user.js +0 -53
- package/lib/project.js +0 -71
- package/lib/registry.js +0 -133
- package/lib/service_consumer.js +0 -16
- package/lib/service_factory.js +0 -20
- package/lib/services/_file_importer.js +0 -1
- package/lib/services/args.js +0 -9
- package/lib/services/bot.js +0 -69
- package/lib/services/cli_utils.js +0 -77
- package/lib/services/client_builder.js +0 -68
- package/lib/services/config.js +0 -63
- package/lib/services/cookies.js +0 -19
- package/lib/services/create_model.js +0 -8
- package/lib/services/database.js +0 -14
- package/lib/services/defer.js +0 -8
- package/lib/services/fetch.js +0 -116
- package/lib/services/format_date.js +0 -8
- package/lib/services/fs_builder.js +0 -132
- package/lib/services/inflector.js +0 -8
- package/lib/services/initial_params.js +0 -13
- package/lib/services/params.js +0 -13
- package/lib/services/parse_html.js +0 -8
- package/lib/services/project.js +0 -8
- package/lib/services/render_form.js +0 -161
- package/lib/services/render_html.js +0 -8
- package/lib/services/render_markdown.js +0 -44
- package/lib/services/render_view.js +0 -8
- package/lib/services/repl.js +0 -54
- package/lib/services/run_command.js +0 -8
- package/lib/services/send_mail.js +0 -46
- package/lib/services/server.js +0 -90
- package/lib/services/session.js +0 -19
- package/lib/services/view_names.js +0 -8
- package/lib/singleton.js +0 -13
- package/lib/string_reader.js +0 -22
- package/lib/trapify.js +0 -32
- package/lib/unescape_html.js +0 -21
- package/lib/unescape_html.test.js +0 -9
- package/lib/validation_error.js +0 -7
- package/lib/view.js +0 -45
- package/lib/view_file_importers/ejs.js +0 -82
- package/lib/view_file_importers/md.js +0 -42
- package/lib/views/_file_importer.js +0 -1
- package/lib/views/assets/javascripts/all.js.js +0 -7
- package/lib/views/assets/javascripts/all.js.map.js +0 -7
- package/lib/views/assets/stylesheets/all.css.js +0 -28
- package/lib/views/assets/stylesheets/components/button.css +0 -43
- package/lib/views/assets/stylesheets/components/card.css +0 -29
- package/lib/views/assets/stylesheets/components/form.css +0 -4
- package/lib/views/assets/stylesheets/components/frame.css +0 -3
- package/lib/views/assets/stylesheets/components/input.css +0 -40
- package/lib/views/assets/stylesheets/components/label.css +0 -9
- package/lib/views/assets/stylesheets/components/modal.css +0 -62
- package/lib/views/assets/stylesheets/components/overlay.css +0 -11
- package/lib/views/assets/stylesheets/components/pagination.css +0 -60
- package/lib/views/assets/stylesheets/components/progress_bar.css +0 -20
- package/lib/views/assets/stylesheets/components/textarea.css +0 -10
- package/lib/views/assets/stylesheets/global.css +0 -120
- package/lib/views/assets/stylesheets/reset.css +0 -74
- package/lib/views/assets/stylesheets/vars.css +0 -25
- package/lib/views/sign_in/index.js +0 -32
- package/lib/views/sign_in/verify_password.js +0 -52
- package/lib/views/sign_out.js +0 -16
- package/lib/virtual_node.js +0 -172
- package/lib/virtual_node.test.js +0 -25
- package/lib/workspace.js +0 -21
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { spawnSync } from 'child_process';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
async run(){
|
|
6
|
-
|
|
7
|
-
const { extractArg, extractOptions } = this.cliUtils;
|
|
8
|
-
const name = extractArg('');
|
|
9
|
-
if(name == ''){
|
|
10
|
-
console.error('A project name must be given.');
|
|
11
|
-
process.exit();
|
|
12
|
-
}
|
|
13
|
-
const { with: dependencies } = extractOptions({
|
|
14
|
-
with: []
|
|
15
|
-
});
|
|
16
|
-
if(!dependencies.includes('pinstripe')){
|
|
17
|
-
dependencies.unshift('pinstripe')
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const { generateDir, generateFile, line, indent, echo } = this.fsBuilder;
|
|
21
|
-
|
|
22
|
-
await generateDir(name, async () => {
|
|
23
|
-
|
|
24
|
-
await generateFile(`package.json`, () => {
|
|
25
|
-
echo(JSON.stringify({
|
|
26
|
-
type: "module",
|
|
27
|
-
name,
|
|
28
|
-
version: "0.0.0",
|
|
29
|
-
license: "MIT",
|
|
30
|
-
exports: {
|
|
31
|
-
".": "./lib/index.js"
|
|
32
|
-
},
|
|
33
|
-
}, null, 2));
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
await generateFile(`pinstripe.config.js`, () => {
|
|
37
|
-
line();
|
|
38
|
-
line(`const environment = process.env.NODE_ENV || 'development';`);
|
|
39
|
-
line();
|
|
40
|
-
line(`let database;`);
|
|
41
|
-
line(`if(environment == 'production'){`)
|
|
42
|
-
indent(() => {
|
|
43
|
-
line(`database = {`);
|
|
44
|
-
indent(() => {
|
|
45
|
-
line(`adapter: 'mysql',`)
|
|
46
|
-
line(`host: 'localhost',`);
|
|
47
|
-
line(`user: 'root',`);
|
|
48
|
-
line(`password: '',`);
|
|
49
|
-
line(`database: \`${this.inflector.snakeify(name)}_\${environment}\``);
|
|
50
|
-
});
|
|
51
|
-
line(`};`);
|
|
52
|
-
});
|
|
53
|
-
line(`} else {`);
|
|
54
|
-
indent(() => {
|
|
55
|
-
line(`database = {`);
|
|
56
|
-
indent(() => {
|
|
57
|
-
line(`adapter: 'sqlite',`);
|
|
58
|
-
line(`filename: \`\${environment}.db\``)
|
|
59
|
-
});
|
|
60
|
-
line(`};`);
|
|
61
|
-
});
|
|
62
|
-
line(`}`);
|
|
63
|
-
line();
|
|
64
|
-
line(`let mail;`);
|
|
65
|
-
line(`if(environment == 'production'){`)
|
|
66
|
-
indent(() => {
|
|
67
|
-
line(`mail = {`);
|
|
68
|
-
indent(() => {
|
|
69
|
-
line(`adapter: 'smtp',`)
|
|
70
|
-
line(`host: "smtp.example.com",`)
|
|
71
|
-
line(`port: 465,`);
|
|
72
|
-
line(`secure: true, // use TLS`);
|
|
73
|
-
line(`auth: {`);
|
|
74
|
-
indent(() => {
|
|
75
|
-
line(`user: "username",`);
|
|
76
|
-
line(`pass: "password",`);
|
|
77
|
-
});
|
|
78
|
-
line(`}`);
|
|
79
|
-
});
|
|
80
|
-
line(`};`);
|
|
81
|
-
});
|
|
82
|
-
line(`} else {`);
|
|
83
|
-
indent(() => {
|
|
84
|
-
line(`mail = {`);
|
|
85
|
-
indent(() => {
|
|
86
|
-
line(`adapter: 'dummy'`);
|
|
87
|
-
});
|
|
88
|
-
line(`};`);
|
|
89
|
-
});
|
|
90
|
-
line(`}`);
|
|
91
|
-
line();
|
|
92
|
-
line(`export default {`);
|
|
93
|
-
indent(() => {
|
|
94
|
-
line(`database,`);
|
|
95
|
-
line(`mail`);
|
|
96
|
-
})
|
|
97
|
-
line(`};`);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
await generateFile(`lib/index.js`, () => {
|
|
101
|
-
line();
|
|
102
|
-
line(`import { importAll } from 'pinstripe';`);
|
|
103
|
-
dependencies.forEach((dependency) => {
|
|
104
|
-
if(dependency != 'pinstripe') line(`import '${dependency}';`);
|
|
105
|
-
});
|
|
106
|
-
line();
|
|
107
|
-
line(`importAll(import.meta.url);`);
|
|
108
|
-
line();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
await generateFile(`README.md`, () => {
|
|
112
|
-
line();
|
|
113
|
-
line(`# ${name}`);
|
|
114
|
-
line();
|
|
115
|
-
line('## Getting started');
|
|
116
|
-
line();
|
|
117
|
-
line('```bash');
|
|
118
|
-
indent(() => {
|
|
119
|
-
line('pinstripe init-database');
|
|
120
|
-
line('pinstripe start-server');
|
|
121
|
-
});
|
|
122
|
-
line('```');
|
|
123
|
-
line();
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
spawnSync('yarn', [ 'add', ...dependencies ], {
|
|
127
|
-
stdio: 'inherit'
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export default {
|
|
3
|
-
async run(){
|
|
4
|
-
const [ name = '' ] = this.args;
|
|
5
|
-
if(name == ''){
|
|
6
|
-
console.error('A service name must be given.');
|
|
7
|
-
process.exit();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const { inProjectRootDir, generateFile, line, indent } = this.fsBuilder;
|
|
11
|
-
|
|
12
|
-
await inProjectRootDir(async () => {
|
|
13
|
-
|
|
14
|
-
await generateFile(`lib/services/_file_importer.js`, { skipIfExists: true }, () => {
|
|
15
|
-
line();
|
|
16
|
-
line(`export { ServiceFactory as default } from 'pinstripe';`);
|
|
17
|
-
line();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
await generateFile(`lib/services/${this.inflector.snakeify(name)}.js`, () => {
|
|
21
|
-
line();
|
|
22
|
-
line(`export default () => {`);
|
|
23
|
-
indent(() => {
|
|
24
|
-
line(`return 'Example ${this.inflector.camelize(name)} service'`);
|
|
25
|
-
});
|
|
26
|
-
line('};');
|
|
27
|
-
line();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { default as mimeTypes } from 'mime-types';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
async run(){
|
|
6
|
-
this.pages = {};
|
|
7
|
-
const urls = this.viewNames.filter(path => !path.match(/(^|\/)_/)).map(path => {
|
|
8
|
-
return new URL(path, 'http://127.0.0.1/');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
while(urls.length){
|
|
12
|
-
await this.crawlPage({ _url: urls.shift() });
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const pages = Object.values(this.pages).filter(page => page.status == 200 && Object.keys(page.params).length == 1);
|
|
16
|
-
const { inProjectRootDir, generateDir, generateFile, echo } = this.fsBuilder;
|
|
17
|
-
|
|
18
|
-
await inProjectRootDir(async () => {
|
|
19
|
-
await generateDir('build/static', async () => {
|
|
20
|
-
while(pages.length){
|
|
21
|
-
const { params, headers } = pages.shift();
|
|
22
|
-
const contentType = headers['content-type'];
|
|
23
|
-
|
|
24
|
-
const path = params._url.pathname;
|
|
25
|
-
let filePath = path.replace(/^\//, '');
|
|
26
|
-
if(filePath.match(/(^|\/)$/)){
|
|
27
|
-
filePath = `${filePath}index`;
|
|
28
|
-
}
|
|
29
|
-
if(!filePath.match(/[^/]+\.[^/]+$/)){
|
|
30
|
-
filePath = `${filePath}.${mimeTypes.extension(contentType)}`
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const data = (await this.fetch({ _url: new URL(path, 'http://127.0.0.1/') }))[2];
|
|
34
|
-
|
|
35
|
-
await generateFile(filePath, () => {
|
|
36
|
-
echo(data.join(''));
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
async crawlPage(params){
|
|
44
|
-
const hash = JSON.stringify(params);
|
|
45
|
-
if(this.pages[hash]) return;
|
|
46
|
-
const page = { params };
|
|
47
|
-
this.pages[hash] = page;
|
|
48
|
-
const [ status, headers, data ] = await this.fetch(params);
|
|
49
|
-
page.status = status;
|
|
50
|
-
page.headers = headers;
|
|
51
|
-
if(status != 200 || headers['content-type'] != 'text/html') return;
|
|
52
|
-
const html = data.join('');
|
|
53
|
-
const virtualDom = this.parseHtml(html);
|
|
54
|
-
const urls = this.extractUrls(virtualDom);
|
|
55
|
-
while(urls.length){
|
|
56
|
-
const url = urls.shift();
|
|
57
|
-
await this.crawlPage({ ...url.params, _url: url });
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
extractUrls(virtualDom){
|
|
62
|
-
const out = [];
|
|
63
|
-
virtualDom.traverse(({ attributes }) => {
|
|
64
|
-
['src', 'href'].forEach(name => {
|
|
65
|
-
const value = attributes[name];
|
|
66
|
-
if(!value) return;
|
|
67
|
-
const url = new URL(value, 'http://127.0.0.1/');
|
|
68
|
-
if(url.host != '127.0.0.1') return;
|
|
69
|
-
out.push(url);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
return out;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export default {
|
|
3
|
-
async run(){
|
|
4
|
-
const [ name = '' ] = this.args;
|
|
5
|
-
let normalizedName = name.replace(/^\//, '');
|
|
6
|
-
if(name == ''){
|
|
7
|
-
console.error('A view name must be given.');
|
|
8
|
-
process.exit();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if(!normalizedName.match(/\.[^\/]+$/)){
|
|
12
|
-
normalizedName = `${normalizedName}.js`;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const { inProjectRootDir, generateFile, line, indent } = this.fsBuilder;
|
|
16
|
-
|
|
17
|
-
await inProjectRootDir(async () => {
|
|
18
|
-
|
|
19
|
-
await generateFile(`lib/views/_file_importer.js`, { skipIfExists: true }, () => {
|
|
20
|
-
line();
|
|
21
|
-
line(`export { View as default } from 'pinstripe';`);
|
|
22
|
-
line();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
await generateFile(`lib/views/${normalizedName}`, () => {
|
|
26
|
-
line();
|
|
27
|
-
line('export default {');
|
|
28
|
-
indent(() => {
|
|
29
|
-
line('render(){')
|
|
30
|
-
indent(() => {
|
|
31
|
-
line('return this.renderHtml`')
|
|
32
|
-
indent(() => {
|
|
33
|
-
line(`<h1>${normalizedName} view<h1></h1>`);
|
|
34
|
-
});
|
|
35
|
-
line('`;')
|
|
36
|
-
});
|
|
37
|
-
line('}')
|
|
38
|
-
});
|
|
39
|
-
line('};');
|
|
40
|
-
line();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { Command } from 'pinstripe';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
run(){
|
|
7
|
-
console.log('');
|
|
8
|
-
console.log('The following commands are available:');
|
|
9
|
-
console.log('');
|
|
10
|
-
Command.names.forEach(commandName => {
|
|
11
|
-
console.log(` * ${chalk.green(commandName)}`);
|
|
12
|
-
});
|
|
13
|
-
console.log('');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { Component } from 'pinstripe';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
run(){
|
|
7
|
-
console.log('');
|
|
8
|
-
console.log('The following components are available:');
|
|
9
|
-
console.log('');
|
|
10
|
-
Component.names.forEach(componentName => {
|
|
11
|
-
console.log(` * ${chalk.green(componentName)}`);
|
|
12
|
-
});
|
|
13
|
-
console.log('');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { Migration } from 'pinstripe/database';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
run(){
|
|
7
|
-
console.log('');
|
|
8
|
-
console.log('The following migrations are available:');
|
|
9
|
-
console.log('');
|
|
10
|
-
Migration.names.forEach(migrationName => {
|
|
11
|
-
console.log(` * ${chalk.green(migrationName)}`);
|
|
12
|
-
});
|
|
13
|
-
console.log('');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { Row } from 'pinstripe/database';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
run(){
|
|
7
|
-
console.log('');
|
|
8
|
-
console.log('The following models are available:');
|
|
9
|
-
console.log('');
|
|
10
|
-
Row.names.forEach(modelName => {
|
|
11
|
-
console.log(` * ${chalk.green(modelName)}`);
|
|
12
|
-
});
|
|
13
|
-
console.log('');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { ServiceFactory } from 'pinstripe';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
run(){
|
|
7
|
-
console.log('');
|
|
8
|
-
console.log('The following views are available:');
|
|
9
|
-
console.log('');
|
|
10
|
-
ServiceFactory.names.forEach(serviceFactoryName => {
|
|
11
|
-
console.log(` * ${chalk.green(serviceFactoryName)}`);
|
|
12
|
-
});
|
|
13
|
-
console.log('');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { View } from 'pinstripe';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
run(){
|
|
7
|
-
console.log('');
|
|
8
|
-
console.log('The following views are available:');
|
|
9
|
-
console.log('');
|
|
10
|
-
View.names.forEach(viewName => {
|
|
11
|
-
console.log(` * ${chalk.green(viewName)}`);
|
|
12
|
-
});
|
|
13
|
-
console.log('');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Component as default } from 'pinstripe'
|
package/lib/constants.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export const SELF_CLOSING_TAGS = [
|
|
3
|
-
'area',
|
|
4
|
-
'base',
|
|
5
|
-
'br',
|
|
6
|
-
'embed',
|
|
7
|
-
'hr',
|
|
8
|
-
'iframe',
|
|
9
|
-
'img',
|
|
10
|
-
'input',
|
|
11
|
-
'link',
|
|
12
|
-
'meta',
|
|
13
|
-
'param',
|
|
14
|
-
'slot',
|
|
15
|
-
'source',
|
|
16
|
-
'track'
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export const TEXT_ONLY_TAGS = [
|
|
20
|
-
'script',
|
|
21
|
-
'style'
|
|
22
|
-
];
|
package/lib/context.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Class } from './class.js';
|
|
3
|
-
|
|
4
|
-
export const Context = Class.extend().include({
|
|
5
|
-
meta(){
|
|
6
|
-
this.assignProps({ name: 'context' });
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
initialize(){
|
|
10
|
-
this.assignProps({ root: this });
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
async run(fn){
|
|
14
|
-
let out;
|
|
15
|
-
try {
|
|
16
|
-
out = await fn(this);
|
|
17
|
-
} catch (e){
|
|
18
|
-
await this.destroy();
|
|
19
|
-
throw e;
|
|
20
|
-
}
|
|
21
|
-
await this.destroy();
|
|
22
|
-
return out;
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
fork(){
|
|
26
|
-
const out = this.constructor.new();
|
|
27
|
-
out.assignProps({ parent: this, root: this?.root });
|
|
28
|
-
return out;
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
async destroy(){
|
|
32
|
-
const resources = Object.values(this);
|
|
33
|
-
while(resources.length){
|
|
34
|
-
const resource = await resources.shift();
|
|
35
|
-
if(typeof resource == 'object' && !(resource instanceof Context) && typeof resource.destroy == 'function'){
|
|
36
|
-
await resource.destroy();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|