Merge branch 'dev' of github.com:tauri-apps/tauri into dev

This commit is contained in:
Laegel 2021-06-26 19:54:22 +02:00
commit 710a4f95db
13 changed files with 114 additions and 75 deletions

View File

@ -0,0 +1,5 @@
---
"api": patch
---
Export `Response` and `ResponseType` as value instead of type.

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---
Properly bundle resources with nested folder structure.

View File

@ -5,6 +5,7 @@
".changes/api-cjs-chunks.md",
".changes/api-export-BaseDirectory.md",
".changes/api-export-package-json.md",
".changes/api-export-type-fix.md",
".changes/api-export-type.md",
".changes/api-feature-flags.md",
".changes/api-focus.md",

View File

@ -7,32 +7,66 @@ assignees: ''
---
**Describe the bug**
<!-- BEFORE YOU FILE A NEW ISSUE-->
<!--
0. Please search open issues before duplicating a new one.
1. Make sure you are using the latest version of everything including:
- rustc
- ALL relevant Tauri Libs
2. You must attach the results of cargo tauri info or yarn tauri info to your issue.
3. Make sure it is an issue with Tauri, and not something to do with your side of the stack.
4. Consider starting a discussion. Speaking of which, have you looked there? Maybe your question has been answered.
5. Remember to follow our community guidelines and be friendly.
6. Is this an issue or a feature request? If the latter, please use the other template.
-->
### **Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
### **To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
### **Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
### **Screenshots**
If applicable, add screenshots to help explain your problem.
**Platform and Versions (please complete the following information):**
<!-- You can use the `tauri info` command to get this information -->
OS:
Node:
NPM:
Yarn:
Rustc:
### **Platform and Versions (required):**
<!-- Use `yarn tauri info` or `cargo tauri info` command to get this information, and paste it here: -->
```
Operating System
**Additional context**
Node.js environment
Node.js
@tauri-apps/cli
@tauri-apps/api
Global packages
npm
yarn
Rust environment
rustc
cargo
App directory structure
App
tauri.rs
build-type
CSP
```
### **Additional context**
Add any other context about the problem here.
**Stack Trace**
<!-- add if applicable -->
### **Stack Trace**
<!-- add if applicable -->

View File

@ -67,7 +67,7 @@ jobs:
with:
originPath: ./tauri/tooling/api/
sidebarFile: "${{ github.workspace }}/tauri-docs/sidebars/typedoc.json"
targetPath: ./tauri-docs/en/api/js
targetPath: ${{ github.workspace }}/tauri-docs/docs/en/api/js
docusaurusPath: ./tauri-docs/
# Moving docs for Indexation
@ -120,7 +120,7 @@ jobs:
host: ${{ secrets.DISCORD_BOT_HOST }}
username: ${{ secrets.DISCORD_BOT_SSH_USER }}
key: ${{ secrets.DISCORD_BOT_SSH_KEY }}
script: cd ~/tauri-search-bot && yarn && forever stopall && forever start ./src/index.js
script: cd ~/tauri-search-bot/github/workspace/tauri-search-bot/ && yarn && forever stopall && forever start ./src/index.js
# tauri-docs PR
- name: git config

View File

@ -207,7 +207,7 @@ impl Cmd {
resolve_path_handler(&config, package_info, path, directory).map(Into::into)
}
#[cfg(not(fs_path))]
Self::ResolvePath { .. } => Err(crate::Error::ApiNotAllowlisted("fs > pathApi".to_string())),
Self::ResolvePath { .. } => Err(crate::Error::ApiNotAllowlisted("fs > path".to_string())),
}
}
}

View File

@ -29,7 +29,7 @@ Create a `Menu` instance:
// here `"quit".to_string()` defines the menu item id, and the second parameter is the menu item label.
let quit = CustomMenuItem::new("quit".to_string(), "Quit");
let close = CustomMenuItem::new("close".to_string(), "Close");
let submenu = Menu::new().add_item(quit).add_item(close);
let submenu = Submenu::new("File", Menu::new().add_item(quit).add_item(close));
let menu = Menu::new()
.add_native_item(MenuItem::Copy)
.add_item(CustomMenuItem::new("hide", "Hide"))

View File

@ -1,5 +1,10 @@
# Changelog
## \[1.0.0-beta.3]
- Export `Response` and `ResponseType` as value instead of type.
- [394b6e05](https://www.github.com/tauri-apps/tauri/commit/394b6e0572e7a0a92e103e462a7f603f7d569319) fix(api): http `ResponseType` export type error ([#2065](https://www.github.com/tauri-apps/tauri/pull/2065)) on 2021-06-24
## \[1.0.0-beta.2]
- Export `BaseDirectory` in `path` module

View File

@ -1,6 +1,6 @@
{
"name": "@tauri-apps/api",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "Tauri API definitions",
"type": "module",
"funding": {
@ -67,7 +67,7 @@
"rollup-plugin-terser": "7.0.2",
"tslib": "2.3.0",
"typedoc": "0.21.0",
"typedoc-plugin-markdown": "3.10.0",
"typedoc-plugin-markdown": "3.10.1",
"typescript": "4.3.4"
}
}

View File

@ -348,13 +348,11 @@ async function fetch<T>(
export type {
ClientOptions,
ResponseType,
Part,
HttpVerb,
HttpOptions,
RequestOptions,
FetchOptions,
Response
FetchOptions
}
export { getClient, fetch, Body, Client }
export { getClient, fetch, Body, Client, Response, ResponseType }

View File

@ -3,7 +3,8 @@
// SPDX-License-Identifier: MIT
/**
* Send notifications to your user. Can also be used with the Notification Web API.
* Send toast notifications (brief auto-expiring OS window element) to your user.
* Can also be used with the Notification Web API.
*
* This package is also accessible with `window.__TAURI__.notification` when `tauri.conf.json > build > withGlobalTauri` is set to true.
*

View File

@ -3231,10 +3231,10 @@ typedoc-default-themes@^0.12.10:
resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz#614c4222fe642657f37693ea62cad4dafeddf843"
integrity sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==
typedoc-plugin-markdown@3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.0.tgz#fa06e9e67376095e68e2ce0a778b4827748d1b8b"
integrity sha512-FYset/F0zFuoTVn3ljUEH+CShMe95JPMnFOTFuqxJViztmgIIvGiygcQz2DKjdEv+fHTohrvjq30KGPkuv+6Qg==
typedoc-plugin-markdown@3.10.1:
version "3.10.1"
resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.1.tgz#9d15c16c1a29da4c137123565019d1de967987b4"
integrity sha512-C7s9p6DOGagPPp65g7af8OKm6Ou0rT/TP0Nphy6PQ4w6bC9BZnlOzWt1l05ER38HhON6/2prONnYwEMK5YOYCA==
dependencies:
handlebars "^4.7.7"

View File

@ -486,6 +486,7 @@ pub fn build_wix_app_installer(
data.insert("binaries", binaries_json);
let resources = generate_resource_data(settings)?;
println!("{:?}", serde_json::to_string(&resources).unwrap());
let mut resources_wix_string = String::from("");
let mut files_ids = Vec::new();
for (_, dir) in resources {
@ -703,19 +704,35 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> {
};
// split the resource path directories
let mut directories = src
let directories = src
.components()
.filter(|component| {
let comp = component.as_os_str();
comp != "." && comp != ".."
})
.collect::<Vec<_>>();
directories.truncate(directories.len() - 1);
// transform the directory structure to a chained vec structure
let first_directory = directories
.first()
.map(|d| d.as_os_str().to_string_lossy().into_owned())
.unwrap_or_else(String::new);
if !resources.contains_key(&first_directory) {
resources.insert(
first_directory.clone(),
ResourceDirectory {
path: first_directory.clone(),
name: first_directory.clone(),
directories: vec![],
files: vec![],
},
);
}
let mut directory_entry = resources
.get_mut(&first_directory)
.expect("Unable to handle resources");
let last_index = directories.len() - 1;
let mut path = String::new();
for (i, directory) in directories.into_iter().enumerate() {
@ -725,57 +742,30 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> {
.into_string()
.expect("failed to read resource folder name");
path.push_str(directory_name.as_str());
path.push(std::path::MAIN_SEPARATOR);
// if the directory is already on the map
if resources.contains_key(&first_directory) {
let directory_entry = &mut resources
.get_mut(&first_directory)
.expect("Unable to handle resources");
if last_index == 0 {
// the directory entry is the root of the chain
directory_entry.add_file(resource_entry.clone());
} else {
let index = directory_entry
.directories
.iter()
.position(|f| f.path == path);
if let Some(index) = index {
// the directory entry is already a part of the chain
if i == last_index {
let dir = directory_entry
.directories
.get_mut(index)
.expect("Unable to get directory");
dir.add_file(resource_entry.clone());
}
} else {
// push it to the chain
if i == last_index {
directory_entry.add_file(resource_entry);
break;
} else if i == 0 {
continue;
} else {
let index = directory_entry
.directories
.iter()
.position(|f| f.path == path);
match index {
Some(i) => directory_entry = directory_entry.directories.iter_mut().nth(i).unwrap(),
None => {
directory_entry.directories.push(ResourceDirectory {
path: path.clone(),
name: directory_name.clone(),
name: directory_name,
directories: vec![],
files: if i == last_index {
vec![resource_entry.clone()]
} else {
vec![]
},
files: vec![],
});
directory_entry = directory_entry.directories.iter_mut().last().unwrap();
}
}
} else {
resources.insert(
directory_name.clone(),
ResourceDirectory {
path: path.clone(),
name: directory_name.clone(),
directories: vec![],
files: if i == last_index {
vec![resource_entry.clone()]
} else {
vec![]
},
},
);
}
}
}