fable-compiler-js
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -73,4 +73,6 @@ "use strict"; | ||
function parseFiles(projectPath, outDir, options) { | ||
const patternInput$$1 = (0, _ProjectParser.parseProject)(projectPath); | ||
const fileNames$$1 = (0, _ProjectParser.dedupFileNames)(patternInput$$1[2]); | ||
const projSet = (0, _ProjectParser.makeHashSetIgnoreCase)(); | ||
const patternInput$$1 = (0, _ProjectParser.parseProject)(projSet, projectPath); | ||
const fileSet = (0, _ProjectParser.makeHashSetIgnoreCase)(); | ||
const fileNames$$1 = (0, _ProjectParser.dedupFileNames)(fileSet, patternInput$$1[2]); | ||
const dllRefMap = (0, _Map.ofSeq)((0, _Seq.map)(function mapping(x) { | ||
@@ -77,0 +79,0 @@ return [(0, _Platform.Path$$$GetFileName)(x), x]; |
@@ -10,4 +10,6 @@ "use strict"; | ||
exports.parseProjectFile = parseProjectFile; | ||
exports.makeHashSetIgnoreCase = makeHashSetIgnoreCase; | ||
exports.dedupProjectRefs = dedupProjectRefs; | ||
exports.dedupFileNames = dedupFileNames; | ||
exports.parseProject = parseProject; | ||
exports.dedupFileNames = dedupFileNames; | ||
@@ -116,11 +118,11 @@ var _RegExp = require("./fable-library.2.1.10/RegExp"); | ||
var $target$$11, path$$1; | ||
const activePatternResult174 = $007CRegex$007C_$007C("^#r\\s+\"(.*?)\"$", matchValue); | ||
const activePatternResult663 = $007CRegex$007C_$007C("^#r\\s+\"(.*?)\"$", matchValue); | ||
if (activePatternResult174 != null) { | ||
if (activePatternResult174.tail != null) { | ||
if (activePatternResult174.tail.tail != null) { | ||
if (activePatternResult174.tail.tail.tail == null) { | ||
if (path = activePatternResult174.tail.head, !(0, _String.endsWith)(path, "Fable.Core.dll")) { | ||
if (activePatternResult663 != null) { | ||
if (activePatternResult663.tail != null) { | ||
if (activePatternResult663.tail.tail != null) { | ||
if (activePatternResult663.tail.tail.tail == null) { | ||
if (path = activePatternResult663.tail.head, !(0, _String.endsWith)(path, "Fable.Core.dll")) { | ||
$target$$11 = 0; | ||
path$$1 = activePatternResult174.tail.head; | ||
path$$1 = activePatternResult663.tail.head; | ||
} else { | ||
@@ -151,10 +153,10 @@ $target$$11 = 1; | ||
var $target$$12, path$$2; | ||
const activePatternResult172 = $007CRegex$007C_$007C("^#load\\s+\"(.*?)\"$", matchValue); | ||
const activePatternResult661 = $007CRegex$007C_$007C("^#load\\s+\"(.*?)\"$", matchValue); | ||
if (activePatternResult172 != null) { | ||
if (activePatternResult172.tail != null) { | ||
if (activePatternResult172.tail.tail != null) { | ||
if (activePatternResult172.tail.tail.tail == null) { | ||
if (activePatternResult661 != null) { | ||
if (activePatternResult661.tail != null) { | ||
if (activePatternResult661.tail.tail != null) { | ||
if (activePatternResult661.tail.tail.tail == null) { | ||
$target$$12 = 0; | ||
path$$2 = activePatternResult172.tail.head; | ||
path$$2 = activePatternResult661.tail.head; | ||
} else { | ||
@@ -213,3 +215,51 @@ $target$$12 = 1; | ||
function parseProject(projectPath$$2) { | ||
function makeHashSetIgnoreCase() { | ||
const equalityComparerIgnoreCase = { | ||
Equals(x, y) { | ||
return x.toLowerCase() === y.toLowerCase(); | ||
}, | ||
GetHashCode(x$$1) { | ||
return (0, _Util.structuralHash)(x$$1.toLowerCase()); | ||
} | ||
}; | ||
return (0, _Set.createMutable)([], (0, _Util.comparerFromEqualityComparer)(equalityComparerIgnoreCase)); | ||
} | ||
function dedupProjectRefs(projSet, projectRefs$$2) { | ||
const newRefs = projectRefs$$2.filter(function predicate(x$$2) { | ||
return !projSet.has(x$$2); | ||
}); | ||
(0, _Set.unionWith)(projSet, newRefs); | ||
return newRefs; | ||
} | ||
function dedupFileNames(fileSet, fileNames) { | ||
const padName = function padName(fileName) { | ||
const pos = fileName.lastIndexOf(".") | 0; | ||
const nm = pos < 0 ? fileName : fileName.substr(0, pos); | ||
const ext = pos < 0 ? "" : fileName.substr(pos); | ||
return nm + "_" + ext; | ||
}; | ||
const dedup = function dedup(fileName$$1) { | ||
dedup: while (true) { | ||
if (fileSet.has(fileName$$1)) { | ||
const $fileName$$1$$13 = fileName$$1; | ||
fileName$$1 = padName($fileName$$1$$13); | ||
continue dedup; | ||
} else { | ||
(0, _Util.addToSet)(fileName$$1, fileSet); | ||
return fileName$$1; | ||
} | ||
break; | ||
} | ||
}; | ||
return (0, _Array.map)(dedup, fileNames, Array); | ||
} | ||
function parseProject(projSet$$1, projectPath$$2) { | ||
const patternInput$$1 = (0, _String.endsWith)(projectPath$$2, ".fsx") ? parseProjectScript(projectPath$$2) : parseProjectFile(projectPath$$2); | ||
@@ -227,23 +277,17 @@ const projectFileDir = (0, _Platform.Path$$$GetDirectoryName)(projectPath$$2); | ||
const makePath = function makePath(path$$4) { | ||
if (isAbsolutePath(path$$4)) { | ||
return path$$4; | ||
} else { | ||
return (0, _Platform.Path$$$Combine)(projectFileDir, path$$4); | ||
} | ||
return (0, _Platform.normalizeFullPath)(isAbsolutePath(path$$4) ? path$$4 : (0, _Platform.Path$$$Combine)(projectFileDir, path$$4)); | ||
}; | ||
const sourcePaths = (0, _Array.map)(function mapping$$10(path$$5) { | ||
return (0, _Platform.normalizeFullPath)(makePath(path$$5)); | ||
}, patternInput$$1[3], Array); | ||
const sourceTexts = (0, _Array.map)(function mapping$$11(path$$7) { | ||
return (0, _Platform.readAllText)(makePath(path$$7)); | ||
}, patternInput$$1[3], Array); | ||
const parsedProjects = (0, _Array.map)(parseProject, (0, _Array.map)(makePath, patternInput$$1[2], Array), Array); | ||
const sourcePaths$$1 = (0, _Array.append)((0, _Array.collect)(function mapping$$13(tupledArg$$1) { | ||
const sourcePaths = (0, _Array.map)(makePath, patternInput$$1[3], Array); | ||
const sourceTexts = (0, _Array.map)(_Platform.readAllText, sourcePaths, Array); | ||
const parsedProjects = (0, _Array.map)(function mapping$$10(projectPath$$3) { | ||
return parseProject(projSet$$1, projectPath$$3); | ||
}, dedupProjectRefs(projSet$$1, (0, _Array.map)(makePath, patternInput$$1[2], Array)), Array); | ||
const sourcePaths$$1 = (0, _Array.append)((0, _Array.collect)(function mapping$$11(tupledArg$$1) { | ||
return tupledArg$$1[2]; | ||
}, parsedProjects, Array), sourcePaths, Array); | ||
const sourceTexts$$1 = (0, _Array.append)((0, _Array.collect)(function mapping$$14(tupledArg$$2) { | ||
const sourceTexts$$1 = (0, _Array.append)((0, _Array.collect)(function mapping$$12(tupledArg$$2) { | ||
return tupledArg$$2[3]; | ||
}, parsedProjects, Array), sourceTexts, Array); | ||
const otherOptions$$4 = (0, _Array.append)((0, _Array.collect)(function mapping$$15(tupledArg$$3) { | ||
const otherOptions$$4 = (0, _Array.append)((0, _Array.collect)(function mapping$$13(tupledArg$$3) { | ||
return tupledArg$$3[4]; | ||
@@ -258,40 +302,2 @@ }, parsedProjects, Array), patternInput$$1[4], Array); | ||
})]; | ||
} | ||
function dedupFileNames(fileNames) { | ||
const comparerIgnoreCase = { | ||
Equals(x$$3, y) { | ||
return x$$3.toLowerCase() === y.toLowerCase(); | ||
}, | ||
GetHashCode(x$$4) { | ||
return (0, _Util.structuralHash)(x$$4.toLowerCase()); | ||
} | ||
}; | ||
const nameSet = (0, _Set.createMutable)([], (0, _Util.comparerFromEqualityComparer)(comparerIgnoreCase)); | ||
const padName = function padName(name) { | ||
const pos = name.lastIndexOf(".") | 0; | ||
const nm = pos < 0 ? name : name.substr(0, pos); | ||
const ext = pos < 0 ? "" : name.substr(pos); | ||
return nm + "_" + ext; | ||
}; | ||
const dedup = function dedup(name$$1) { | ||
dedup: while (true) { | ||
if (nameSet.has(name$$1)) { | ||
const $name$$1$$13 = name$$1; | ||
name$$1 = padName($name$$1$$13); | ||
continue dedup; | ||
} else { | ||
(0, _Util.addToSet)(name$$1, nameSet); | ||
return name$$1; | ||
} | ||
break; | ||
} | ||
}; | ||
return (0, _Array.map)(dedup, fileNames, Array); | ||
} |
{ | ||
"name": "fable-compiler-js", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "bin": { |
# fable-compiler-js | ||
[Fable](http://fable.io/) (F# to JS compiler) running entirely on node.js (no dotnet installation required). This version is stil **experimental**. For example, packages are not yet supported. | ||
[Fable](http://fable.io/) (F# to JS compiler) running entirely on node.js (no dotnet installation required). This version is still **experimental**. For example, packages are not yet supported. | ||
@@ -5,0 +5,0 @@ ## Global installation |
@@ -0,1 +1,5 @@ | ||
### 1.0.2 | ||
* Fixed duplicate project references | ||
### 1.0.1 | ||
@@ -2,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
361758
10364
2