ether-code 0.2.8 → 0.2.9
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/cli/compiler.js +6 -6
- package/cli/ether.js +1 -1
- package/package.json +1 -1
package/cli/compiler.js
CHANGED
|
@@ -107,7 +107,7 @@ class EtherCompiler {
|
|
|
107
107
|
return mappings[target] || target
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
compileFile(filePath) {
|
|
111
111
|
const content = fs.readFileSync(filePath, 'utf-8')
|
|
112
112
|
const fileName = path.basename(filePath, '.eth')
|
|
113
113
|
|
|
@@ -116,11 +116,11 @@ class EtherCompiler {
|
|
|
116
116
|
const code = this.generate(ast, target)
|
|
117
117
|
|
|
118
118
|
const extension = this.getExtension(target)
|
|
119
|
-
const outputPath =
|
|
119
|
+
const outputPath = fileName + extension
|
|
120
120
|
|
|
121
121
|
return {
|
|
122
122
|
source: filePath,
|
|
123
|
-
target,
|
|
123
|
+
target: target,
|
|
124
124
|
outputs: [{
|
|
125
125
|
path: outputPath,
|
|
126
126
|
content: code
|
|
@@ -227,17 +227,17 @@ class EtherCompiler {
|
|
|
227
227
|
return TARGET_EXTENSIONS[target] || TARGET_EXTENSIONS[normalizedTarget] || '.js'
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
check(filePath) {
|
|
231
231
|
const content = fs.readFileSync(filePath, 'utf-8')
|
|
232
232
|
const target = this.detectTarget(content, filePath)
|
|
233
233
|
|
|
234
234
|
try {
|
|
235
235
|
this.parse(content, target)
|
|
236
236
|
} catch (err) {
|
|
237
|
-
throw new Error(
|
|
237
|
+
throw new Error('Erreur de syntaxe: ' + err.message)
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
return { valid: true, target }
|
|
240
|
+
return { valid: true, target: target }
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
getTargets() {
|
package/cli/ether.js
CHANGED