Skip to content

Commit

Permalink
maint/dist ~ update
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Jan 15, 2021
1 parent 586ad61 commit 582c989
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 115 deletions.
2 changes: 0 additions & 2 deletions dist/cjs/esm-wrapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// # spell-checker:ignore Deno

import _ from '../index.js';
// note: not usable by `deno`;
// ...`deno` is unable to load (the CJS module) '../index.js' via import => `'../index.js' does not provide an export named 'default'`

const default_ = _;
export default default_;
24 changes: 6 additions & 18 deletions dist/cjs/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

159 changes: 76 additions & 83 deletions dist/cjs/lib/OSPaths.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions dist/cjs/platform-adapters/node.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions dist/esm/_virtual/_tslib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*! *****************************************************************************
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.
***************************************************************************** */

function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}

export { __spreadArrays };
10 changes: 10 additions & 0 deletions dist/esm/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { OSPathsAdaptionBuilder_ } from './lib/OSPaths.mjs';
import { adapter } from './platform-adapters/node.mjs';

var default_ = OSPathsAdaptionBuilder_(adapter);
var haveModuleExports_ = typeof module === 'object' && module.exports;
if (haveModuleExports_) {
module.exports = default_;
}

export default default_;
76 changes: 76 additions & 0 deletions dist/esm/lib/OSPaths.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { __spreadArrays } from '../_virtual/_tslib.js';

function isEmpty(s) {
return !s;
}
function OSPathsAdaptionBuilder_(adapter_) {
var env = adapter_.env, os = adapter_.os, path = adapter_.path, process = adapter_.process;
var isWinOS = /^win/i.test(process.platform);
function normalizePath(path_) {
return path_ ? path.normalize(path.join(path_, '.')) : void 0;
}
var posix = function () {
var home = function () {
return normalizePath((typeof os.homedir === 'function' ? os.homedir() : void 0) || env.get('HOME'));
};
var temp = function () {
var fallback = '/tmp';
var priorityList = [
typeof os.tmpdir === 'function' ? os.tmpdir() : void 0,
env.get('TMPDIR'),
env.get('TEMP'),
env.get('TMP'),
];
return normalizePath(priorityList.find(function (v) { return !isEmpty(v); })) || fallback;
};
return { home: home, temp: temp };
};
var windows = function () {
var home = function () {
var priorityList = [
typeof os.homedir === 'function' ? os.homedir() : void 0,
env.get('USERPROFILE'),
env.get('HOME'),
env.get('HOMEDRIVE') || env.get('HOMEPATH')
? path.join(env.get('HOMEDRIVE') || '', env.get('HOMEPATH') || '')
: void 0,
];
return normalizePath(priorityList.find(function (v) { return !isEmpty(v); }));
};
function joinPathToBase(base, segments) {
return base ? path.join.apply(path, __spreadArrays([base], segments)) : void 0;
}
var temp = function () {
var fallback = 'C:\\Temp';
var priorityListLazy = [
os.tmpdir,
function () { return env.get('TEMP'); },
function () { return env.get('TMP'); },
function () { return joinPathToBase(env.get('LOCALAPPDATA'), ['Temp']); },
function () { return joinPathToBase(home(), ['AppData', 'Local', 'Temp']); },
function () { return joinPathToBase(env.get('ALLUSERSPROFILE'), ['Temp']); },
function () { return joinPathToBase(env.get('SystemRoot'), ['Temp']); },
function () { return joinPathToBase(env.get('windir'), ['Temp']); },
function () { return joinPathToBase(env.get('SystemDrive'), ['\\', 'Temp']); },
];
var v = priorityListLazy.find(function (v) { return v && !isEmpty(v()); });
return (v && normalizePath(v())) || fallback;
};
return { home: home, temp: temp };
};
var OSPaths_ = (function () {
function OSPaths_() {
var OSPaths = function () {
return new OSPaths_();
};
var platformOS = isWinOS ? windows() : posix();
OSPaths.home = platformOS.home;
OSPaths.temp = platformOS.temp;
return OSPaths;
}
return OSPaths_;
}());
return new OSPaths_();
}

export { OSPathsAdaptionBuilder_ };
15 changes: 15 additions & 0 deletions dist/esm/platform-adapters/node.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as os from 'os';
import * as path from 'path';

var adapter = {
env: {
get: function (s) {
return process.env[s];
},
},
os: os,
path: path,
process: process,
};

export { adapter };
Binary file modified dist/os-paths.tgz
Binary file not shown.
3 changes: 1 addition & 2 deletions dist/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import { default as default_ } from './lib/OSPaths';
export * from './lib/OSPaths';
declare const default_: import("./lib/OSPaths").OSPaths;
export default default_;
4 changes: 2 additions & 2 deletions dist/types/lib/OSPaths.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Platform } from '../platform-adapters/_base';
export declare type OSPaths = {
new (): OSPaths;
(): OSPaths;
readonly home: () => string | undefined;
readonly temp: () => string;
};
declare const default_: OSPaths;
export default default_;
export declare function OSPathsAdaptionBuilder_(adapter_: Platform.Adapter): OSPaths;
3 changes: 0 additions & 3 deletions dist/types/platform-adapters/_base.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ export declare namespace Platform {
readonly env: {
readonly get: (_: string) => string | undefined;
};
readonly meta: {
readonly mainFilename: string;
};
readonly os: {
readonly homedir?: () => string;
readonly tmpdir?: () => string;
Expand Down

0 comments on commit 582c989

Please sign in to comment.