mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-17 06:19:41 +02:00
Postman importer semi-complete
This commit is contained in:
13
src-tauri/plugins/importer-yaak/out/index.js
Normal file
13
src-tauri/plugins/importer-yaak/out/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
function u(r) {
|
||||
let e;
|
||||
try {
|
||||
e = JSON.parse(r);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
if (t(e) && e.yaakSchema === 1) return e.resources;
|
||||
}
|
||||
function t(r) {
|
||||
return Object.prototype.toString.call(r) === '[object Object]';
|
||||
}
|
||||
export { t as isJSObject, u as pluginHookImport };
|
||||
20
src-tauri/plugins/importer-yaak/src/index.js
Normal file
20
src-tauri/plugins/importer-yaak/src/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
export function pluginHookImport(contents) {
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(contents);
|
||||
} catch (err) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!isJSObject(parsed)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (parsed.yaakSchema !== 1) return undefined;
|
||||
|
||||
return parsed.resources; // Should already be in the correct format
|
||||
}
|
||||
|
||||
export function isJSObject(obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object Object]';
|
||||
}
|
||||
13
src-tauri/plugins/importer-yaak/vite.config.js
Normal file
13
src-tauri/plugins/importer-yaak/vite.config.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'src/index.js'),
|
||||
fileName: 'index',
|
||||
formats: ['es'],
|
||||
},
|
||||
outDir: resolve(__dirname, 'out'),
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user