Skip to content

Commit

Permalink
feat: fix fable-compiler-js when run from NPM (#3795)
Browse files Browse the repository at this point in the history
* `--version` is working but can't compile yet

* feat: return the current directory inode insead of an empty string if the provided path is just a filename

* chore: update changelog
  • Loading branch information
MangelMaxime authored May 23, 2024
1 parent 6a8f4e4 commit fade279
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 37 deletions.
10 changes: 10 additions & 0 deletions src/fable-compiler-js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Changed

* Use `@fable-org/fable-metadata` package instead of `fable-metadata` (by @MangelMaxime)
* Use `@fable-org/fable-standalone` package instead of `fable-standalone` (by @MangelMaxime)
* Make `GetDirectoryName` return `"."` instead of `""` if the path doesn't contain any directory (by @MangelMaxime)

### Fixed

* Fix initialization of `fable-standalone` with the new package format (by @MangelMaxime)

## 1.1.0 - 2024-02-20

* Add `NPM_PACKAGE_FABLE_COMPILER_JAVASCRIPT` compiler directive (by @MangelMaxime)
Expand Down
44 changes: 22 additions & 22 deletions src/fable-compiler-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/fable-compiler-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
},
"homepage": "https://github.com/fable-compiler/Fable#readme",
"dependencies": {
"fable-metadata": "^2.0.0",
"fable-standalone": "^3.0.0"
"@fable-org/fable-metadata": "^1.0.0",
"@fable-org/fable-standalone": "^1.4.0"
},
"devDependencies": {
"esbuild": "^0.19.5",
Expand Down
2 changes: 1 addition & 1 deletion src/fable-compiler-js/src/Platform.fs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ module Path =
let i = normPath.LastIndexOf('/')

if i < 0 then
""
"."
else
normPath.Substring(0, i)
12 changes: 10 additions & 2 deletions src/fable-compiler-js/src/app.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ let getMetadataDir () : string =
let getFableLibDir () : string = importMember "./util.js"
let getVersion () : string = importMember "./util.js"

let initFable () : Fable.Standalone.IFableManager =
import "init" "@fable-org/fable-standalone"
type IFableInit =
abstract member init: unit -> Fable.Standalone.IFableManager

// Make __FABLE_STANDALONE__ available in the global scope
importSideEffects "@fable-org/fable-standalone"

[<Global("__FABLE_STANDALONE__")>]
let FableInit: IFableInit = jsNative

let initFable () : Fable.Standalone.IFableManager = FableInit.init ()
#endif

let references = Fable.Metadata.coreAssemblies
Expand Down
4 changes: 4 additions & 0 deletions src/fable-metadata/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed

* Make `dirname-filename-esm` a `dependency` instead of a `devDependency`

## 1.0.0 - 2024-02-12

* Release stable version
Expand Down
16 changes: 7 additions & 9 deletions src/fable-metadata/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/fable-metadata/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"author": ".NET Foundation and Contributors",
"license": "MIT",
"devDependencies": {
"dependencies": {
"dirname-filename-esm": "^1.1.1"
}
}
4 changes: 4 additions & 0 deletions src/fable-standalone/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed

* Make `dirname-filename-esm` a `dependency` instead of a `devDependency`

## 1.5.0 - 2024-03-20

### Changed
Expand Down

0 comments on commit fade279

Please sign in to comment.