Skip to content

Commit

Permalink
fix(updater): Use escaped installer path to start the nsis updater (#…
Browse files Browse the repository at this point in the history
…727)

Port of v1 change: tauri-apps/tauri#7956

Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/6877612128

Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
  • Loading branch information
2 people authored and tauri-bot committed Nov 15, 2023
1 parent 549b1cf commit 33fedbc
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 122 deletions.
134 changes: 38 additions & 96 deletions dist-js/index.min.js → dist-js/index.cjs
Original file line number Diff line number Diff line change
@@ -1,84 +1,7 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol */


typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
'use strict';

/**
* Sends a message to the backend.
* @example
* ```typescript
* import { invoke } from '@tauri-apps/api/primitives';
* await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });
* ```
*
* @param cmd The command name.
* @param args The optional arguments to pass to the command.
* @param options The request options.
* @return A promise resolving or rejecting to the backend response.
*
* @since 1.0.0
*/
async function invoke(cmd, args = {}, options) {
return window.__TAURI_INTERNALS__.invoke(cmd, args, options);
}

// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
/**
* The path module provides utilities for working with file and directory paths.
*
* This package is also accessible with `window.__TAURI__.path` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`.
*
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
* @module
*/
/**
* @since 2.0.0
*/
var BaseDirectory;
(function (BaseDirectory) {
BaseDirectory[BaseDirectory["Audio"] = 1] = "Audio";
BaseDirectory[BaseDirectory["Cache"] = 2] = "Cache";
BaseDirectory[BaseDirectory["Config"] = 3] = "Config";
BaseDirectory[BaseDirectory["Data"] = 4] = "Data";
BaseDirectory[BaseDirectory["LocalData"] = 5] = "LocalData";
BaseDirectory[BaseDirectory["Document"] = 6] = "Document";
BaseDirectory[BaseDirectory["Download"] = 7] = "Download";
BaseDirectory[BaseDirectory["Picture"] = 8] = "Picture";
BaseDirectory[BaseDirectory["Public"] = 9] = "Public";
BaseDirectory[BaseDirectory["Video"] = 10] = "Video";
BaseDirectory[BaseDirectory["Resource"] = 11] = "Resource";
BaseDirectory[BaseDirectory["Temp"] = 12] = "Temp";
BaseDirectory[BaseDirectory["AppConfig"] = 13] = "AppConfig";
BaseDirectory[BaseDirectory["AppData"] = 14] = "AppData";
BaseDirectory[BaseDirectory["AppLocalData"] = 15] = "AppLocalData";
BaseDirectory[BaseDirectory["AppCache"] = 16] = "AppCache";
BaseDirectory[BaseDirectory["AppLog"] = 17] = "AppLog";
BaseDirectory[BaseDirectory["Desktop"] = 18] = "Desktop";
BaseDirectory[BaseDirectory["Executable"] = 19] = "Executable";
BaseDirectory[BaseDirectory["Font"] = 20] = "Font";
BaseDirectory[BaseDirectory["Home"] = 21] = "Home";
BaseDirectory[BaseDirectory["Runtime"] = 22] = "Runtime";
BaseDirectory[BaseDirectory["Template"] = 23] = "Template";
})(BaseDirectory || (BaseDirectory = {}));
var path = require('@tauri-apps/api/path');
var primitives = require('@tauri-apps/api/primitives');

// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -137,7 +60,7 @@ var BaseDirectory;
* @since 2.0.0
*/
async function readTextFile(filePath, options = {}) {
return await invoke("plugin:fs|read_text_file", {
return await primitives.invoke("plugin:fs|read_text_file", {
path: filePath,
options,
});
Expand All @@ -154,7 +77,7 @@ async function readTextFile(filePath, options = {}) {
* @since 2.0.0
*/
async function readBinaryFile(filePath, options = {}) {
const arr = await invoke("plugin:fs|read_file", {
const arr = await primitives.invoke("plugin:fs|read_file", {
path: filePath,
options,
});
Expand Down Expand Up @@ -184,12 +107,12 @@ async function writeTextFile(path, contents, options) {
file.contents = path.contents;
}
if (typeof contents === "string") {
file.contents = contents !== null && contents !== void 0 ? contents : "";
file.contents = contents ?? "";
}
else {
fileOptions = contents;
}
return await invoke("plugin:fs|write_file", {
return await primitives.invoke("plugin:fs|write_file", {
path: file.path,
contents: Array.from(new TextEncoder().encode(file.contents)),
options: fileOptions,
Expand Down Expand Up @@ -223,9 +146,9 @@ async function writeBinaryFile(path, contents, options) {
}
else if (typeof path === "string") {
// @ts-expect-error in this case `contents` is always a BinaryFileContents
file.contents = contents !== null && contents !== void 0 ? contents : [];
file.contents = contents ?? [];
}
return await invoke("plugin:fs|write_file", {
return await primitives.invoke("plugin:fs|write_file", {
path: file.path,
contents: Array.from(file.contents instanceof ArrayBuffer
? new Uint8Array(file.contents)
Expand Down Expand Up @@ -254,7 +177,7 @@ async function writeBinaryFile(path, contents, options) {
* @since 2.0.0
*/
async function readDir(dir, options = {}) {
return await invoke("plugin:fs|read_dir", {
return await primitives.invoke("plugin:fs|read_dir", {
path: dir,
options,
});
Expand All @@ -275,7 +198,7 @@ async function readDir(dir, options = {}) {
* @since 2.0.0
*/
async function createDir(dir, options = {}) {
return await invoke("plugin:fs|create_dir", {
return await primitives.invoke("plugin:fs|create_dir", {
path: dir,
options,
});
Expand All @@ -295,7 +218,7 @@ async function createDir(dir, options = {}) {
* @since 2.0.0
*/
async function removeDir(dir, options = {}) {
return await invoke("plugin:fs|remove_dir", {
return await primitives.invoke("plugin:fs|remove_dir", {
path: dir,
options,
});
Expand All @@ -314,7 +237,7 @@ async function removeDir(dir, options = {}) {
* @since 2.0.0
*/
async function copyFile(source, destination, options = {}) {
return await invoke("plugin:fs|copy_file", {
return await primitives.invoke("plugin:fs|copy_file", {
source,
destination,
options,
Expand All @@ -334,7 +257,7 @@ async function copyFile(source, destination, options = {}) {
* @since 2.0.0
*/
async function removeFile(file, options = {}) {
return await invoke("plugin:fs|remove_file", {
return await primitives.invoke("plugin:fs|remove_file", {
path: file,
options,
});
Expand All @@ -353,7 +276,7 @@ async function removeFile(file, options = {}) {
* @since 2.0.0
*/
async function renameFile(oldPath, newPath, options = {}) {
return await invoke("plugin:fs|rename_file", {
return await primitives.invoke("plugin:fs|rename_file", {
oldPath,
newPath,
options,
Expand All @@ -371,15 +294,15 @@ async function renameFile(oldPath, newPath, options = {}) {
* @since 2.0.0
*/
async function exists(path) {
return await invoke("plugin:fs|exists", { path });
return await primitives.invoke("plugin:fs|exists", { path });
}
/**
* Returns the metadata for the given path.
*
* @since 2.0.0
*/
async function metadata(path) {
return await invoke("plugin:fs|metadata", {
return await primitives.invoke("plugin:fs|metadata", {
path,
}).then((metadata) => {
const { accessedAtMs, createdAtMs, modifiedAtMs, ...data } = metadata;
Expand All @@ -392,5 +315,24 @@ async function metadata(path) {
});
}

export { BaseDirectory, BaseDirectory as Dir, copyFile, createDir, exists, metadata, readBinaryFile, readDir, readTextFile, removeDir, removeFile, renameFile, writeBinaryFile, writeTextFile as writeFile, writeTextFile };
//# sourceMappingURL=index.min.js.map
Object.defineProperty(exports, 'BaseDirectory', {
enumerable: true,
get: function () { return path.BaseDirectory; }
});
Object.defineProperty(exports, 'Dir', {
enumerable: true,
get: function () { return path.BaseDirectory; }
});
exports.copyFile = copyFile;
exports.createDir = createDir;
exports.exists = exists;
exports.metadata = metadata;
exports.readBinaryFile = readBinaryFile;
exports.readDir = readDir;
exports.readTextFile = readTextFile;
exports.removeDir = removeDir;
exports.removeFile = removeFile;
exports.renameFile = renameFile;
exports.writeBinaryFile = writeBinaryFile;
exports.writeFile = writeTextFile;
exports.writeTextFile = writeTextFile;
5 changes: 2 additions & 3 deletions dist-js/index.mjs → dist-js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async function writeTextFile(path, contents, options) {
file.contents = path.contents;
}
if (typeof contents === "string") {
file.contents = contents !== null && contents !== void 0 ? contents : "";
file.contents = contents ?? "";
}
else {
fileOptions = contents;
Expand Down Expand Up @@ -144,7 +144,7 @@ async function writeBinaryFile(path, contents, options) {
}
else if (typeof path === "string") {
// @ts-expect-error in this case `contents` is always a BinaryFileContents
file.contents = contents !== null && contents !== void 0 ? contents : [];
file.contents = contents ?? [];
}
return await invoke("plugin:fs|write_file", {
path: file.path,
Expand Down Expand Up @@ -314,4 +314,3 @@ async function metadata(path) {
}

export { copyFile, createDir, exists, metadata, readBinaryFile, readDir, readTextFile, removeDir, removeFile, renameFile, writeBinaryFile, writeTextFile as writeFile, writeTextFile };
//# sourceMappingURL=index.mjs.map
1 change: 0 additions & 1 deletion dist-js/index.min.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist-js/index.mjs.map

This file was deleted.

11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,19 @@
"Tauri Programme within The Commons Conservancy"
],
"type": "module",
"browser": "dist-js/index.min.js",
"module": "dist-js/index.mjs",
"types": "dist-js/index.d.ts",
"exports": {
"import": "./dist-js/index.mjs",
"types": "./dist-js/index.d.ts",
"browser": "./dist-js/index.min.js"
"import": "./dist-js/index.js",
"require": "./dist-js/index.cjs"
},
"scripts": {
"build": "rollup -c"
},
"files": [
"dist-js",
"!dist-js/**/*.map",
"README.md",
"LICENSE"
],
"devDependencies": {
"tslib": "^2.4.1"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.11"
}
Expand Down
7 changes: 7 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

import { createConfig } from "../../shared/rollup.config.js";

export default createConfig();
11 changes: 0 additions & 11 deletions rollup.config.mjs

This file was deleted.

Loading

0 comments on commit 33fedbc

Please sign in to comment.