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-cjs-chunks.md",
".changes/api-export-BaseDirectory.md", ".changes/api-export-BaseDirectory.md",
".changes/api-export-package-json.md", ".changes/api-export-package-json.md",
".changes/api-export-type-fix.md",
".changes/api-export-type.md", ".changes/api-export-type.md",
".changes/api-feature-flags.md", ".changes/api-feature-flags.md",
".changes/api-focus.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. A clear and concise description of what the bug is.
**To Reproduce** ### **To Reproduce**
Steps to reproduce the behavior: Steps to reproduce the behavior:
1. Go to '...' 1. Go to '...'
2. Click on '....' 2. Click on '....'
3. Scroll down to '....' 3. Scroll down to '....'
4. See error 4. See error
**Expected behavior** ### **Expected behavior**
A clear and concise description of what you expected to happen. A clear and concise description of what you expected to happen.
**Screenshots** ### **Screenshots**
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
**Platform and Versions (please complete the following information):** ### **Platform and Versions (required):**
<!-- You can use the `tauri info` command to get this information --> <!-- Use `yarn tauri info` or `cargo tauri info` command to get this information, and paste it here: -->
OS: ```
Node: Operating System
NPM:
Yarn:
Rustc:
**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. Add any other context about the problem here.
**Stack Trace** ### **Stack Trace**
<!-- add if applicable --> <!-- add if applicable -->

View File

@ -67,7 +67,7 @@ jobs:
with: with:
originPath: ./tauri/tooling/api/ originPath: ./tauri/tooling/api/
sidebarFile: "${{ github.workspace }}/tauri-docs/sidebars/typedoc.json" 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/ docusaurusPath: ./tauri-docs/
# Moving docs for Indexation # Moving docs for Indexation
@ -120,7 +120,7 @@ jobs:
host: ${{ secrets.DISCORD_BOT_HOST }} host: ${{ secrets.DISCORD_BOT_HOST }}
username: ${{ secrets.DISCORD_BOT_SSH_USER }} username: ${{ secrets.DISCORD_BOT_SSH_USER }}
key: ${{ secrets.DISCORD_BOT_SSH_KEY }} 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 # tauri-docs PR
- name: git config - name: git config

View File

@ -207,7 +207,7 @@ impl Cmd {
resolve_path_handler(&config, package_info, path, directory).map(Into::into) resolve_path_handler(&config, package_info, path, directory).map(Into::into)
} }
#[cfg(not(fs_path))] #[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. // 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 quit = CustomMenuItem::new("quit".to_string(), "Quit");
let close = CustomMenuItem::new("close".to_string(), "Close"); 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() let menu = Menu::new()
.add_native_item(MenuItem::Copy) .add_native_item(MenuItem::Copy)
.add_item(CustomMenuItem::new("hide", "Hide")) .add_item(CustomMenuItem::new("hide", "Hide"))

View File

@ -1,5 +1,10 @@
# Changelog # 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] ## \[1.0.0-beta.2]
- Export `BaseDirectory` in `path` module - Export `BaseDirectory` in `path` module

View File

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

View File

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

View File

@ -3,7 +3,8 @@
// SPDX-License-Identifier: MIT // 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. * 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" resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz#614c4222fe642657f37693ea62cad4dafeddf843"
integrity sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA== integrity sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==
typedoc-plugin-markdown@3.10.0: typedoc-plugin-markdown@3.10.1:
version "3.10.0" version "3.10.1"
resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.0.tgz#fa06e9e67376095e68e2ce0a778b4827748d1b8b" resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.1.tgz#9d15c16c1a29da4c137123565019d1de967987b4"
integrity sha512-FYset/F0zFuoTVn3ljUEH+CShMe95JPMnFOTFuqxJViztmgIIvGiygcQz2DKjdEv+fHTohrvjq30KGPkuv+6Qg== integrity sha512-C7s9p6DOGagPPp65g7af8OKm6Ou0rT/TP0Nphy6PQ4w6bC9BZnlOzWt1l05ER38HhON6/2prONnYwEMK5YOYCA==
dependencies: dependencies:
handlebars "^4.7.7" handlebars "^4.7.7"

View File

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