1
1
'use strict' ;
2
2
3
- const Debug = require ( 'debug' ) ;
4
3
const Yaml = require ( 'js-yaml' ) ;
5
4
6
5
const Loader = require ( '../loader' ) ;
@@ -14,9 +13,6 @@ const internals = {
14
13
} ;
15
14
16
15
17
- internals . log = Debug ( 'detect-node-support' ) ;
18
-
19
-
20
16
internals . normalizeImports = ( travisYaml , { relativeTo } ) => {
21
17
22
18
return Utils . toArray ( travisYaml . import )
@@ -53,12 +49,7 @@ internals.normalizeImports = (travisYaml, { relativeTo }) => {
53
49
} ;
54
50
55
51
56
- internals . loadSource = async ( source , { loadFile, cache } ) => {
57
-
58
- if ( cache [ source ] ) {
59
- internals . log ( 'Returning cached %s' , source ) ;
60
- return cache [ source ] ;
61
- }
52
+ internals . loadSource = async ( source , { loadFile } ) => {
62
53
63
54
let path = source ;
64
55
@@ -70,14 +61,11 @@ internals.loadSource = async (source, { loadFile, cache }) => {
70
61
loadFile = loader . loadFile ;
71
62
}
72
63
73
- internals . log ( 'Loading %s' , source ) ;
74
- const result = await loadFile ( path ) ;
75
- cache [ source ] = result ;
76
- return result ;
64
+ return loadFile ( path ) ;
77
65
} ;
78
66
79
67
80
- exports . apply = async ( yaml , { loadFile, relativeTo, cache = new Map ( ) } ) => {
68
+ exports . apply = async ( yaml , { loadFile, relativeTo } ) => {
81
69
82
70
if ( ! yaml . import ) {
83
71
return ;
@@ -87,14 +75,14 @@ exports.apply = async (yaml, { loadFile, relativeTo, cache = new Map() }) => {
87
75
88
76
for ( const entry of imports ) {
89
77
90
- const buffer = await internals . loadSource ( entry . source , { loadFile, cache } ) ;
78
+ const buffer = await internals . loadSource ( entry . source , { loadFile } ) ;
91
79
92
80
const imported = Yaml . safeLoad ( buffer , {
93
81
schema : Yaml . FAILSAFE_SCHEMA ,
94
82
json : true
95
83
} ) ;
96
84
97
- await exports . apply ( imported , { loadFile, relativeTo : entry , cache } ) ;
85
+ await exports . apply ( imported , { loadFile, relativeTo : entry } ) ;
98
86
99
87
delete imported . import ;
100
88
0 commit comments