forked from revolist/revogrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstencil.config.ts
160 lines (149 loc) · 4.36 KB
/
stencil.config.ts
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import { Config } from '@stencil/core';
import { sass } from '@stencil/sass';
import { angularOutputTarget } from '@stencil/angular-output-target';
import { reactOutputTarget } from '@stencil/react-output-target';
import { vueOutputTarget } from '@stencil/vue-output-target';
import { svelteOutputTarget } from '@revolist/svelte-output-target';
import { vueOutputTarget as vue2OutputTarget } from '@revolist/stencil-vue2-output-target';
import { eventListOutputTarget } from './scripts/event-list.plugin';
const componentCorePackage = '@revolist/revogrid';
const parent = './packages';
const entry = 'revogrid.ts';
const excludeComponents = [
'revogr-clipboard',
'revogr-data',
'revogr-edit',
'revogr-focus',
'revogr-header',
'revogr-order-editor',
'revogr-overlay-selection',
'revogr-row-headers',
'revogr-scroll-virtual',
'revogr-temp-range',
'revogr-viewport-scroll',
];
const directivesProxyFile = (name: string, filepath = entry) =>
`${parent}/${name}/lib/${filepath}`;
const angularPath = (name: string, filepath = entry) =>
`${parent}/angular/projects/${name}/src/lib/${filepath}`;
const customElementsDir = 'standalone';
export const config: Config = {
// https://github.com/ionic-team/stencil/blob/master/src/declarations/stencil-public-compiler.ts
enableCache: true,
hashFileNames: false,
autoprefixCss: false,
minifyCss: true,
preamble: 'Built by Revolist OU ❤️',
hashedFileNameLength: 8,
invisiblePrehydration: false,
extras: {
// This is to tackle an Angular specific performance issue:
initializeNextTick: true,
// Don’t need any of these so setting them to “false”:
scriptDataOpts: false,
appendChildSlotFix: false,
cloneNodeFix: false,
slotChildNodesFix: false,
// Required by Vite to bundle a Stencil project (https://github.com/vitejs/vite/issues/12434#issuecomment-1471305880)
enableImportInjection: true,
},
namespace: 'revo-grid',
taskQueue: 'async',
globalScript: './src/global/global.ts',
validatePrimaryPackageOutputTarget: true,
plugins: [
sass({
injectGlobalPaths: [
'src/global/_colors.scss',
'src/global/_icons.scss',
'src/global/_mixins.scss',
'src/global/_buttons.scss',
],
}),
],
// proxies
outputTargets: [
// #region Vue
vue2OutputTarget({
componentCorePackage,
proxiesFile: directivesProxyFile('vue2'),
excludeComponents,
}),
vueOutputTarget({
componentCorePackage,
proxiesFile: directivesProxyFile('vue3'),
excludeComponents,
includePolyfills: true,
}),
// #endregion
// #region Angular
angularOutputTarget({
componentCorePackage,
outputType: 'standalone',
customElementsDir: customElementsDir,
directivesProxyFile: angularPath('angular-datagrid', `components.ts`),
directivesArrayFile: angularPath('angular-datagrid', entry),
excludeComponents,
}),
// #endregion
// #region React
reactOutputTarget({
componentCorePackage,
proxiesFile: directivesProxyFile('react'),
excludeComponents,
}),
// #endregion
// #region Svelte
svelteOutputTarget({
componentCorePackage,
proxiesFile: directivesProxyFile('svelte'),
includeDefineCustomElements: true,
legacy: false,
excludeComponents,
}),
// #endregion
// custom element, no polifil
{
type: 'dist-custom-elements',
customElementsExportBehavior: 'single-export-module',
minify: true,
dir: customElementsDir,
generateTypeDeclarations: true,
empty: true,
},
{
type: 'dist',
esmLoaderPath: '../loader',
empty: true,
isPrimaryPackageOutputTarget: true,
},
{
type: 'docs-readme',
dir: './docs/guide/api',
footer: '*Built with ❤️ by Revolist OU*',
},
eventListOutputTarget({
mdPath: './docs/guide/api/events.md',
tsPath: './src/types/events.ts',
footer: '*Built with ❤️ by Revolist OU*',
}),
{
type: 'docs-vscode',
file: 'vscode-data.json',
},
{
type: 'dist-hydrate-script',
},
{
type: 'www',
copy: [
{ src: 'serve', dest: '.' },
{ src: '../node_modules/bootstrap/dist', dest: './bootstrap' },
],
serviceWorker: null, // disable service workers
},
],
nodeResolve: {
preferBuiltins: true,
},
};