@cparra/apex-reflection 2.9.1 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/end-to-end.test.ts +16 -0
- package/out.js +126 -1
- package/package.json +1 -1
|
@@ -122,6 +122,22 @@ describe('Interface Reflection', () => {
|
|
|
122
122
|
expect(result.annotations.length).toBe(1);
|
|
123
123
|
expect(result.annotations[0].name).toBe('namespaceaccessible');
|
|
124
124
|
});
|
|
125
|
+
|
|
126
|
+
test('Methods can have their own annotations', () => {
|
|
127
|
+
const interfaceBody = `
|
|
128
|
+
@NamespaceAccessible
|
|
129
|
+
public with sharing interface MyInterface{
|
|
130
|
+
@Deprecated
|
|
131
|
+
void method1();
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
134
|
+
const result = (reflect(interfaceBody).typeMirror) as InterfaceMirror;
|
|
135
|
+
expect(result.methods[0].annotations.length).toBe(2);
|
|
136
|
+
|
|
137
|
+
const annotationNames = result.methods[0].annotations.map(a => a.name);
|
|
138
|
+
expect(annotationNames).toContain('namespaceaccessible');
|
|
139
|
+
expect(annotationNames).toContain('deprecated');
|
|
140
|
+
});
|
|
125
141
|
});
|
|
126
142
|
|
|
127
143
|
describe('Class reflection', () => {
|
package/out.js
CHANGED
|
@@ -1,3 +1,128 @@
|
|
|
1
|
+
// make sure to keep this as 'var'
|
|
2
|
+
// we don't want block scoping
|
|
3
|
+
|
|
4
|
+
var dartNodePreambleSelf = typeof global !== "undefined" ? global : window;
|
|
5
|
+
|
|
6
|
+
var self = Object.create(dartNodePreambleSelf);
|
|
7
|
+
|
|
8
|
+
self.scheduleImmediate = typeof setImmediate !== "undefined"
|
|
9
|
+
? function (cb) {
|
|
10
|
+
setImmediate(cb);
|
|
11
|
+
}
|
|
12
|
+
: function (cb) {
|
|
13
|
+
setTimeout(cb, 0);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// CommonJS globals.
|
|
17
|
+
self.require = require;
|
|
18
|
+
self.exports = exports;
|
|
19
|
+
|
|
20
|
+
// Node.js specific exports, check to see if they exist & or polyfilled
|
|
21
|
+
|
|
22
|
+
if (typeof process !== "undefined") {
|
|
23
|
+
self.process = process;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (typeof __dirname !== "undefined") {
|
|
27
|
+
self.__dirname = __dirname;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typeof __filename !== "undefined") {
|
|
31
|
+
self.__filename = __filename;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (typeof Buffer !== "undefined") {
|
|
35
|
+
self.Buffer = Buffer;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// if we're running in a browser, Dart supports most of this out of box
|
|
39
|
+
// make sure we only run these in Node.js environment
|
|
40
|
+
|
|
41
|
+
var dartNodeIsActuallyNode = !dartNodePreambleSelf.window
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
// Check if we're in a Web Worker instead.
|
|
45
|
+
if ("undefined" !== typeof WorkerGlobalScope && dartNodePreambleSelf instanceof WorkerGlobalScope) {
|
|
46
|
+
dartNodeIsActuallyNode = false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Check if we're in Electron, with Node.js integration, and override if true.
|
|
50
|
+
if ("undefined" !== typeof process && process.versions && process.versions.hasOwnProperty('electron') && process.versions.hasOwnProperty('node')) {
|
|
51
|
+
dartNodeIsActuallyNode = true;
|
|
52
|
+
}
|
|
53
|
+
} catch (e) {
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (dartNodeIsActuallyNode) {
|
|
57
|
+
// This line is to:
|
|
58
|
+
// 1) Prevent Webpack from bundling.
|
|
59
|
+
// 2) In Webpack on Node.js, make sure we're using the native Node.js require, which is available via __non_webpack_require__
|
|
60
|
+
// https://github.com/mbullington/node_preamble.dart/issues/18#issuecomment-527305561
|
|
61
|
+
var url = ("undefined" !== typeof __webpack_require__ ? __non_webpack_require__ : require)("url");
|
|
62
|
+
|
|
63
|
+
// Setting `self.location=` in Electron throws a `TypeError`, so we define it
|
|
64
|
+
// as a property instead to be safe.
|
|
65
|
+
Object.defineProperty(self, "location", {
|
|
66
|
+
value: {
|
|
67
|
+
get href() {
|
|
68
|
+
if (url.pathToFileURL) {
|
|
69
|
+
return url.pathToFileURL(process.cwd()).href + "/";
|
|
70
|
+
} else {
|
|
71
|
+
// This isn't really a correct transformation, but it's the best we have
|
|
72
|
+
// for versions of Node <10.12.0 which introduced `url.pathToFileURL()`.
|
|
73
|
+
// For example, it will fail for paths that contain characters that need
|
|
74
|
+
// to be escaped in URLs.
|
|
75
|
+
return "file://" + (function () {
|
|
76
|
+
var cwd = process.cwd();
|
|
77
|
+
if (process.platform != "win32") return cwd;
|
|
78
|
+
return "/" + cwd.replace(/\\/g, "/");
|
|
79
|
+
})() + "/"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
(function () {
|
|
86
|
+
function computeCurrentScript() {
|
|
87
|
+
try {
|
|
88
|
+
throw new Error();
|
|
89
|
+
} catch (e) {
|
|
90
|
+
var stack = e.stack;
|
|
91
|
+
var re = new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$", "mg");
|
|
92
|
+
var lastMatch = null;
|
|
93
|
+
do {
|
|
94
|
+
var match = re.exec(stack);
|
|
95
|
+
if (match != null) lastMatch = match;
|
|
96
|
+
} while (match != null);
|
|
97
|
+
return lastMatch[1];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Setting `self.document=` isn't known to throw an error anywhere like
|
|
102
|
+
// `self.location=` does on Electron, but it's better to be future-proof
|
|
103
|
+
// just in case..
|
|
104
|
+
var cachedCurrentScript = null;
|
|
105
|
+
Object.defineProperty(self, "document", {
|
|
106
|
+
value: {
|
|
107
|
+
get currentScript() {
|
|
108
|
+
if (cachedCurrentScript == null) {
|
|
109
|
+
cachedCurrentScript = {src: computeCurrentScript()};
|
|
110
|
+
}
|
|
111
|
+
return cachedCurrentScript;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
})();
|
|
116
|
+
|
|
117
|
+
self.dartDeferredLibraryLoader = function (uri, successCallback, errorCallback) {
|
|
118
|
+
try {
|
|
119
|
+
load(uri);
|
|
120
|
+
successCallback();
|
|
121
|
+
} catch (error) {
|
|
122
|
+
errorCallback(error);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
1
126
|
(function dartProgram(){function copyProperties(a,b){var s=Object.keys(a)
|
|
2
127
|
for(var r=0;r<s.length;r++){var q=s[r]
|
|
3
128
|
b[q]=a[q]}}function mixinPropertiesHard(a,b){var s=Object.keys(a)
|
|
@@ -16298,7 +16423,7 @@ j=this.du(a)
|
|
|
16298
16423
|
k=this.b.a
|
|
16299
16424
|
l=k.gR(0).c$
|
|
16300
16425
|
s=A.E(k.gR(0).d$,!0,t.gT)
|
|
16301
|
-
B.a.a5(s,i)
|
|
16426
|
+
if(i.length!==0)B.a.a5(s,i)
|
|
16302
16427
|
r=t.b
|
|
16303
16428
|
q=t.t
|
|
16304
16429
|
A.p(r,q,"T",m)
|