forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparcel.ts
More file actions
65 lines (56 loc) · 1.71 KB
/
parcel.ts
File metadata and controls
65 lines (56 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { absolute } from '../utils/path';
import Template, { ParsedConfigurationFiles } from './template';
import { decorateSelector } from '../utils/decorate-selector';
import configurations from './configuration';
export class ParcelTemplate extends Template {
getEntries(configurationFiles: ParsedConfigurationFiles) {
const entries = [];
if (typeof document !== 'undefined' && document.location.pathname !== '/') {
// Push the location of the address bar, eg. when someone has a file
// /2.html open, you actually want to have that as entry point instead
// of index.html.
entries.push(document.location.pathname);
}
entries.push(
configurationFiles.package &&
configurationFiles.package.parsed &&
configurationFiles.package.parsed.main &&
absolute(configurationFiles.package.parsed.main)
);
entries.push('/index.html');
entries.push('/src/index.html');
return entries.filter(Boolean);
}
/**
* The file to open by the editor
*/
getDefaultOpenedFiles(configFiles) {
let entries = [];
entries.push('/index.js');
entries.push('/src/index.js');
entries.push('/index.ts');
entries.push('/src/index.ts');
entries = entries.concat(this.getEntries(configFiles));
return entries;
}
}
export default new ParcelTemplate(
'parcel',
'Vanilla',
'https://parceljs.org/',
'vanilla',
decorateSelector(() => '#dfb07a'),
{
showOnHomePage: true,
showCube: true,
extraConfigurations: {
'/.babelrc': configurations.babelrc,
'/tsconfig.json': configurations.tsconfig,
},
externalResourcesEnabled: false,
distDir: 'dist',
main: true,
isTypescript: true,
popular: true,
}
);