Publish 1.4.0-beta-001

This commit is contained in:
Alfonso Garcia-Caro
2021-11-17 13:53:18 +09:00
parent 60a1f8e74e
commit 01737b4d03
13 changed files with 35 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fable": {
"version": "3.3.0",
"version": "3.6.0-beta-003",
"commands": [
"fable"
]

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ build/test/*
build/sample/*
build/docs/*
dist/
*.fs.js
.idea/

View File

@@ -8,7 +8,7 @@ open Lit
open Lit.Elmish
module Helpers =
let hmr = HMR.createToken(true)
let hmr = HMR.createToken()
type Time =
| Hour of int

View File

@@ -3,7 +3,7 @@ module Sample.Components
open Browser.Types
open Lit
let private hmr = HMR.createToken(true)
let private hmr = HMR.createToken()
module ReactLib =
open Feliz

View File

@@ -15,7 +15,7 @@
<ItemGroup>
<!-- <PackageReference Include="Fable.Lit.Elmish" Version="1.0.0-rc-001" /> -->
<!-- <PackageReference Include="Fable.Lit.React" Version="1.0.0-rc-001" /> -->
<PackageReference Include="Fable.Elmish.HMR" Version="4.3.0" />
<PackageReference Include="Fable.Elmish.HMR" Version="4.3.1" />
<PackageReference Include="Feliz" Version="1.52.0" />
</ItemGroup>
</Project>

View File

@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<PackageId>ConstructStyleSheetsPolyfill</PackageId>
<Version>1.0.0</Version>
<PackageVersion>1.0.0-beta-001</PackageVersion>

View File

@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<PackageId>Fable.Lit.Elmish</PackageId>
<Version>1.4.0</Version>
<PackageVersion>1.4.0</PackageVersion>

View File

@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<PackageId>Fable.Lit.Feliz</PackageId>
<Version>1.0.0</Version>
<PackageVersion>1.0.0-beta-004</PackageVersion>

View File

@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<PackageId>Fable.Lit.React</PackageId>
<Version>1.0.0</Version>
<PackageVersion>1.0.0-rc-001</PackageVersion>

View File

@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<PackageId>Fable.Lit.Test</PackageId>
<Version>1.3.1</Version>
<PackageVersion>1.3.1</PackageVersion>

View File

@@ -1,10 +1,10 @@
namespace Lit
open System
open System.Runtime.InteropServices
open System.Collections.Generic
open Fable.Core
open Fable.Core.JsInterop
open Fable.Core.DynamicExtensions
open Browser
module HMRTypes =
@@ -63,6 +63,8 @@ module HMRTypes =
interface IHMRToken
member val TriggeredByDependency = false with get, set
member _.Subscribe(handler: HMRInfo -> unit) =
let guid = Guid.NewGuid()
listeners.Add(guid, handler)
@@ -86,6 +88,7 @@ module HMRTypes =
match moduleUrl.IndexOf("?") with
| -1 -> moduleUrl
| i -> moduleUrl.[..i-1]
// import.meta.hot.data only works with Vite so we use a global object
let dic = getOrAdd window GLOBAL_KEY obj
getOrAdd dic moduleUrl HMRToken
@@ -111,14 +114,24 @@ type HMR =
///
/// > If you're having issues with HMR you can pass `active=false` to force page reload.
/// > When compiling in non-debug mode, this has no effect.
static member inline createToken(active: bool): IHMRToken =
static member inline createToken([<Optional; DefaultParameterValue(true)>] active: bool): IHMRToken =
#if !DEBUG
unbox ()
#else
let mutable token = Unchecked.defaultof<_>
try
token <- HMRToken.Get(importMetaUrl)
HMR.activateToken(active, token.RequestUpdate)
// Because the code within import.meta.hot.accept(m => ...) is not updated immediately
// we need to set this outside, and use a reference (token) that is kept across hot updates
token.TriggeredByDependency <- Compiler.triggeredByDependency
HMR.activateToken(active, fun newModule ->
// If the file is recompiled not by a direct change but because of a dependency,
// we shouldn't request an update as this usually resets the components we want HMR for.
// See: https://github.com/fable-compiler/Fable/issues/2617
// It's important we **accept** the hot reload but **do nothing** in that case
// If we don't accept the hot reload, Vite will trigger a full reload
if not token.TriggeredByDependency then
token.RequestUpdate newModule)
with _ -> ()
upcast token
#endif

View File

@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<PackageId>Fable.Lit</PackageId>
<Version>1.3.2</Version>
<PackageVersion>1.3.2</PackageVersion>
<Version>1.4.0</Version>
<PackageVersion>1.4.0-beta-001</PackageVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NpmDependencies>
@@ -20,8 +21,9 @@
<Content Include="*.fsproj; *.fs; package.json" PackagePath="fable\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="5.0.0" />
<PackageReference Include="Fable.Core" Version="3.6.0-beta-001" />
<PackageReference Include="Fable.Browser.Dom" Version="2.5.0" />
<PackageReference Include="Fable.Core" Version="3.3.1" />
<PackageReference Include="Fable.Promise" Version="3.1.0" />
</ItemGroup>
</Project>

View File

@@ -1,3 +1,7 @@
### 1.4.0-beta-001
* Make Hook.useHmr work with multiple components
### 1.3.2
* HMR improvements