firefly-compiler 0.4.27 → 0.4.29
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/bin/firefly.mjs +1 -1
- package/compiler/Builder.ff +15 -6
- package/compiler/Main.ff +7 -1
- package/compiler/ModuleCache.ff +22 -4
- package/core/.firefly/include/package-lock.json +394 -0
- package/core/.firefly/include/package.json +5 -0
- package/core/.firefly/include/prepare.sh +1 -0
- package/core/.firefly/package.ff +1 -0
- package/lsp/Handler.ff +36 -11
- package/output/js/ff/compiler/Builder.mjs +14 -14
- package/output/js/ff/compiler/Main.mjs +6 -4
- package/output/js/ff/compiler/ModuleCache.mjs +80 -10
- package/package.json +5 -6
- package/vscode/language-configuration.json +14 -0
- package/vscode/package.json +1 -1
package/bin/firefly.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
import * as firefly from '../output/js/ff/compiler/Main.mjs';
|
package/compiler/Builder.ff
CHANGED
|
@@ -93,6 +93,7 @@ check(
|
|
|
93
93
|
fireflyPath: Path
|
|
94
94
|
path: Path
|
|
95
95
|
mustContain: Option[String]
|
|
96
|
+
skipFiles: Set[String]
|
|
96
97
|
virtualFiles: Map[String, String]
|
|
97
98
|
cache: ModuleCache
|
|
98
99
|
newVersion: Int
|
|
@@ -101,7 +102,7 @@ check(
|
|
|
101
102
|
checkDependencies: Bool
|
|
102
103
|
): List[CompileError] {
|
|
103
104
|
let packages = path.isDirectory().{
|
|
104
|
-
| True => findPackageFiles(path, mustContain)
|
|
105
|
+
| True => findPackageFiles(path, mustContain, skipFiles)
|
|
105
106
|
| False {path.endsWith([".firefly", "package.ff"])} => [PackageFiles(path.parent().grab(), Some(path), [])]
|
|
106
107
|
| False => [PackageFiles(path.parent().grab(), None, [path])]
|
|
107
108
|
}
|
|
@@ -156,8 +157,12 @@ capability PackageFiles(
|
|
|
156
157
|
)
|
|
157
158
|
|
|
158
159
|
|
|
159
|
-
findPackageFiles(
|
|
160
|
-
|
|
160
|
+
findPackageFiles(
|
|
161
|
+
path: Path
|
|
162
|
+
mustContain: Option[String]
|
|
163
|
+
skipFiles: Set[String]
|
|
164
|
+
): List[PackageFiles] {
|
|
165
|
+
let files = findFireflyFiles(path, mustContain, skipFiles)
|
|
161
166
|
let split = files.partition {_.endsWith([".firefly", "package.ff"])}
|
|
162
167
|
let packageFiles = split.first
|
|
163
168
|
mutable singleFiles = split.second
|
|
@@ -174,17 +179,21 @@ findPackageFiles(path: Path, mustContain: Option[String]): List[PackageFiles] {
|
|
|
174
179
|
[...multiFileProjects, ...singleFileProjects]
|
|
175
180
|
}
|
|
176
181
|
|
|
177
|
-
findFireflyFiles(
|
|
182
|
+
findFireflyFiles(
|
|
183
|
+
path: Path
|
|
184
|
+
mustContain: Option[String]
|
|
185
|
+
skipFiles: Set[String]
|
|
186
|
+
): List[Path] {
|
|
178
187
|
let split = path.entries().toList().partition {_.isDirectory()}
|
|
179
188
|
let directories = split.first.map {_.path()}.filter {_.base().all {c =>
|
|
180
189
|
c == '.' || c.isAsciiLower() || c.isAsciiDigit()
|
|
181
190
|
}}
|
|
182
191
|
let fireflyFiles = split.second.map {_.path()}.filter {file =>
|
|
183
|
-
file.extension() == ".ff" && mustContain.all {s =>
|
|
192
|
+
file.extension() == ".ff" && !skipFiles.contains(file.absolute()) && mustContain.all {s =>
|
|
184
193
|
file.readText().contains(s)
|
|
185
194
|
}
|
|
186
195
|
}
|
|
187
|
-
[...fireflyFiles, ...directories.flatMap {findFireflyFiles(_, mustContain)}]
|
|
196
|
+
[...fireflyFiles, ...directories.flatMap {findFireflyFiles(_, mustContain, skipFiles)}]
|
|
188
197
|
}
|
|
189
198
|
|
|
190
199
|
internalCreateExecutable(
|
package/compiler/Main.ff
CHANGED
|
@@ -92,6 +92,7 @@ main(system: NodeSystem): Unit {
|
|
|
92
92
|
fireflyPath = fireflyPath
|
|
93
93
|
path = system.path(filePath)
|
|
94
94
|
mustContain = None
|
|
95
|
+
skipFiles = Set.empty()
|
|
95
96
|
virtualFiles = Map.empty()
|
|
96
97
|
cache = ModuleCache.empty(1)
|
|
97
98
|
newVersion = 0
|
|
@@ -103,6 +104,7 @@ main(system: NodeSystem): Unit {
|
|
|
103
104
|
|
|
104
105
|
| BootstrapCommand =>
|
|
105
106
|
let workingDirectory = system.path(".")
|
|
107
|
+
let fakeLocation = Location("<core>", 0, 0)
|
|
106
108
|
Builder.build(
|
|
107
109
|
system = system
|
|
108
110
|
emitTarget = EmitNode
|
|
@@ -110,7 +112,11 @@ main(system: NodeSystem): Unit {
|
|
|
110
112
|
mainModule = "Main"
|
|
111
113
|
resolvedDependencies = ResolvedDependencies(
|
|
112
114
|
mainPackagePair = PackagePair("ff", "compiler")
|
|
113
|
-
packages = [
|
|
115
|
+
packages = [Pair(
|
|
116
|
+
PackagePair("ff", "core"), PackageInfo(DPackage(
|
|
117
|
+
fakeLocation, PackagePair("ff", "core"), Version(fakeLocation, 0, 0, 0), TargetNames(True, False)
|
|
118
|
+
), [], [DInclude(fakeLocation, "node_modules")])
|
|
119
|
+
)].toMap() // Only used for includes currently
|
|
114
120
|
packagePaths = [
|
|
115
121
|
Pair(PackagePair("ff", "compiler"), workingDirectory.slash("compiler"))
|
|
116
122
|
Pair(PackagePair("ff", "core"), workingDirectory.slash("core"))
|
package/compiler/ModuleCache.ff
CHANGED
|
@@ -22,9 +22,8 @@ empty(version: Int): ModuleCache {
|
|
|
22
22
|
|
|
23
23
|
extend self: ModuleCache {
|
|
24
24
|
|
|
25
|
-
remove(
|
|
26
|
-
if(!
|
|
27
|
-
let keys = paths.map {_.absolute()}
|
|
25
|
+
remove(keys: List[String]) {
|
|
26
|
+
if(!keys.isEmpty()):
|
|
28
27
|
self.parsedModules = self.parsedModules.removeList(keys)
|
|
29
28
|
self.resolvedModules = self.resolvedModules.removeList(keys)
|
|
30
29
|
self.derivedModules = self.derivedModules.removeList(keys)
|
|
@@ -32,6 +31,25 @@ extend self: ModuleCache {
|
|
|
32
31
|
self.emittedModules = self.emittedModules.removeList(keys)
|
|
33
32
|
}
|
|
34
33
|
|
|
34
|
+
invalidate(key: String) {
|
|
35
|
+
//Log.trace("Invalidate: " + uri)
|
|
36
|
+
self.parsedModules.get(key).each: | Pair(module, _) =>
|
|
37
|
+
let moduleName = module.file.dropLast(3)
|
|
38
|
+
self.remove([key])
|
|
39
|
+
self.parsedModules.each {| k, Pair(m, _) =>
|
|
40
|
+
if(m.imports.any {i => i.package == module.packagePair && i.file == moduleName}) {
|
|
41
|
+
//Log.trace("Invalidating due to import of invalidated module: " + m.packagePair.groupName() + "/" + m.file)
|
|
42
|
+
self.remove([k])
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
filesNotImporting(packagePair: PackagePair, moduleName: String): List[String] {
|
|
48
|
+
self.parsedModules.toList().collect {| Pair(k, Pair(m, _)) =>
|
|
49
|
+
if(!m.imports.any {i => i.package == packagePair && i.file == moduleName}): k
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
35
53
|
without(newVersion: Int, path: Path): ModuleCache {
|
|
36
54
|
let key = path.absolute()
|
|
37
55
|
if(path.isFile()) {
|
|
@@ -157,4 +175,4 @@ modulePath(
|
|
|
157
175
|
}
|
|
158
176
|
let file = moduleName + ".ff"
|
|
159
177
|
packagePath.slash(file)
|
|
160
|
-
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "include",
|
|
3
|
+
"lockfileVersion": 3,
|
|
4
|
+
"requires": true,
|
|
5
|
+
"packages": {
|
|
6
|
+
"": {
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"esbuild": "^0.21.1"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"node_modules/@esbuild/aix-ppc64": {
|
|
12
|
+
"version": "0.21.1",
|
|
13
|
+
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.1.tgz",
|
|
14
|
+
"integrity": "sha512-O7yppwipkXvnEPjzkSXJRk2g4bS8sUx9p9oXHq9MU/U7lxUzZVsnFZMDTmeeX9bfQxrFcvOacl/ENgOh0WP9pA==",
|
|
15
|
+
"cpu": [
|
|
16
|
+
"ppc64"
|
|
17
|
+
],
|
|
18
|
+
"optional": true,
|
|
19
|
+
"os": [
|
|
20
|
+
"aix"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=12"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"node_modules/@esbuild/android-arm": {
|
|
27
|
+
"version": "0.21.1",
|
|
28
|
+
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.1.tgz",
|
|
29
|
+
"integrity": "sha512-hh3jKWikdnTtHCglDAeVO3Oyh8MaH8xZUaWMiCCvJ9/c3NtPqZq+CACOlGTxhddypXhl+8B45SeceYBfB/e8Ow==",
|
|
30
|
+
"cpu": [
|
|
31
|
+
"arm"
|
|
32
|
+
],
|
|
33
|
+
"optional": true,
|
|
34
|
+
"os": [
|
|
35
|
+
"android"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=12"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"node_modules/@esbuild/android-arm64": {
|
|
42
|
+
"version": "0.21.1",
|
|
43
|
+
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.1.tgz",
|
|
44
|
+
"integrity": "sha512-jXhccq6es+onw7x8MxoFnm820mz7sGa9J14kLADclmiEUH4fyj+FjR6t0M93RgtlI/awHWhtF0Wgfhqgf9gDZA==",
|
|
45
|
+
"cpu": [
|
|
46
|
+
"arm64"
|
|
47
|
+
],
|
|
48
|
+
"optional": true,
|
|
49
|
+
"os": [
|
|
50
|
+
"android"
|
|
51
|
+
],
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=12"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"node_modules/@esbuild/android-x64": {
|
|
57
|
+
"version": "0.21.1",
|
|
58
|
+
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.1.tgz",
|
|
59
|
+
"integrity": "sha512-NPObtlBh4jQHE01gJeucqEhdoD/4ya2owSIS8lZYS58aR0x7oZo9lB2lVFxgTANSa5MGCBeoQtr+yA9oKCGPvA==",
|
|
60
|
+
"cpu": [
|
|
61
|
+
"x64"
|
|
62
|
+
],
|
|
63
|
+
"optional": true,
|
|
64
|
+
"os": [
|
|
65
|
+
"android"
|
|
66
|
+
],
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=12"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"node_modules/@esbuild/darwin-arm64": {
|
|
72
|
+
"version": "0.21.1",
|
|
73
|
+
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.1.tgz",
|
|
74
|
+
"integrity": "sha512-BLT7TDzqsVlQRmJfO/FirzKlzmDpBWwmCUlyggfzUwg1cAxVxeA4O6b1XkMInlxISdfPAOunV9zXjvh5x99Heg==",
|
|
75
|
+
"cpu": [
|
|
76
|
+
"arm64"
|
|
77
|
+
],
|
|
78
|
+
"optional": true,
|
|
79
|
+
"os": [
|
|
80
|
+
"darwin"
|
|
81
|
+
],
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">=12"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"node_modules/@esbuild/darwin-x64": {
|
|
87
|
+
"version": "0.21.1",
|
|
88
|
+
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.1.tgz",
|
|
89
|
+
"integrity": "sha512-D3h3wBQmeS/vp93O4B+SWsXB8HvRDwMyhTNhBd8yMbh5wN/2pPWRW5o/hM3EKgk9bdKd9594lMGoTCTiglQGRQ==",
|
|
90
|
+
"cpu": [
|
|
91
|
+
"x64"
|
|
92
|
+
],
|
|
93
|
+
"optional": true,
|
|
94
|
+
"os": [
|
|
95
|
+
"darwin"
|
|
96
|
+
],
|
|
97
|
+
"engines": {
|
|
98
|
+
"node": ">=12"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"node_modules/@esbuild/freebsd-arm64": {
|
|
102
|
+
"version": "0.21.1",
|
|
103
|
+
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.1.tgz",
|
|
104
|
+
"integrity": "sha512-/uVdqqpNKXIxT6TyS/oSK4XE4xWOqp6fh4B5tgAwozkyWdylcX+W4YF2v6SKsL4wCQ5h1bnaSNjWPXG/2hp8AQ==",
|
|
105
|
+
"cpu": [
|
|
106
|
+
"arm64"
|
|
107
|
+
],
|
|
108
|
+
"optional": true,
|
|
109
|
+
"os": [
|
|
110
|
+
"freebsd"
|
|
111
|
+
],
|
|
112
|
+
"engines": {
|
|
113
|
+
"node": ">=12"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"node_modules/@esbuild/freebsd-x64": {
|
|
117
|
+
"version": "0.21.1",
|
|
118
|
+
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.1.tgz",
|
|
119
|
+
"integrity": "sha512-paAkKN1n1jJitw+dAoR27TdCzxRl1FOEITx3h201R6NoXUojpMzgMLdkXVgCvaCSCqwYkeGLoe9UVNRDKSvQgw==",
|
|
120
|
+
"cpu": [
|
|
121
|
+
"x64"
|
|
122
|
+
],
|
|
123
|
+
"optional": true,
|
|
124
|
+
"os": [
|
|
125
|
+
"freebsd"
|
|
126
|
+
],
|
|
127
|
+
"engines": {
|
|
128
|
+
"node": ">=12"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"node_modules/@esbuild/linux-arm": {
|
|
132
|
+
"version": "0.21.1",
|
|
133
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.1.tgz",
|
|
134
|
+
"integrity": "sha512-tRHnxWJnvNnDpNVnsyDhr1DIQZUfCXlHSCDohbXFqmg9W4kKR7g8LmA3kzcwbuxbRMKeit8ladnCabU5f2traA==",
|
|
135
|
+
"cpu": [
|
|
136
|
+
"arm"
|
|
137
|
+
],
|
|
138
|
+
"optional": true,
|
|
139
|
+
"os": [
|
|
140
|
+
"linux"
|
|
141
|
+
],
|
|
142
|
+
"engines": {
|
|
143
|
+
"node": ">=12"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"node_modules/@esbuild/linux-arm64": {
|
|
147
|
+
"version": "0.21.1",
|
|
148
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.1.tgz",
|
|
149
|
+
"integrity": "sha512-G65d08YoH00TL7Xg4LaL3gLV21bpoAhQ+r31NUu013YB7KK0fyXIt05VbsJtpqh/6wWxoLJZOvQHYnodRrnbUQ==",
|
|
150
|
+
"cpu": [
|
|
151
|
+
"arm64"
|
|
152
|
+
],
|
|
153
|
+
"optional": true,
|
|
154
|
+
"os": [
|
|
155
|
+
"linux"
|
|
156
|
+
],
|
|
157
|
+
"engines": {
|
|
158
|
+
"node": ">=12"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"node_modules/@esbuild/linux-ia32": {
|
|
162
|
+
"version": "0.21.1",
|
|
163
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.1.tgz",
|
|
164
|
+
"integrity": "sha512-tt/54LqNNAqCz++QhxoqB9+XqdsaZOtFD/srEhHYwBd3ZUOepmR1Eeot8bS+Q7BiEvy9vvKbtpHf+r6q8hF5UA==",
|
|
165
|
+
"cpu": [
|
|
166
|
+
"ia32"
|
|
167
|
+
],
|
|
168
|
+
"optional": true,
|
|
169
|
+
"os": [
|
|
170
|
+
"linux"
|
|
171
|
+
],
|
|
172
|
+
"engines": {
|
|
173
|
+
"node": ">=12"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"node_modules/@esbuild/linux-loong64": {
|
|
177
|
+
"version": "0.21.1",
|
|
178
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.1.tgz",
|
|
179
|
+
"integrity": "sha512-MhNalK6r0nZD0q8VzUBPwheHzXPr9wronqmZrewLfP7ui9Fv1tdPmg6e7A8lmg0ziQCziSDHxh3cyRt4YMhGnQ==",
|
|
180
|
+
"cpu": [
|
|
181
|
+
"loong64"
|
|
182
|
+
],
|
|
183
|
+
"optional": true,
|
|
184
|
+
"os": [
|
|
185
|
+
"linux"
|
|
186
|
+
],
|
|
187
|
+
"engines": {
|
|
188
|
+
"node": ">=12"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"node_modules/@esbuild/linux-mips64el": {
|
|
192
|
+
"version": "0.21.1",
|
|
193
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.1.tgz",
|
|
194
|
+
"integrity": "sha512-YCKVY7Zen5rwZV+nZczOhFmHaeIxR4Zn3jcmNH53LbgF6IKRwmrMywqDrg4SiSNApEefkAbPSIzN39FC8VsxPg==",
|
|
195
|
+
"cpu": [
|
|
196
|
+
"mips64el"
|
|
197
|
+
],
|
|
198
|
+
"optional": true,
|
|
199
|
+
"os": [
|
|
200
|
+
"linux"
|
|
201
|
+
],
|
|
202
|
+
"engines": {
|
|
203
|
+
"node": ">=12"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"node_modules/@esbuild/linux-ppc64": {
|
|
207
|
+
"version": "0.21.1",
|
|
208
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.1.tgz",
|
|
209
|
+
"integrity": "sha512-bw7bcQ+270IOzDV4mcsKAnDtAFqKO0jVv3IgRSd8iM0ac3L8amvCrujRVt1ajBTJcpDaFhIX+lCNRKteoDSLig==",
|
|
210
|
+
"cpu": [
|
|
211
|
+
"ppc64"
|
|
212
|
+
],
|
|
213
|
+
"optional": true,
|
|
214
|
+
"os": [
|
|
215
|
+
"linux"
|
|
216
|
+
],
|
|
217
|
+
"engines": {
|
|
218
|
+
"node": ">=12"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"node_modules/@esbuild/linux-riscv64": {
|
|
222
|
+
"version": "0.21.1",
|
|
223
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.1.tgz",
|
|
224
|
+
"integrity": "sha512-ARmDRNkcOGOm1AqUBSwRVDfDeD9hGYRfkudP2QdoonBz1ucWVnfBPfy7H4JPI14eYtZruRSczJxyu7SRYDVOcg==",
|
|
225
|
+
"cpu": [
|
|
226
|
+
"riscv64"
|
|
227
|
+
],
|
|
228
|
+
"optional": true,
|
|
229
|
+
"os": [
|
|
230
|
+
"linux"
|
|
231
|
+
],
|
|
232
|
+
"engines": {
|
|
233
|
+
"node": ">=12"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"node_modules/@esbuild/linux-s390x": {
|
|
237
|
+
"version": "0.21.1",
|
|
238
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.1.tgz",
|
|
239
|
+
"integrity": "sha512-o73TcUNMuoTZlhwFdsgr8SfQtmMV58sbgq6gQq9G1xUiYnHMTmJbwq65RzMx89l0iya69lR4bxBgtWiiOyDQZA==",
|
|
240
|
+
"cpu": [
|
|
241
|
+
"s390x"
|
|
242
|
+
],
|
|
243
|
+
"optional": true,
|
|
244
|
+
"os": [
|
|
245
|
+
"linux"
|
|
246
|
+
],
|
|
247
|
+
"engines": {
|
|
248
|
+
"node": ">=12"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"node_modules/@esbuild/linux-x64": {
|
|
252
|
+
"version": "0.21.1",
|
|
253
|
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.1.tgz",
|
|
254
|
+
"integrity": "sha512-da4/1mBJwwgJkbj4fMH7SOXq2zapgTo0LKXX1VUZ0Dxr+e8N0WbS80nSZ5+zf3lvpf8qxrkZdqkOqFfm57gXwA==",
|
|
255
|
+
"cpu": [
|
|
256
|
+
"x64"
|
|
257
|
+
],
|
|
258
|
+
"optional": true,
|
|
259
|
+
"os": [
|
|
260
|
+
"linux"
|
|
261
|
+
],
|
|
262
|
+
"engines": {
|
|
263
|
+
"node": ">=12"
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"node_modules/@esbuild/netbsd-x64": {
|
|
267
|
+
"version": "0.21.1",
|
|
268
|
+
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.1.tgz",
|
|
269
|
+
"integrity": "sha512-CPWs0HTFe5woTJN5eKPvgraUoRHrCtzlYIAv9wBC+FAyagBSaf+UdZrjwYyTGnwPGkThV4OCI7XibZOnPvONVw==",
|
|
270
|
+
"cpu": [
|
|
271
|
+
"x64"
|
|
272
|
+
],
|
|
273
|
+
"optional": true,
|
|
274
|
+
"os": [
|
|
275
|
+
"netbsd"
|
|
276
|
+
],
|
|
277
|
+
"engines": {
|
|
278
|
+
"node": ">=12"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"node_modules/@esbuild/openbsd-x64": {
|
|
282
|
+
"version": "0.21.1",
|
|
283
|
+
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.1.tgz",
|
|
284
|
+
"integrity": "sha512-xxhTm5QtzNLc24R0hEkcH+zCx/o49AsdFZ0Cy5zSd/5tOj4X2g3/2AJB625NoadUuc4A8B3TenLJoYdWYOYCew==",
|
|
285
|
+
"cpu": [
|
|
286
|
+
"x64"
|
|
287
|
+
],
|
|
288
|
+
"optional": true,
|
|
289
|
+
"os": [
|
|
290
|
+
"openbsd"
|
|
291
|
+
],
|
|
292
|
+
"engines": {
|
|
293
|
+
"node": ">=12"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"node_modules/@esbuild/sunos-x64": {
|
|
297
|
+
"version": "0.21.1",
|
|
298
|
+
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.1.tgz",
|
|
299
|
+
"integrity": "sha512-CWibXszpWys1pYmbr9UiKAkX6x+Sxw8HWtw1dRESK1dLW5fFJ6rMDVw0o8MbadusvVQx1a8xuOxnHXT941Hp1A==",
|
|
300
|
+
"cpu": [
|
|
301
|
+
"x64"
|
|
302
|
+
],
|
|
303
|
+
"optional": true,
|
|
304
|
+
"os": [
|
|
305
|
+
"sunos"
|
|
306
|
+
],
|
|
307
|
+
"engines": {
|
|
308
|
+
"node": ">=12"
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"node_modules/@esbuild/win32-arm64": {
|
|
312
|
+
"version": "0.21.1",
|
|
313
|
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.1.tgz",
|
|
314
|
+
"integrity": "sha512-jb5B4k+xkytGbGUS4T+Z89cQJ9DJ4lozGRSV+hhfmCPpfJ3880O31Q1srPCimm+V6UCbnigqD10EgDNgjvjerQ==",
|
|
315
|
+
"cpu": [
|
|
316
|
+
"arm64"
|
|
317
|
+
],
|
|
318
|
+
"optional": true,
|
|
319
|
+
"os": [
|
|
320
|
+
"win32"
|
|
321
|
+
],
|
|
322
|
+
"engines": {
|
|
323
|
+
"node": ">=12"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"node_modules/@esbuild/win32-ia32": {
|
|
327
|
+
"version": "0.21.1",
|
|
328
|
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.1.tgz",
|
|
329
|
+
"integrity": "sha512-PgyFvjJhXqHn1uxPhyN1wZ6dIomKjiLUQh1LjFvjiV1JmnkZ/oMPrfeEAZg5R/1ftz4LZWZr02kefNIQ5SKREQ==",
|
|
330
|
+
"cpu": [
|
|
331
|
+
"ia32"
|
|
332
|
+
],
|
|
333
|
+
"optional": true,
|
|
334
|
+
"os": [
|
|
335
|
+
"win32"
|
|
336
|
+
],
|
|
337
|
+
"engines": {
|
|
338
|
+
"node": ">=12"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"node_modules/@esbuild/win32-x64": {
|
|
342
|
+
"version": "0.21.1",
|
|
343
|
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.1.tgz",
|
|
344
|
+
"integrity": "sha512-W9NttRZQR5ehAiqHGDnvfDaGmQOm6Fi4vSlce8mjM75x//XKuVAByohlEX6N17yZnVXxQFuh4fDRunP8ca6bfA==",
|
|
345
|
+
"cpu": [
|
|
346
|
+
"x64"
|
|
347
|
+
],
|
|
348
|
+
"optional": true,
|
|
349
|
+
"os": [
|
|
350
|
+
"win32"
|
|
351
|
+
],
|
|
352
|
+
"engines": {
|
|
353
|
+
"node": ">=12"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"node_modules/esbuild": {
|
|
357
|
+
"version": "0.21.1",
|
|
358
|
+
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.1.tgz",
|
|
359
|
+
"integrity": "sha512-GPqx+FX7mdqulCeQ4TsGZQ3djBJkx5k7zBGtqt9ycVlWNg8llJ4RO9n2vciu8BN2zAEs6lPbPl0asZsAh7oWzg==",
|
|
360
|
+
"hasInstallScript": true,
|
|
361
|
+
"bin": {
|
|
362
|
+
"esbuild": "bin/esbuild"
|
|
363
|
+
},
|
|
364
|
+
"engines": {
|
|
365
|
+
"node": ">=12"
|
|
366
|
+
},
|
|
367
|
+
"optionalDependencies": {
|
|
368
|
+
"@esbuild/aix-ppc64": "0.21.1",
|
|
369
|
+
"@esbuild/android-arm": "0.21.1",
|
|
370
|
+
"@esbuild/android-arm64": "0.21.1",
|
|
371
|
+
"@esbuild/android-x64": "0.21.1",
|
|
372
|
+
"@esbuild/darwin-arm64": "0.21.1",
|
|
373
|
+
"@esbuild/darwin-x64": "0.21.1",
|
|
374
|
+
"@esbuild/freebsd-arm64": "0.21.1",
|
|
375
|
+
"@esbuild/freebsd-x64": "0.21.1",
|
|
376
|
+
"@esbuild/linux-arm": "0.21.1",
|
|
377
|
+
"@esbuild/linux-arm64": "0.21.1",
|
|
378
|
+
"@esbuild/linux-ia32": "0.21.1",
|
|
379
|
+
"@esbuild/linux-loong64": "0.21.1",
|
|
380
|
+
"@esbuild/linux-mips64el": "0.21.1",
|
|
381
|
+
"@esbuild/linux-ppc64": "0.21.1",
|
|
382
|
+
"@esbuild/linux-riscv64": "0.21.1",
|
|
383
|
+
"@esbuild/linux-s390x": "0.21.1",
|
|
384
|
+
"@esbuild/linux-x64": "0.21.1",
|
|
385
|
+
"@esbuild/netbsd-x64": "0.21.1",
|
|
386
|
+
"@esbuild/openbsd-x64": "0.21.1",
|
|
387
|
+
"@esbuild/sunos-x64": "0.21.1",
|
|
388
|
+
"@esbuild/win32-arm64": "0.21.1",
|
|
389
|
+
"@esbuild/win32-ia32": "0.21.1",
|
|
390
|
+
"@esbuild/win32-x64": "0.21.1"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm install --no-bin-links esbuild
|
package/core/.firefly/package.ff
CHANGED
package/lsp/Handler.ff
CHANGED
|
@@ -211,7 +211,7 @@ extend self: Handler {
|
|
|
211
211
|
let uri = parameters.grab("textDocument").field("uri").grabString()
|
|
212
212
|
let path = system.pathFromUrl(uri)
|
|
213
213
|
let fireflyPath = system.path(".")
|
|
214
|
-
let errors = self.check(system, fireflyPath, path, None, self.virtualFiles, version, LspHook.disabled(), True)
|
|
214
|
+
let errors = self.check(system, fireflyPath, path, None, Set.empty(), self.virtualFiles, version, LspHook.disabled(), True)
|
|
215
215
|
let diagnostics = errors.map {| CompileError(at, message) =>
|
|
216
216
|
let tokenLocation = self.findToken(system, at)
|
|
217
217
|
Json.object()
|
|
@@ -230,7 +230,7 @@ extend self: Handler {
|
|
|
230
230
|
let uri = parameters.grab("textDocument").field("uri").grabString()
|
|
231
231
|
let path = system.pathFromUrl(uri)
|
|
232
232
|
let fireflyPath = system.path(".")
|
|
233
|
-
let errors = self.check(system, fireflyPath, path, None, self.virtualFiles, version, LspHook.disabled(), True)
|
|
233
|
+
let errors = self.check(system, fireflyPath, path, None, Set.empty(), self.virtualFiles, version, LspHook.disabled(), True)
|
|
234
234
|
let diagnostics = errors.map {| CompileError(at, message) =>
|
|
235
235
|
let tokenLocation = self.findToken(system, at)
|
|
236
236
|
Json.object()
|
|
@@ -295,7 +295,7 @@ extend self: Handler {
|
|
|
295
295
|
|
|
296
296
|
handleWorkspaceSymbol(system: NodeSystem, parameters: Map[String, Json]): ResultOrError {
|
|
297
297
|
let query = parameters.grab("query").grabString()
|
|
298
|
-
let files = self.printTime(system.mainTask(), "findFireflyFiles") {Builder.findFireflyFiles(self.rootPath.grab(), None)}
|
|
298
|
+
let files = self.printTime(system.mainTask(), "findFireflyFiles") {Builder.findFireflyFiles(self.rootPath.grab(), None, Set.empty())}
|
|
299
299
|
let symbols = files.flatMap {file =>
|
|
300
300
|
let documentSymbols = self.getDocumentSymbolsWithCache(system, file)
|
|
301
301
|
let workspaceSymbols = documentSymbols.flatMap {SymbolHandler.documentToWorkspaceSymbols(_, None)}
|
|
@@ -314,9 +314,9 @@ extend self: Handler {
|
|
|
314
314
|
let creates = parameters.grab("changes").grabArray().filter {_.field("type").grabInt() == 1}
|
|
315
315
|
let changes = parameters.grab("changes").grabArray().filter {_.field("type").grabInt() == 2}
|
|
316
316
|
let deletes = parameters.grab("changes").grabArray().filter {_.field("type").grabInt() == 3}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
317
|
+
creates.map {_.field("uri").grabString()}.each {self.moduleCache.invalidate(system.pathFromUrl(_).absolute())}
|
|
318
|
+
changes.map {_.field("uri").grabString()}.each {self.moduleCache.invalidate(system.pathFromUrl(_).absolute())}
|
|
319
|
+
deletes.map {_.field("uri").grabString()}.each {self.moduleCache.invalidate(system.pathFromUrl(_).absolute())}
|
|
320
320
|
let diagnostics = self.handleClearDiagnostic(system, [Pair("files", Json.array(deletes))].toMap())
|
|
321
321
|
diagnostics.map {Pair("textDocument/publishDiagnostics", _)}
|
|
322
322
|
}
|
|
@@ -326,6 +326,7 @@ extend self: Handler {
|
|
|
326
326
|
let path = system.pathFromUrl(uri)
|
|
327
327
|
self.responseCache = Map.empty()
|
|
328
328
|
self.fileSymbolsCache = self.fileSymbolsCache.remove(path.absolute())
|
|
329
|
+
self.moduleCache.invalidate(path.absolute())
|
|
329
330
|
let contentChanges = parameters.grab("contentChanges").grabArray()
|
|
330
331
|
if(contentChanges.size() != 1) {throw(LanguageServerException("Expected a single element in contentChanges"))} else:
|
|
331
332
|
let contentChange = contentChanges.grab(0)
|
|
@@ -343,7 +344,7 @@ extend self: Handler {
|
|
|
343
344
|
handleHover(system: NodeSystem, targetAt: Location, goToDefinition: Bool, version: Int): ResultOrError {
|
|
344
345
|
let lspHook = LspHook.make(at = Some(targetAt), definedAt = None, insertIdentifier = False, trackSymbols = False)
|
|
345
346
|
let path = system.path(targetAt.file)
|
|
346
|
-
let errors = self.check(system, self.fireflyPath, path, None, self.virtualFiles, version, lspHook, True)
|
|
347
|
+
let errors = self.check(system, self.fireflyPath, path, None, Set.empty(), self.virtualFiles, version, lspHook, True)
|
|
347
348
|
errors.each {| CompileError(at, message) =>
|
|
348
349
|
Log.trace("handleHover check error: " + message)
|
|
349
350
|
}
|
|
@@ -365,7 +366,7 @@ extend self: Handler {
|
|
|
365
366
|
)
|
|
366
367
|
let lspHook = LspHook.make(at = Some(completionAt), definedAt = None, insertIdentifier = True, trackSymbols = False)
|
|
367
368
|
let path = system.path(completionAt.file)
|
|
368
|
-
let errors = self.check(system, self.fireflyPath, path, None, self.virtualFiles, version, lspHook, True)
|
|
369
|
+
let errors = self.check(system, self.fireflyPath, path, None, Set.empty(), self.virtualFiles, version, lspHook, True)
|
|
369
370
|
errors.each {| CompileError(at, message) =>
|
|
370
371
|
Log.trace("handleCompletion check error: " + message)
|
|
371
372
|
}
|
|
@@ -399,7 +400,7 @@ extend self: Handler {
|
|
|
399
400
|
| ParseArgumentHook h =>
|
|
400
401
|
let callLspHook = LspHook.make(at = Some(h.callAt), definedAt = None, insertIdentifier = False, trackSymbols = False)
|
|
401
402
|
let path = system.path(cursorAt.file)
|
|
402
|
-
let errors = self.check(system, self.fireflyPath, path, None, self.virtualFiles, version, callLspHook, True)
|
|
403
|
+
let errors = self.check(system, self.fireflyPath, path, None, Set.empty(), self.virtualFiles, version, callLspHook, True)
|
|
403
404
|
errors.each {| CompileError(at, message) =>
|
|
404
405
|
Log.trace("handleSignatureHelp check 2 error: " + message)
|
|
405
406
|
}
|
|
@@ -464,7 +465,7 @@ extend self: Handler {
|
|
|
464
465
|
): Option[List[TokenLocation]] {
|
|
465
466
|
let temporaryLspHook = LspHook.make(at = Some(targetAt), definedAt = None, insertIdentifier = False, trackSymbols = False)
|
|
466
467
|
let path = system.path(targetAt.file)
|
|
467
|
-
let errors = self.check(system, self.fireflyPath, path, None, self.virtualFiles, version, temporaryLspHook, True)
|
|
468
|
+
let errors = self.check(system, self.fireflyPath, path, None, Set.empty(), self.virtualFiles, version, temporaryLspHook, True)
|
|
468
469
|
errors.each {| CompileError(at, message) =>
|
|
469
470
|
Log.trace("findReferences first check error: " + message + " in " + at.file + ":" + at.line + ":" + at.column)
|
|
470
471
|
}
|
|
@@ -496,6 +497,16 @@ extend self: Handler {
|
|
|
496
497
|
qualifiedName.split('.').grabLast().split('_').grabLast()
|
|
497
498
|
}
|
|
498
499
|
|
|
500
|
+
function extractModuleName(qualifiedName: String): String {
|
|
501
|
+
qualifiedName.split('/').grabLast().takeWhile {c => c != '.' || c == '_'}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function extractPackagePair(qualifiedName: String): PackagePair {
|
|
505
|
+
let group = qualifiedName.split(':').grabFirst()
|
|
506
|
+
let name = qualifiedName.split(':').grabLast().takeWhile {_ != '/'}
|
|
507
|
+
PackagePair(group, name)
|
|
508
|
+
}
|
|
509
|
+
|
|
499
510
|
definedAtList.first().{
|
|
500
511
|
| Some(definition) =>
|
|
501
512
|
let lspHook = LspHook.make(at = None, definedAt = Some(definition.at), insertIdentifier = False, trackSymbols = False)
|
|
@@ -505,7 +516,19 @@ extend self: Handler {
|
|
|
505
516
|
Log.trace("findReferences definition: " + Show.show(definition))
|
|
506
517
|
mustContain.each {Log.trace("mustContain: " + _)}
|
|
507
518
|
|
|
508
|
-
let
|
|
519
|
+
let skipFiles = if(definition.name.contains(":")) {
|
|
520
|
+
let list = self.moduleCache.filesNotImporting(extractPackagePair(definition.name), extractModuleName(definition.name))
|
|
521
|
+
list.toSet()
|
|
522
|
+
} else {
|
|
523
|
+
self.moduleCache.parsedModules.get(definition.at.file).map {| Pair(module, _) =>
|
|
524
|
+
let list = self.moduleCache.filesNotImporting(module.packagePair, module.file.dropLast(3))
|
|
525
|
+
list.toSet()
|
|
526
|
+
}.else {
|
|
527
|
+
Log.trace("No skip list due to unqualified definition.name: " + definition.name)
|
|
528
|
+
Set.empty()
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
let errors = self.check(system, self.fireflyPath, path, mustContain, skipFiles, self.virtualFiles, version, lspHook, True, False)
|
|
509
532
|
errors.each {| CompileError(at, message) =>
|
|
510
533
|
Log.trace("findReferences second check error: " + message + " in " + at.file + ":" + at.line + ":" + at.column)
|
|
511
534
|
}
|
|
@@ -646,6 +669,7 @@ extend self: Handler {
|
|
|
646
669
|
fireflyPath: Path
|
|
647
670
|
path: Path
|
|
648
671
|
mustContain: Option[String]
|
|
672
|
+
skipFiles: Set[String]
|
|
649
673
|
virtualFiles: Map[String, String]
|
|
650
674
|
newModuleCacheVersion: Int
|
|
651
675
|
lspHook: LspHook
|
|
@@ -657,6 +681,7 @@ extend self: Handler {
|
|
|
657
681
|
fireflyPath
|
|
658
682
|
path
|
|
659
683
|
mustContain
|
|
684
|
+
skipFiles
|
|
660
685
|
virtualFiles
|
|
661
686
|
self.moduleCache
|
|
662
687
|
newModuleCacheVersion
|
|
@@ -166,10 +166,10 @@ return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.pac
|
|
|
166
166
|
}))(resolvedDependencies_), ff_core_Option.None(), ff_core_NodeSystem.NodeSystem_path(system_, ".firefly/temporary"), ff_core_Path.Path_slash(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly/output"), target_), false, ff_compiler_ModuleCache.empty_(0))
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
export function check_(system_, fireflyPath_, path_, mustContain_, virtualFiles_, cache_, newVersion_, lspHook_, infer_, checkDependencies_) {
|
|
169
|
+
export function check_(system_, fireflyPath_, path_, mustContain_, skipFiles_, virtualFiles_, cache_, newVersion_, lspHook_, infer_, checkDependencies_) {
|
|
170
170
|
const packages_ = (((_1) => {
|
|
171
171
|
if(_1) {
|
|
172
|
-
return ff_compiler_Builder.findPackageFiles_(path_, mustContain_)
|
|
172
|
+
return ff_compiler_Builder.findPackageFiles_(path_, mustContain_, skipFiles_)
|
|
173
173
|
}
|
|
174
174
|
if(!_1 && ff_core_Path.Path_endsWith(path_, [".firefly", "package.ff"])) {
|
|
175
175
|
return [ff_compiler_Builder.PackageFiles(ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_)), ff_core_Option.Some(path_), [])]
|
|
@@ -221,8 +221,8 @@ ff_compiler_ModuleCache.ModuleCache_mergeVersions(cache_, compiler_.cache_)
|
|
|
221
221
|
return ff_core_Array.Array_drain(errors_)
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
export function findPackageFiles_(path_, mustContain_) {
|
|
225
|
-
const files_ = ff_compiler_Builder.findFireflyFiles_(path_, mustContain_);
|
|
224
|
+
export function findPackageFiles_(path_, mustContain_, skipFiles_) {
|
|
225
|
+
const files_ = ff_compiler_Builder.findFireflyFiles_(path_, mustContain_, skipFiles_);
|
|
226
226
|
const split_ = ff_core_List.List_partition(files_, ((_w1) => {
|
|
227
227
|
return ff_core_Path.Path_endsWith(_w1, [".firefly", "package.ff"])
|
|
228
228
|
}));
|
|
@@ -243,7 +243,7 @@ return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.None(), [fi
|
|
|
243
243
|
return [...multiFileProjects_, ...singleFileProjects_]
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
export function findFireflyFiles_(path_, mustContain_) {
|
|
246
|
+
export function findFireflyFiles_(path_, mustContain_, skipFiles_) {
|
|
247
247
|
const split_ = ff_core_List.List_partition(ff_core_Stream.Stream_toList(ff_core_Path.Path_entries(path_)), ((_w1) => {
|
|
248
248
|
return ff_core_Path.PathEntry_isDirectory(_w1)
|
|
249
249
|
}));
|
|
@@ -257,12 +257,12 @@ return (((c_ === 46) || ff_core_Char.Char_isAsciiLower(c_)) || ff_core_Char.Char
|
|
|
257
257
|
const fireflyFiles_ = ff_core_List.List_filter(ff_core_List.List_map(split_.second_, ((_w1) => {
|
|
258
258
|
return ff_core_Path.PathEntry_path(_w1)
|
|
259
259
|
})), ((file_) => {
|
|
260
|
-
return ((ff_core_Path.Path_extension(file_) === ".ff") && ff_core_Option.Option_all(mustContain_, ((s_) => {
|
|
260
|
+
return (((ff_core_Path.Path_extension(file_) === ".ff") && (!ff_core_Set.Set_contains(skipFiles_, ff_core_Path.Path_absolute(file_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))) && ff_core_Option.Option_all(mustContain_, ((s_) => {
|
|
261
261
|
return ff_core_String.String_contains(ff_core_Path.Path_readText(file_), s_)
|
|
262
262
|
})))
|
|
263
263
|
}));
|
|
264
264
|
return [...fireflyFiles_, ...ff_core_List.List_flatMap(directories_, ((_w1) => {
|
|
265
|
-
return ff_compiler_Builder.findFireflyFiles_(_w1, mustContain_)
|
|
265
|
+
return ff_compiler_Builder.findFireflyFiles_(_w1, mustContain_, skipFiles_)
|
|
266
266
|
}))]
|
|
267
267
|
}
|
|
268
268
|
|
|
@@ -355,10 +355,10 @@ return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.pac
|
|
|
355
355
|
}))(resolvedDependencies_), ff_core_Option.None(), (await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly/temporary", $task)), (await ff_core_Path.Path_slash$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly/output", $task)), target_, $task)), false, ff_compiler_ModuleCache.empty_(0), $task))
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
export async function check_$(system_, fireflyPath_, path_, mustContain_, virtualFiles_, cache_, newVersion_, lspHook_, infer_, checkDependencies_, $task) {
|
|
358
|
+
export async function check_$(system_, fireflyPath_, path_, mustContain_, skipFiles_, virtualFiles_, cache_, newVersion_, lspHook_, infer_, checkDependencies_, $task) {
|
|
359
359
|
const packages_ = (await ((async (_1, $task) => {
|
|
360
360
|
if(_1) {
|
|
361
|
-
return (await ff_compiler_Builder.findPackageFiles_$(path_, mustContain_, $task))
|
|
361
|
+
return (await ff_compiler_Builder.findPackageFiles_$(path_, mustContain_, skipFiles_, $task))
|
|
362
362
|
}
|
|
363
363
|
if(!_1 && (await ff_core_Path.Path_endsWith$(path_, [".firefly", "package.ff"], $task))) {
|
|
364
364
|
return [ff_compiler_Builder.PackageFiles(ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task))), ff_core_Option.Some(path_), [])]
|
|
@@ -410,8 +410,8 @@ ff_compiler_ModuleCache.ModuleCache_mergeVersions(cache_, compiler_.cache_)
|
|
|
410
410
|
return ff_core_Array.Array_drain(errors_)
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
export async function findPackageFiles_$(path_, mustContain_, $task) {
|
|
414
|
-
const files_ = (await ff_compiler_Builder.findFireflyFiles_$(path_, mustContain_, $task));
|
|
413
|
+
export async function findPackageFiles_$(path_, mustContain_, skipFiles_, $task) {
|
|
414
|
+
const files_ = (await ff_compiler_Builder.findFireflyFiles_$(path_, mustContain_, skipFiles_, $task));
|
|
415
415
|
const split_ = (await ff_core_List.List_partition$(files_, (async (_w1, $task) => {
|
|
416
416
|
return (await ff_core_Path.Path_endsWith$(_w1, [".firefly", "package.ff"], $task))
|
|
417
417
|
}), $task));
|
|
@@ -432,7 +432,7 @@ return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.None(), [fi
|
|
|
432
432
|
return [...multiFileProjects_, ...singleFileProjects_]
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
export async function findFireflyFiles_$(path_, mustContain_, $task) {
|
|
435
|
+
export async function findFireflyFiles_$(path_, mustContain_, skipFiles_, $task) {
|
|
436
436
|
const split_ = (await ff_core_List.List_partition$((await ff_core_Stream.Stream_toList$((await ff_core_Path.Path_entries$(path_, $task)), $task)), (async (_w1, $task) => {
|
|
437
437
|
return (await ff_core_Path.PathEntry_isDirectory$(_w1, $task))
|
|
438
438
|
}), $task));
|
|
@@ -446,12 +446,12 @@ return (((c_ === 46) || ff_core_Char.Char_isAsciiLower(c_)) || ff_core_Char.Char
|
|
|
446
446
|
const fireflyFiles_ = (await ff_core_List.List_filter$((await ff_core_List.List_map$(split_.second_, (async (_w1, $task) => {
|
|
447
447
|
return (await ff_core_Path.PathEntry_path$(_w1, $task))
|
|
448
448
|
}), $task)), (async (file_, $task) => {
|
|
449
|
-
return (((await ff_core_Path.Path_extension$(file_, $task)) === ".ff") && (await ff_core_Option.Option_all$(mustContain_, (async (s_, $task) => {
|
|
449
|
+
return ((((await ff_core_Path.Path_extension$(file_, $task)) === ".ff") && (!ff_core_Set.Set_contains(skipFiles_, (await ff_core_Path.Path_absolute$(file_, $task)), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))) && (await ff_core_Option.Option_all$(mustContain_, (async (s_, $task) => {
|
|
450
450
|
return ff_core_String.String_contains((await ff_core_Path.Path_readText$(file_, $task)), s_)
|
|
451
451
|
}), $task)))
|
|
452
452
|
}), $task));
|
|
453
453
|
return [...fireflyFiles_, ...(await ff_core_List.List_flatMap$(directories_, (async (_w1, $task) => {
|
|
454
|
-
return (await ff_compiler_Builder.findFireflyFiles_$(_w1, mustContain_, $task))
|
|
454
|
+
return (await ff_compiler_Builder.findFireflyFiles_$(_w1, mustContain_, skipFiles_, $task))
|
|
455
455
|
}), $task))]
|
|
456
456
|
}
|
|
457
457
|
|
|
@@ -212,7 +212,7 @@ return
|
|
|
212
212
|
}
|
|
213
213
|
if(command_a.CheckCommand) {
|
|
214
214
|
const filePath_ = command_a.filePath_;
|
|
215
|
-
const errors_ = ff_compiler_Builder.check_(system_, fireflyPath_, ff_core_NodeSystem.NodeSystem_path(system_, filePath_), ff_core_Option.None(), ff_core_Map.empty_(), ff_compiler_ModuleCache.empty_(1), 0, ff_compiler_LspHook.disabled_(), true, false);
|
|
215
|
+
const errors_ = ff_compiler_Builder.check_(system_, fireflyPath_, ff_core_NodeSystem.NodeSystem_path(system_, filePath_), ff_core_Option.None(), ff_core_Set.empty_(), ff_core_Map.empty_(), ff_compiler_ModuleCache.empty_(1), 0, ff_compiler_LspHook.disabled_(), true, false);
|
|
216
216
|
if((!ff_core_List.List_isEmpty(errors_))) {
|
|
217
217
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_distinct(errors_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_CompileError)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
|
|
218
218
|
}
|
|
@@ -220,7 +220,8 @@ return
|
|
|
220
220
|
}
|
|
221
221
|
if(command_a.BootstrapCommand) {
|
|
222
222
|
const workingDirectory_ = ff_core_NodeSystem.NodeSystem_path(system_, ".");
|
|
223
|
-
|
|
223
|
+
const fakeLocation_ = ff_compiler_Syntax.Location("<core>", 0, 0);
|
|
224
|
+
ff_compiler_Builder.build_(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), "Main", ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.PackageInfo(ff_compiler_Syntax.DPackage(fakeLocation_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(fakeLocation_, 0, 0, 0), ff_compiler_Syntax.TargetNames(true, false)), [], [ff_compiler_Syntax.DInclude(fakeLocation_, "node_modules")]))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_Path.Path_slash(workingDirectory_, "compiler")), ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_core_Path.Path_slash(workingDirectory_, "core"))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "temporary"), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "js"), true, ff_compiler_ModuleCache.empty_(0))
|
|
224
225
|
return
|
|
225
226
|
}
|
|
226
227
|
}
|
|
@@ -459,7 +460,7 @@ return
|
|
|
459
460
|
}
|
|
460
461
|
if(command_a.CheckCommand) {
|
|
461
462
|
const filePath_ = command_a.filePath_;
|
|
462
|
-
const errors_ = (await ff_compiler_Builder.check_$(system_, fireflyPath_, (await ff_core_NodeSystem.NodeSystem_path$(system_, filePath_, $task)), ff_core_Option.None(), ff_core_Map.empty_(), ff_compiler_ModuleCache.empty_(1), 0, ff_compiler_LspHook.disabled_(), true, false, $task));
|
|
463
|
+
const errors_ = (await ff_compiler_Builder.check_$(system_, fireflyPath_, (await ff_core_NodeSystem.NodeSystem_path$(system_, filePath_, $task)), ff_core_Option.None(), ff_core_Set.empty_(), ff_core_Map.empty_(), ff_compiler_ModuleCache.empty_(1), 0, ff_compiler_LspHook.disabled_(), true, false, $task));
|
|
463
464
|
if((!ff_core_List.List_isEmpty(errors_))) {
|
|
464
465
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_distinct(errors_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_CompileError)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
|
|
465
466
|
}
|
|
@@ -467,7 +468,8 @@ return
|
|
|
467
468
|
}
|
|
468
469
|
if(command_a.BootstrapCommand) {
|
|
469
470
|
const workingDirectory_ = (await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task));
|
|
470
|
-
|
|
471
|
+
const fakeLocation_ = ff_compiler_Syntax.Location("<core>", 0, 0);
|
|
472
|
+
(await ff_compiler_Builder.build_$(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), "Main", ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.PackageInfo(ff_compiler_Syntax.DPackage(fakeLocation_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(fakeLocation_, 0, 0, 0), ff_compiler_Syntax.TargetNames(true, false)), [], [ff_compiler_Syntax.DInclude(fakeLocation_, "node_modules")]))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), (await ff_core_Path.Path_slash$(workingDirectory_, "compiler", $task))), ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), (await ff_core_Path.Path_slash$(workingDirectory_, "core", $task)))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "temporary", $task)), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "js", $task)), true, ff_compiler_ModuleCache.empty_(0), $task))
|
|
471
473
|
return
|
|
472
474
|
}
|
|
473
475
|
}
|
|
@@ -147,11 +147,8 @@ const file_ = (moduleName_ + ".ff");
|
|
|
147
147
|
return (await ff_core_Path.Path_slash$(packagePath_, file_, $task))
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
export function ModuleCache_remove(self_,
|
|
151
|
-
if((!ff_core_List.List_isEmpty(
|
|
152
|
-
const keys_ = ff_core_List.List_map(paths_, ((_w1) => {
|
|
153
|
-
return ff_core_Path.Path_absolute(_w1)
|
|
154
|
-
}));
|
|
150
|
+
export function ModuleCache_remove(self_, keys_) {
|
|
151
|
+
if((!ff_core_List.List_isEmpty(keys_))) {
|
|
155
152
|
self_.parsedModules_ = ff_core_Map.Map_removeList(self_.parsedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
156
153
|
self_.resolvedModules_ = ff_core_Map.Map_removeList(self_.resolvedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
157
154
|
self_.derivedModules_ = ff_core_Map.Map_removeList(self_.derivedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
@@ -160,6 +157,44 @@ self_.emittedModules_ = ff_core_Map.Map_removeList(self_.emittedModules_, keys_,
|
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
159
|
|
|
160
|
+
export function ModuleCache_invalidate(self_, key_) {
|
|
161
|
+
ff_core_Option.Option_each(ff_core_Map.Map_get(self_.parsedModules_, key_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
|
|
162
|
+
{
|
|
163
|
+
const module_ = _1.first_;
|
|
164
|
+
const moduleName_ = ff_core_String.String_dropLast(module_.file_, 3);
|
|
165
|
+
ff_compiler_ModuleCache.ModuleCache_remove(self_, [key_]);
|
|
166
|
+
ff_core_Map.Map_each(self_.parsedModules_, ((_1, _2) => {
|
|
167
|
+
{
|
|
168
|
+
const k_ = _1;
|
|
169
|
+
const m_ = _2.first_;
|
|
170
|
+
if(ff_core_List.List_any(m_.imports_, ((i_) => {
|
|
171
|
+
return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(i_.package_, module_.packagePair_) && (i_.file_ === moduleName_))
|
|
172
|
+
}))) {
|
|
173
|
+
ff_compiler_ModuleCache.ModuleCache_remove(self_, [k_])
|
|
174
|
+
}
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
|
|
178
|
+
return
|
|
179
|
+
}
|
|
180
|
+
}))
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function ModuleCache_filesNotImporting(self_, packagePair_, moduleName_) {
|
|
184
|
+
return ff_core_List.List_collect(ff_core_Map.Map_toList(self_.parsedModules_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
|
|
185
|
+
{
|
|
186
|
+
const k_ = _1.first_;
|
|
187
|
+
const m_ = _1.second_.first_;
|
|
188
|
+
if((!ff_core_List.List_any(m_.imports_, ((i_) => {
|
|
189
|
+
return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(i_.package_, packagePair_) && (i_.file_ === moduleName_))
|
|
190
|
+
})))) {
|
|
191
|
+
return ff_core_Option.Some(k_)
|
|
192
|
+
} else return ff_core_Option.None()
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
}))
|
|
196
|
+
}
|
|
197
|
+
|
|
163
198
|
export function ModuleCache_without(self_, newVersion_, path_) {
|
|
164
199
|
const key_ = ff_core_Path.Path_absolute(path_);
|
|
165
200
|
if(ff_core_Path.Path_isFile(path_)) {
|
|
@@ -285,11 +320,8 @@ ff_core_Error.Error_rethrow(error_)
|
|
|
285
320
|
}
|
|
286
321
|
}
|
|
287
322
|
|
|
288
|
-
export async function ModuleCache_remove$(self_,
|
|
289
|
-
if((!ff_core_List.List_isEmpty(
|
|
290
|
-
const keys_ = (await ff_core_List.List_map$(paths_, (async (_w1, $task) => {
|
|
291
|
-
return (await ff_core_Path.Path_absolute$(_w1, $task))
|
|
292
|
-
}), $task));
|
|
323
|
+
export async function ModuleCache_remove$(self_, keys_, $task) {
|
|
324
|
+
if((!ff_core_List.List_isEmpty(keys_))) {
|
|
293
325
|
self_.parsedModules_ = ff_core_Map.Map_removeList(self_.parsedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
294
326
|
self_.resolvedModules_ = ff_core_Map.Map_removeList(self_.resolvedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
295
327
|
self_.derivedModules_ = ff_core_Map.Map_removeList(self_.derivedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
@@ -298,6 +330,44 @@ self_.emittedModules_ = ff_core_Map.Map_removeList(self_.emittedModules_, keys_,
|
|
|
298
330
|
}
|
|
299
331
|
}
|
|
300
332
|
|
|
333
|
+
export async function ModuleCache_invalidate$(self_, key_, $task) {
|
|
334
|
+
ff_core_Option.Option_each(ff_core_Map.Map_get(self_.parsedModules_, key_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
|
|
335
|
+
{
|
|
336
|
+
const module_ = _1.first_;
|
|
337
|
+
const moduleName_ = ff_core_String.String_dropLast(module_.file_, 3);
|
|
338
|
+
ff_compiler_ModuleCache.ModuleCache_remove(self_, [key_]);
|
|
339
|
+
ff_core_Map.Map_each(self_.parsedModules_, ((_1, _2) => {
|
|
340
|
+
{
|
|
341
|
+
const k_ = _1;
|
|
342
|
+
const m_ = _2.first_;
|
|
343
|
+
if(ff_core_List.List_any(m_.imports_, ((i_) => {
|
|
344
|
+
return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(i_.package_, module_.packagePair_) && (i_.file_ === moduleName_))
|
|
345
|
+
}))) {
|
|
346
|
+
ff_compiler_ModuleCache.ModuleCache_remove(self_, [k_])
|
|
347
|
+
}
|
|
348
|
+
return
|
|
349
|
+
}
|
|
350
|
+
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
|
|
351
|
+
return
|
|
352
|
+
}
|
|
353
|
+
}))
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export async function ModuleCache_filesNotImporting$(self_, packagePair_, moduleName_, $task) {
|
|
357
|
+
return ff_core_List.List_collect(ff_core_Map.Map_toList(self_.parsedModules_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
|
|
358
|
+
{
|
|
359
|
+
const k_ = _1.first_;
|
|
360
|
+
const m_ = _1.second_.first_;
|
|
361
|
+
if((!ff_core_List.List_any(m_.imports_, ((i_) => {
|
|
362
|
+
return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(i_.package_, packagePair_) && (i_.file_ === moduleName_))
|
|
363
|
+
})))) {
|
|
364
|
+
return ff_core_Option.Some(k_)
|
|
365
|
+
} else return ff_core_Option.None()
|
|
366
|
+
return
|
|
367
|
+
}
|
|
368
|
+
}))
|
|
369
|
+
}
|
|
370
|
+
|
|
301
371
|
export async function ModuleCache_without$(self_, newVersion_, path_, $task) {
|
|
302
372
|
const key_ = (await ff_core_Path.Path_absolute$(path_, $task));
|
|
303
373
|
if((await ff_core_Path.Path_isFile$(path_, $task))) {
|
package/package.json
CHANGED
|
@@ -4,22 +4,21 @@
|
|
|
4
4
|
"description": "Firefly compiler",
|
|
5
5
|
"author": "Firefly team",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"version": "0.4.
|
|
7
|
+
"version": "0.4.29",
|
|
8
8
|
"repository": {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/Ahnfelt/firefly-boot"
|
|
11
11
|
},
|
|
12
12
|
"publisher": "firefly-team",
|
|
13
13
|
"categories": [
|
|
14
|
-
|
|
14
|
+
"Programming Languages"
|
|
15
15
|
],
|
|
16
16
|
"engines": {
|
|
17
|
-
|
|
17
|
+
"node": ">=18.0.0"
|
|
18
18
|
},
|
|
19
19
|
"main": "./vscode/client/out/extension",
|
|
20
20
|
"icon": "./vscode/icons/firefly-logo.png",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"esbuild": "^0.14.54",
|
|
23
22
|
"pkg": "^5.8.0",
|
|
24
23
|
"tar": "^6.1.11"
|
|
25
24
|
},
|
|
@@ -37,6 +37,20 @@
|
|
|
37
37
|
"decreaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*[\\)\\}\\]|].*$"
|
|
38
38
|
},
|
|
39
39
|
"onEnterRules": [
|
|
40
|
+
{
|
|
41
|
+
"beforeText": "\\.{\\s*$",
|
|
42
|
+
"action": {
|
|
43
|
+
"appendText": "| ",
|
|
44
|
+
"indent": "indent"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"beforeText": "^\\s*",
|
|
49
|
+
"afterText": "\\s*\\|",
|
|
50
|
+
"action": {
|
|
51
|
+
"indent": "none"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
40
54
|
{
|
|
41
55
|
"beforeText": "({|=>)\\s*$",
|
|
42
56
|
"afterText": "^\\s*}",
|