/
shaker-plugin.test.ts.snap
114 lines (95 loc) · 2.73 KB
/
shaker-plugin.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
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`shaker should delete import 1`] = `"export const Alive = \\"\\";"`;
exports[`shaker should handle __importDefault 1`] = `
"var __importDefault = this && this.__importDefault || function (mod) {
return mod && mod.__esModule ? mod : {
default: mod
};
};
Object.defineProperty(exports, '__esModule', {
value: true
});
var Input_1 = require('./Input');
Object.defineProperty(exports, 'Input', {
enumerable: true,
get: function () {
return __importDefault(Input_1).default;
}
});"
`;
exports[`shaker should keep assigment even if export is marked for removing 1`] = `
"let _a;
exports.a = _a = {};
exports.b = _a;"
`;
exports[`shaker should keep only side-effects 1`] = `"import 'regenerator-runtime/runtime.js';"`;
exports[`shaker should keep referenced exports 1`] = `
"var _foo;
_foo = 10;
exports.defaultValue = Math.random() * _foo;
exports.foo = _foo;"
`;
exports[`shaker should keep setBatch 1`] = `
"function defaultNoopBatch(callback) {
callback();
}
var batch = defaultNoopBatch;
export var setBatch = function setBatch(newBatch) {
return batch = newBatch;
};"
`;
exports[`shaker should keep side-effects from modules 1`] = `
"import 'regenerator-runtime/runtime.js';
export const a = 1;"
`;
exports[`shaker should process array patterns 1`] = `
"const [,, c] = array;
export { c };"
`;
exports[`shaker should process constant violations inside binding paths 1`] = `
"export function c() {}
;"
`;
exports[`shaker should process identifiers in void expressions as references 1`] = `
"let _;
function b(b) {
void _;
}
exports.b = b;"
`;
exports[`shaker should process object patterns 1`] = `
"const {
b: b1
} = obj;
export { b1 };"
`;
exports[`shaker should process transpiled enums 1`] = `
"var _Kind;
exports.Kind = void 0;
var Kind;
(function (Kind) {
Kind[\\"DEFAULT\\"] = \\"default\\";
Kind[\\"TRANSPARENT\\"] = \\"transparent\\";
Kind[\\"RED\\"] = \\"red\\";
Kind[\\"BLACK\\"] = \\"black\\";
})(Kind = _Kind || (_Kind = {}));
export const defaultValue = Kind.DEFAULT;
exports.Kind = _Kind;"
`;
exports[`shaker should remove all references of \`a\` 1`] = `"exports.b = 10;"`;
exports[`shaker should remove asset imports 1`] = `"export const a = 1;"`;
exports[`shaker should remove related code 1`] = `
"const a = 1;
export { a };"
`;
exports[`shaker should remove unused export 1`] = `"export const a = 1;"`;
exports[`shaker should respect implicit references 1`] = `
"let _a;
exports.a = _a = {};
exports.b = _a;"
`;
exports[`shaker should shake if __linariaPreval required but not exported 1`] = `
"import 'regenerator-runtime/runtime.js';
export { Input } from \\"./Input\\";"
`;
exports[`shaker should throw out unused referenced exports 1`] = `"exports.defaultValue = 20;"`;