UNPKG

2.27 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7function cdn(url) {
8 return {
9 plugin: 'cdn',
10 url
11 };
12}
13
14exports.cdn = cdn;
15
16function entry(entries) {
17 return {
18 plugin: 'entry',
19 entries
20 };
21}
22
23exports.entry = entry;
24
25function experiments({
26 fastStartup = false,
27 optimizeLodash = false,
28 railsWithNodeServer = false,
29 reactLoadable = false
30}) {
31 return {
32 plugin: 'experiments',
33 fastStartup,
34 optimizeLodash,
35 reactLoadable,
36 railsWithNodeServer
37 };
38}
39
40exports.experiments = experiments;
41
42function externals(externals) {
43 return {
44 plugin: 'externals',
45 externals
46 };
47}
48
49exports.externals = externals;
50
51function isGraphQLMultipleRemoteSchemaConfig(config) {
52 return Boolean(config.projects);
53}
54
55exports.isGraphQLMultipleRemoteSchemaConfig = isGraphQLMultipleRemoteSchemaConfig;
56
57function graphql({
58 schema,
59 customScalars
60}) {
61 const schemas = [];
62
63 if (typeof schema === 'string') {
64 schemas.push([undefined, {
65 production: schema
66 }]);
67 } else if (isGraphQLMultipleRemoteSchemaConfig(schema)) {
68 schemas.push(...Object.entries(schema.projects));
69 } else {
70 schemas.push([undefined, schema]);
71 }
72
73 return {
74 plugin: 'graphql',
75 schemas: new Map(schemas),
76 customScalars
77 };
78}
79
80exports.graphql = graphql;
81
82function jest(configure) {
83 return {
84 plugin: 'jest',
85 configure
86 };
87}
88
89exports.jest = jest;
90
91function manifest(filename) {
92 return {
93 plugin: 'manifest',
94 filename
95 };
96}
97
98exports.manifest = manifest;
99
100function paths(paths) {
101 return {
102 plugin: 'paths',
103 paths
104 };
105}
106
107exports.paths = paths;
108
109function sass({
110 autoInclude = [],
111 autoImportPolaris = true
112}) {
113 return {
114 plugin: 'sass',
115 autoInclude,
116 autoImportPolaris
117 };
118}
119
120exports.sass = sass;
121
122function webpack(configure) {
123 return {
124 plugin: 'webpack',
125 configure
126 };
127}
128
129exports.webpack = webpack;
130
131function vendors(modules) {
132 return {
133 plugin: 'vendors',
134 modules
135 };
136}
137
138exports.vendors = vendors;
139
140function devServer(options) {
141 return Object.assign({
142 plugin: 'devServer'
143 }, options);
144}
145
146exports.devServer = devServer;
147
148function rollup(configure) {
149 return {
150 plugin: 'rollup',
151 configure
152 };
153}
154
155exports.rollup = rollup;
\No newline at end of file