-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
173 changed files
with
43,106 additions
and
21,971 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: web | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: 'pages' | ||
cancel-in-progress: false | ||
|
||
on: | ||
pull_request: | ||
push: | ||
paths-ignore: | ||
- '.github/ISSUE_TEMPLATE/**' | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
web: | ||
name: web | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: current | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
working-directory: web/features | ||
|
||
- name: Build project | ||
run: npm run build | ||
working-directory: web/features | ||
|
||
- name: Stage website | ||
run: | | ||
mkdir -p web/build/features | ||
cp -r web/features/build/* web/build/features | ||
if: github.event_name != 'pull_request' | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: web/build | ||
if: github.event_name != 'pull_request' | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v4 | ||
if: github.event_name != 'pull_request' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
use super::*; | ||
use rust::cfg::*; | ||
use serde::Serialize; | ||
use std::collections::BTreeMap; | ||
use windows_metadata::Item; | ||
|
||
#[derive(Default, Serialize)] | ||
struct Index { | ||
namespace_map: Vec<String>, | ||
feature_map: Vec<String>, | ||
namespaces: BTreeMap<usize, Vec<IndexItem>>, | ||
} | ||
|
||
#[derive(Default, Serialize)] | ||
struct IndexItem { | ||
name: String, | ||
features: Vec<usize>, | ||
} | ||
|
||
pub fn gen_index(writer: &Writer) -> String { | ||
let mut feature_index = Index { ..Default::default() }; | ||
|
||
for namespace in writer.reader.namespaces() { | ||
let namespace_idx = match feature_index.namespace_map.iter().position(|ns| ns == namespace) { | ||
Some(idx) => idx, | ||
None => { | ||
feature_index.namespace_map.push(namespace.to_string()); | ||
feature_index.namespace_map.len() - 1 | ||
} | ||
}; | ||
|
||
for item in writer.reader.namespace_items(namespace) { | ||
let mut index_item = IndexItem { ..Default::default() }; | ||
let mut cfg = Cfg::default(); | ||
cfg.add_feature(namespace); | ||
|
||
cfg = match item { | ||
Item::Type(def) => { | ||
index_item.name = def.name().to_string(); | ||
cfg.union(&type_def_cfg(writer, def, &[])) | ||
} | ||
Item::Const(field) => { | ||
index_item.name = field.name().to_string(); | ||
cfg.union(&field_cfg(writer, field)) | ||
} | ||
Item::Fn(method, _) => { | ||
index_item.name = method.name().to_string(); | ||
cfg.union(&signature_cfg(writer, method)) | ||
} | ||
}; | ||
|
||
let cfg_features = cfg_features(&cfg); | ||
index_item.features = cfg_features | ||
.iter() | ||
.map(|feature| match feature_index.feature_map.iter().position(|f| f == feature) { | ||
Some(idx) => idx, | ||
None => { | ||
feature_index.feature_map.push(feature.to_string()); | ||
feature_index.feature_map.len() - 1 | ||
} | ||
}) | ||
.collect(); | ||
|
||
feature_index.namespaces.entry(namespace_idx).or_default().push(index_item); | ||
} | ||
} | ||
|
||
serde_json::to_string(&feature_index).unwrap() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#![allow(non_snake_case)] | ||
|
||
use super::Write; | ||
use super::*; | ||
|
||
#[derive(Default)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.