Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tslib v1.13.0 has breaking change #1269 #1277

Merged
merged 1 commit into from Jun 1, 2020
Merged

Conversation

MSNev
Copy link
Collaborator

@MSNev MSNev commented May 28, 2020

  • Removed Dependency on tslib

@MSNev MSNev requested a review from a team as a code owner May 28, 2020 21:18
@@ -17,16 +17,6 @@
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script>
function getParameterByName(name, url) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to module loader script

@@ -20,7 +61,10 @@ function ModuleLoader(config) {
require([moduleDef.path], function (theModule) {
try {
if (moduleDef.run) {
moduleDef.run(theModule);
doModuleCb(moduleDef, theModule, function(theModule) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bug fix that was stopping direct usage for the tests.

@@ -34,12 +34,12 @@ module.exports = function (grunt) {
tsconfig: './shared/AppInsightsCore/tsconfig.json'
},
coretest: {
tsconfig: './shared/AppInsightsCore/src/JavaScriptSDK.Tests/tsconfig.json',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the core tests out from the src folder, so they are now in the same place as all of the other components

@@ -1,10 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
"use strict";
import { getWindow, getDocument, strUndefined, strObject, strFunction, strPrototype, getCrypto } from './EnvUtils';
import { objCreateFn, strShimObject, strShimUndefined, strShimFunction, strShimPrototype } from "@microsoft/applicationinsights-shims";
Copy link
Collaborator Author

@MSNev MSNev May 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reusing these properties to aid with minification for the full Sku's.
Just importing the files does not cause the __extends and __assigns shims to be uised.

"importHelpers": true,
"noEmitHelpers": true,
"importHelpers": false,
"noEmitHelpers": false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the normal approach for breaking the tslib dependency, using this here as we don't have multiple __extend usages, so it's not as much of an issue for this development only tool

@@ -0,0 +1,111 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This IS the main shim file that gets included

d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new (__ as any)());
}

let globalObj:any = getGlobal() || {};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From here on is the primary "tricks" to wire up to the global __extends; __assign and local versions (lines 109, 110).
The primary change that this introduces (as opposed to not using tslib), is that moving forward if the consumer (of the npm packages) has defined their own __extends() and/or __assign() then this code WILL use them, previously the tslib versions where the only possible usages because tslib was a injected (via require) and used as tslib_1.__extend() rather than the global versions.

- Removed Dependency on tslib
@MSNev MSNev merged commit 712f13e into master Jun 1, 2020
@MSNev MSNev added this to the 2.5.5 milestone Jun 2, 2020
@MSNev MSNev linked an issue Jun 2, 2020 that may be closed by this pull request
@MSNev MSNev deleted the MSNev/PropertyKeyIssue branch August 15, 2020 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tslib v1.13.0 has breaking change
2 participants