json-as 0.5.21 → 0.5.22
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/package.json +1 -1
- package/transform/package.json +1 -1
- package/transform/src/index.ts +15 -1
package/package.json
CHANGED
package/transform/package.json
CHANGED
package/transform/src/index.ts
CHANGED
|
@@ -149,8 +149,22 @@ export default class Transformer extends Transform {
|
|
|
149
149
|
afterParse(parser: Parser): void {
|
|
150
150
|
// Create new transform
|
|
151
151
|
const transformer = new AsJSONTransform();
|
|
152
|
+
|
|
153
|
+
// Sort the sources so that user scripts are visited last
|
|
154
|
+
const sources = parser.sources.filter(source => !isStdlib(source)).sort((_a, _b) => {
|
|
155
|
+
const a = _a.internalPath
|
|
156
|
+
const b = _b.internalPath
|
|
157
|
+
if (a[0] === "~" && b[0] !== "~") {
|
|
158
|
+
return -1;
|
|
159
|
+
} else if (a[0] !== "~" && b[0] === "~") {
|
|
160
|
+
return 1;
|
|
161
|
+
} else {
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
|
|
152
166
|
// Loop over every source
|
|
153
|
-
for (const source of
|
|
167
|
+
for (const source of sources) {
|
|
154
168
|
// Ignore all lib and std. Visit everything else.
|
|
155
169
|
if (!isStdlib(source)) {
|
|
156
170
|
transformer.visit(source);
|