Skip to content

Commit 2a87b00

Browse files
committed
Remove Inspect.vars from library to prevent ng static build errors
1 parent c1da8fc commit 2a87b00

File tree

9 files changed

+30
-117
lines changed

9 files changed

+30
-117
lines changed

dist/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,6 @@ export declare function createBus(): {
817817
publish: (eventType: string, arg: any) => void;
818818
};
819819
export declare class Inspect {
820-
static vars(obj: any): Promise<void>;
821820
static dump(obj: any): string;
822821
static printDump(obj: any): void;
823822
static dumpTable(rows: any[]): string;

dist/index.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2889,30 +2889,6 @@ function createBus() {
28892889
}
28902890
exports.createBus = createBus;
28912891
class Inspect {
2892-
static vars(obj) {
2893-
return __awaiter(this, void 0, void 0, function* () {
2894-
if (typeof process != 'object')
2895-
return;
2896-
let inspectVarsPath = process.env.INSPECT_VARS;
2897-
if (!inspectVarsPath || !obj)
2898-
return;
2899-
// resolve dynamic path to prevent ng webpack static analysis
2900-
const I = (s) => { var _a; return _a = s, Promise.resolve().then(() => require(_a)); };
2901-
const nodeModule = (m) => 'no' + 'de:' + `${m}`;
2902-
yield I(nodeModule('fs')).then((fs) => __awaiter(this, void 0, void 0, function* () {
2903-
yield I(nodeModule('path')).then(path => {
2904-
let varsPath = inspectVarsPath.replace(/\\/g, '/');
2905-
if (varsPath.indexOf('/') >= 0) {
2906-
let dir = path.dirname(varsPath);
2907-
if (!fs.existsSync(dir)) {
2908-
fs.mkdirSync(dir);
2909-
}
2910-
}
2911-
fs.writeFileSync(varsPath, JSON.stringify(obj));
2912-
});
2913-
}));
2914-
});
2915-
}
29162892
static dump(obj) {
29172893
let to = JSON.stringify(obj, null, 4);
29182894
return to.replace(/"/g, '');

dist/servicestack-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/servicestack-client.min.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/servicestack-client.mjs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,28 +2924,6 @@ export function createBus() {
29242924
return { subscribe, publish };
29252925
}
29262926
export class Inspect {
2927-
static async vars(obj) {
2928-
if (typeof process != 'object')
2929-
return;
2930-
let inspectVarsPath = process.env.INSPECT_VARS;
2931-
if (!inspectVarsPath || !obj)
2932-
return;
2933-
// resolve dynamic path to prevent ng webpack static analysis
2934-
const I = (s) => import(/* @vite-ignore */ s);
2935-
const nodeModule = (m) => 'no' + 'de:' + `${m}`;
2936-
await I(nodeModule('fs')).then(async (fs) => {
2937-
await I(nodeModule('path')).then(path => {
2938-
let varsPath = inspectVarsPath.replace(/\\/g, '/');
2939-
if (varsPath.indexOf('/') >= 0) {
2940-
let dir = path.dirname(varsPath);
2941-
if (!fs.existsSync(dir)) {
2942-
fs.mkdirSync(dir);
2943-
}
2944-
}
2945-
fs.writeFileSync(varsPath, JSON.stringify(obj));
2946-
});
2947-
});
2948-
}
29492927
static dump(obj) {
29502928
let to = JSON.stringify(obj, null, 4);
29512929
return to.replace(/"/g, '');

dist/servicestack-client.umd.js

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
5656
else if (typeof window != "undefined") factory(window.require||function(){}, window["@servicestack/client"]={});
5757
})(function (require, exports) {
5858
"use strict";
59-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
6059
Object.defineProperty(exports, "__esModule", { value: true });
6160
exports.Inspect = exports.createBus = exports.EventBus = exports.alignAuto = exports.alignRight = exports.alignCenter = exports.alignLeft = exports.uniqueKeys = exports.JSV = exports.StringBuffer = exports.toBase64String = exports.toByteArray = exports.fromByteArray = exports.toGuid = exports.fromGuid = exports.toTimeSpan = exports.fromTimeSpan = exports.toDateTime = exports.fromDateTime = exports.isNullOrEmpty = exports.indexOfAny = exports.htmlAttrs = exports.enc = exports.uniq = exports.flatMap = exports.toTimeSpanFmt = exports.toXsdDuration = exports.fromXsdDuration = exports.classNames = exports.NavOptions = exports.UserAttributes = exports.LinkButtonDefaults = exports.NavButtonGroupDefaults = exports.NavbarDefaults = exports.NavLinkDefaults = exports.NavDefaults = exports.btnClasses = exports.btnSizeClass = exports.BootstrapSizes = exports.btnColorClass = exports.BootstrapColors = exports.activeClass = exports.activeClassNav = exports.apiValueFmt = exports.apiValue = exports.mapGet = exports.resolve = exports.each = exports.apply = exports.omitEmpty = exports.omit = exports.pick = exports.safeVarName = exports.trimEnd = exports.populateForm = exports.triggerEvent = exports.sanitizeFormData = exports.serializeToFormData = exports.serializeToUrlEncoded = exports.serializeToObject = exports.serializeForm = exports.ajaxSubmit = exports.formSubmit = exports.toVarNames = exports.bootstrapForm = exports.bindHandlers = exports.bootstrap = exports.delaySet = exports.addScript = exports.on = exports.$$ = exports.$1 = exports.isElement = exports.createElement = exports.padStart = exports.msToTime = exports.toTime = exports.toLocalISOString = exports.timeFmt12 = exports.dateFmtHM = exports.dateFmt = exports.padInt = exports.toDateFmt = exports.toDate = exports.isDate = exports.errorResponse = exports.errorResponseExcept = exports.errorResponseSummary = exports.toObject = exports.toFormData = exports.parseResponseStatus = exports.getField = exports.normalize = exports.normalizeKey = exports.parseCookie = exports.tryDecode = exports.stripQuotes = exports.bytesToBase64 = exports.setQueryString = exports.appendQueryString = exports.createUrl = exports.createPath = exports.combinePaths = exports.queryString = exports.humanify = exports.splitTitleCase = exports.isDigit = exports.isLower = exports.isUpper = exports.ucFirst = exports.humanize = exports.onlyProps = exports.chop = exports.lastRightPart = exports.lastLeftPart = exports.rightPart = exports.leftPart = exports.splitOnLast = exports.splitOnFirst = exports.css = exports.nameOf = exports.sanitize = exports.camelCaseAny = exports.map = exports.toKebabCase = exports.toCamelCase = exports.toPascalCase = exports.createError = exports.isFormData = exports.createFieldError = exports.createErrorStatus = exports.ApiResult = exports.getResponseStatus = exports.getMethod = exports.JsonApiClient = exports.JsonServiceClient = exports.GetAccessTokenResponse = exports.HttpMethods = exports.ServerEventUser = exports.GetEventSubscribers = exports.UpdateEventSubscriberResponse = exports.UpdateEventSubscriber = exports.ServerEventReceiver = exports.getAllMembers = exports.ServerEventsClient = exports.ReadyState = exports.SingletonInstanceResolver = exports.NewInstanceResolver = exports.FieldCss = exports.KeyValuePair = exports.RefInfo = exports.FormatInfo = exports.InputInfo = exports.ImageInfo = exports.MetadataType = exports.MetadataPropertyType = exports.MetadataAttribute = exports.MetadataDataMember = exports.MetadataDataContract = exports.MetadataTypeName = exports.MetadataTypes = exports.MetadataOperationType = exports.MetadataRoute = exports.MetadataTypesConfig = exports.GetNavItemsResponse = exports.GetNavItems = exports.NavItem = exports.EmptyResponse = exports.ErrorResponse = exports.ResponseError = exports.ResponseStatus = void 0;
6261
var ResponseStatus = /** @class */ (function () {
@@ -3241,46 +3240,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
32413240
var Inspect = /** @class */ (function () {
32423241
function Inspect() {
32433242
}
3244-
Inspect.vars = function (obj) {
3245-
return __awaiter(this, void 0, void 0, function () {
3246-
var inspectVarsPath, I, nodeModule;
3247-
var _this = this;
3248-
return __generator(this, function (_a) {
3249-
switch (_a.label) {
3250-
case 0:
3251-
if (typeof process != 'object')
3252-
return [2 /*return*/];
3253-
inspectVarsPath = process.env.INSPECT_VARS;
3254-
if (!inspectVarsPath || !obj)
3255-
return [2 /*return*/];
3256-
I = function (s) { var _a; return __syncRequire ? (_a = s, Promise.resolve().then(function () { return require(_a); })) : new Promise(function (resolve_1, reject_1) { require([/* @vite-ignore */ s], resolve_1, reject_1); }); };
3257-
nodeModule = function (m) { return 'no' + 'de:' + "".concat(m); };
3258-
return [4 /*yield*/, I(nodeModule('fs')).then(function (fs) { return __awaiter(_this, void 0, void 0, function () {
3259-
return __generator(this, function (_a) {
3260-
switch (_a.label) {
3261-
case 0: return [4 /*yield*/, I(nodeModule('path')).then(function (path) {
3262-
var varsPath = inspectVarsPath.replace(/\\/g, '/');
3263-
if (varsPath.indexOf('/') >= 0) {
3264-
var dir = path.dirname(varsPath);
3265-
if (!fs.existsSync(dir)) {
3266-
fs.mkdirSync(dir);
3267-
}
3268-
}
3269-
fs.writeFileSync(varsPath, JSON.stringify(obj));
3270-
})];
3271-
case 1:
3272-
_a.sent();
3273-
return [2 /*return*/];
3274-
}
3275-
});
3276-
}); })];
3277-
case 1:
3278-
_a.sent();
3279-
return [2 /*return*/];
3280-
}
3281-
});
3282-
});
3283-
};
32843243
Inspect.dump = function (obj) {
32853244
var to = JSON.stringify(obj, null, 4);
32863245
return to.replace(/"/g, '');

src/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,6 @@ export declare function createBus(): {
817817
publish: (eventType: string, arg: any) => void;
818818
};
819819
export declare class Inspect {
820-
static vars(obj: any): Promise<void>;
821820
static dump(obj: any): string;
822821
static printDump(obj: any): void;
823822
static dumpTable(rows: any[]): string;

src/index.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,31 +3381,6 @@ export function createBus() {
33813381
}
33823382

33833383
export class Inspect {
3384-
static async vars(obj:any) {
3385-
if (typeof process != 'object')
3386-
return
3387-
3388-
let inspectVarsPath = process.env.INSPECT_VARS
3389-
if (!inspectVarsPath || !obj)
3390-
return
3391-
3392-
// resolve dynamic path to prevent ng webpack static analysis
3393-
const I = (s:string) => import(/* @vite-ignore */ s)
3394-
const nodeModule = (m:string) => 'no' + 'de:' + `${m}`
3395-
await I(nodeModule('fs')).then(async fs => {
3396-
await I(nodeModule('path')).then(path => {
3397-
let varsPath = inspectVarsPath.replace(/\\/g,'/')
3398-
if (varsPath.indexOf('/') >= 0) {
3399-
let dir = path.dirname(varsPath)
3400-
if (!fs.existsSync(dir)) {
3401-
fs.mkdirSync(dir)
3402-
}
3403-
}
3404-
fs.writeFileSync(varsPath, JSON.stringify(obj))
3405-
})
3406-
})
3407-
}
3408-
34093384
static dump(obj:any) {
34103385
let to = JSON.stringify(obj, null, 4)
34113386
return to.replace(/"/g,'')

test/inspect.spec.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ import {
55
Inspect,
66
} from '../src/index';
77

8+
// Remove Inspect.vars from @servicestack/client to prevent dynamic resolve errors
9+
async function vars(obj:any) {
10+
if (typeof process != 'object')
11+
return
12+
13+
let inspectVarsPath = process.env.INSPECT_VARS
14+
if (!inspectVarsPath || !obj)
15+
return
16+
17+
// resolve dynamic path to prevent ng webpack static analysis
18+
const I = (s:string) => import(/* @vite-ignore */ s)
19+
const nodeModule = (m:string) => 'no' + 'de:' + `${m}`
20+
await I(nodeModule('fs')).then(async fs => {
21+
await I(nodeModule('path')).then(path => {
22+
let varsPath = inspectVarsPath.replace(/\\/g,'/')
23+
if (varsPath.indexOf('/') >= 0) {
24+
let dir = path.dirname(varsPath)
25+
if (!fs.existsSync(dir)) {
26+
fs.mkdirSync(dir)
27+
}
28+
}
29+
fs.writeFileSync(varsPath, JSON.stringify(obj))
30+
})
31+
})
32+
}
33+
34+
835
describe ('Inspect Tests', () => {
936

1037
it ('Can use Inspect', async () => {
@@ -29,7 +56,7 @@ describe ('Inspect Tests', () => {
2956
name: x.name, lang: x.lang, watchers: x.watchers, forks: x.forks
3057
})).slice(0, 10));
3158

32-
Inspect.vars({ orgRepos });
59+
await vars({ orgRepos });
3360
})
3461

3562
})

0 commit comments

Comments
 (0)