forked from egoist/tsup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.ts.snap
263 lines (224 loc) · 7.26 KB
/
index.test.ts.snap
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
// Vitest Snapshot v1
exports[`code splitting in cjs format 1`] = `
"\\"use strict\\";Object.defineProperty(exports, \\"__esModule\\", {value: true});// input.ts
var foo = () => Promise.resolve().then(() => require(\\"./foo-D62QZYUQ.js\\"));
exports.foo = foo;
"
`;
exports[`code splitting in cjs format 2`] = `
"\\"use strict\\";Object.defineProperty(exports, \\"__esModule\\", {value: true});// another-input.ts
var foo = () => Promise.resolve().then(() => require(\\"./foo-D62QZYUQ.js\\"));
exports.foo = foo;
"
`;
exports[`declaration files with multiple entrypoints #316 1`] = `
"declare const foo = 1;
export { foo };
"
`;
exports[`declaration files with multiple entrypoints #316 2`] = `
"declare const bar = \\"bar\\";
export { bar };
"
`;
exports[`disable code splitting to get proper module.exports = 1`] = `
"\\"use strict\\";
// input.ts
module.exports = 123;
"
`;
exports[`enable --dts-resolve for specific module 1`] = `
"export * from 'vue';
type MarkRequired<T, RK extends keyof T> = Exclude<T, RK> & Required<Pick<T, RK>>
export { MarkRequired };
"
`;
exports[`external 1`] = `
"\\"use strict\\";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === \\"object\\" || typeof from === \\"function\\") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, \\"__esModule\\", { value: true }), mod);
// input.ts
var input_exports = {};
__export(input_exports, {
bar: () => import_bar.bar,
baz: () => baz,
foo: () => import_foo.foo,
qux: () => import_qux.qux
});
module.exports = __toCommonJS(input_exports);
var import_foo = require(\\"foo\\");
var import_bar = require(\\"bar\\");
// node_modules/baz/index.ts
var baz = \\"baz\\";
// input.ts
var import_qux = require(\\"qux\\");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
bar,
baz,
foo,
qux
});
"
`;
exports[`import css 1`] = `
"\\"use strict\\";
"
`;
exports[`import css in --dts 1`] = `
"\\"use strict\\";
"
`;
exports[`multiple targets 1`] = `
"\\"use strict\\";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === \\"object\\" || typeof from === \\"function\\") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, \\"__esModule\\", { value: true }), mod);
// input.ts
var input_exports = {};
__export(input_exports, {
answer: () => answer
});
module.exports = __toCommonJS(input_exports);
var answer = 42;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
answer
});
"
`;
exports[`node protocol 1`] = `
"\\"use strict\\";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === \\"object\\" || typeof from === \\"function\\") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, \\"default\\", { value: mod, enumerable: true }) : target,
mod
));
// input.ts
var import_node_fs = __toESM(require(\\"fs\\"));
console.log(import_node_fs.default);
"
`;
exports[`not bundle \`package/subpath\` in dts (resolve) 1`] = `
"import * as foo_bar from 'foo/bar';
declare const stuff: foo_bar.Foobar;
export { stuff };
"
`;
exports[`simple 1`] = `
"\\"use strict\\";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === \\"object\\" || typeof from === \\"function\\") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, \\"__esModule\\", { value: true }), mod);
// input.ts
var input_exports = {};
__export(input_exports, {
default: () => input_default
});
module.exports = __toCommonJS(input_exports);
// foo.ts
var foo_default = \\"foo\\";
// input.ts
var input_default = foo_default;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
"
`;
exports[`support baseUrl and paths in tsconfig.json 1`] = `
"var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === \\"object\\" || typeof from === \\"function\\") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, \\"__esModule\\", { value: true }), mod);
// input.ts
var input_exports = {};
__export(input_exports, {
foo: () => foo
});
module.exports = __toCommonJS(input_exports);
// foo.ts
var foo = \\"foo\\";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
foo
});
"
`;
exports[`support baseUrl and paths in tsconfig.json in --dts build 1`] = `
"declare const foo = \\"foo\\";
export { foo };
"
`;
exports[`support baseUrl and paths in tsconfig.json in --dts-resolve build 1`] = `
"declare const foo = \\"foo\\";
export { foo };
"
`;