Skip to content

Commit 7457fb3

Browse files
committed
undo formatting changes in rollup config
1 parent d0c22b1 commit 7457fb3

File tree

1 file changed

+96
-103
lines changed

1 file changed

+96
-103
lines changed

rollup.config.js

Lines changed: 96 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,122 @@
1-
import nodeResolve from "@rollup/plugin-node-resolve"
2-
import commonjs from "@rollup/plugin-commonjs"
1+
import nodeResolve from '@rollup/plugin-node-resolve'
2+
import commonjs from '@rollup/plugin-commonjs'
33

44
const localImports = process.env.LOCALIMPORTS
55

66
const customModules = new Set([
7-
"y-websocket",
8-
"y-codemirror",
9-
"y-ace",
10-
"y-textarea",
11-
"y-quill",
12-
"y-dom",
13-
"y-prosemirror",
7+
'y-websocket',
8+
'y-codemirror',
9+
'y-ace',
10+
'y-textarea',
11+
'y-quill',
12+
'y-dom',
13+
'y-prosemirror'
1414
])
1515
/**
1616
* @type {Set<any>}
1717
*/
18-
const customLibModules = new Set(["lib0", "y-protocols"])
18+
const customLibModules = new Set([
19+
'lib0',
20+
'y-protocols'
21+
])
1922
const debugResolve = {
20-
resolveId(importee) {
21-
if (importee === "yjs") {
23+
resolveId (importee) {
24+
if (importee === 'yjs') {
2225
return `${process.cwd()}/src/index.js`
2326
}
2427
if (localImports) {
25-
if (customModules.has(importee.split("/")[0])) {
28+
if (customModules.has(importee.split('/')[0])) {
2629
return `${process.cwd()}/../${importee}/src/${importee}.js`
2730
}
28-
if (customLibModules.has(importee.split("/")[0])) {
31+
if (customLibModules.has(importee.split('/')[0])) {
2932
return `${process.cwd()}/../${importee}`
3033
}
3134
}
3235
return null
33-
},
36+
}
3437
}
3538

36-
export default [
37-
{
38-
input: "./src/index.js",
39-
output: {
40-
name: "Y",
41-
file: "dist/yjs.cjs",
42-
format: "cjs",
43-
sourcemap: true,
44-
},
45-
external: (id) => /^lib0\//.test(id),
39+
export default [{
40+
input: './src/index.js',
41+
output: {
42+
name: 'Y',
43+
file: 'dist/yjs.cjs',
44+
format: 'cjs',
45+
sourcemap: true
4646
},
47-
{
48-
input: "./src/index.js",
49-
output: {
50-
name: "Y",
51-
file: "dist/yjs.mjs",
52-
format: "esm",
53-
sourcemap: true,
54-
},
55-
external: (id) => /^lib0\//.test(id),
47+
external: id => /^lib0\//.test(id)
48+
}, {
49+
input: './src/index.js',
50+
output: {
51+
name: 'Y',
52+
file: 'dist/yjs.mjs',
53+
format: 'esm',
54+
sourcemap: true
5655
},
57-
{
58-
input: "./src/index.js",
59-
output: {
60-
name: "Y",
61-
file: "dist/yjs.amd.js",
62-
format: "amd",
63-
sourcemap: true,
64-
},
65-
plugins: [
66-
nodeResolve({
67-
browser: true, // Use browser-compatible versions of modules
68-
extensions: [".js", ".ts"],
69-
preferBuiltins: false, // Do not prefer Node.js built-ins
70-
}),
71-
commonjs(),
72-
// terser, etc.
73-
],
56+
external: id => /^lib0\//.test(id)
57+
}, {
58+
input: './tests/testHelper.js',
59+
output: {
60+
name: 'Y',
61+
file: 'dist/testHelper.mjs',
62+
format: 'esm',
63+
sourcemap: true
7464
},
75-
{
76-
input: "./tests/testHelper.js",
77-
output: {
78-
name: "Y",
79-
file: "dist/testHelper.mjs",
80-
format: "esm",
81-
sourcemap: true,
82-
},
83-
external: (id) => /^lib0\//.test(id) || id === "yjs",
84-
plugins: [
85-
{
86-
resolveId(importee) {
87-
if (importee === "../src/index.js") {
88-
return "yjs"
89-
}
90-
return null
91-
},
92-
},
93-
],
65+
external: id => /^lib0\//.test(id) || id === 'yjs',
66+
plugins: [{
67+
resolveId (importee) {
68+
if (importee === '../src/index.js') {
69+
return 'yjs'
70+
}
71+
return null
72+
}
73+
}]
74+
}, {
75+
input: './tests/index.js',
76+
output: {
77+
name: 'test',
78+
file: 'dist/tests.js',
79+
format: 'iife',
80+
sourcemap: true
9481
},
95-
{
96-
input: "./tests/index.js",
97-
output: {
98-
name: "test",
99-
file: "dist/tests.js",
100-
format: "iife",
101-
sourcemap: true,
102-
},
103-
plugins: [
104-
debugResolve,
105-
nodeResolve({
106-
mainFields: ["browser", "module", "main"],
107-
}),
108-
commonjs(),
109-
],
82+
plugins: [
83+
debugResolve,
84+
nodeResolve({
85+
mainFields: ['browser', 'module', 'main']
86+
}),
87+
commonjs()
88+
]
89+
}, {
90+
input: './tests/index.js',
91+
output: {
92+
name: 'test',
93+
file: 'dist/tests.cjs',
94+
format: 'cjs',
95+
sourcemap: true
11096
},
111-
{
112-
input: "./tests/index.js",
113-
output: {
114-
name: "test",
115-
file: "dist/tests.cjs",
116-
format: "cjs",
117-
sourcemap: true,
118-
},
119-
plugins: [
120-
debugResolve,
121-
nodeResolve({
122-
mainFields: ["node", "module", "main"],
123-
exportConditions: ["node", "module", "import", "default"],
124-
}),
125-
commonjs(),
126-
],
127-
external: (id) => /^lib0\//.test(id),
97+
plugins: [
98+
debugResolve,
99+
nodeResolve({
100+
mainFields: ['node', 'module', 'main'],
101+
exportConditions: ['node', 'module', 'import', 'default']
102+
}),
103+
commonjs()
104+
],
105+
external: id => /^lib0\//.test(id)
106+
}, {
107+
input: './src/index.js',
108+
output: {
109+
name: 'Y',
110+
file: 'dist/yjs.amd.js',
111+
format: 'amd',
112+
sourcemap: true
128113
},
129-
]
114+
plugins: [
115+
nodeResolve({
116+
browser: true, // Use browser-compatible versions of modules
117+
extensions: ['.js', '.ts'],
118+
preferBuiltins: false // Do not prefer Node.js built-ins
119+
}),
120+
commonjs()
121+
]
122+
}]

0 commit comments

Comments
 (0)