[main][snippet] prepare new snippet release, add support for more config (#2365)
This commit is contained in:
Родитель
8d3e3e282a
Коммит
977fcd5658
|
@ -76,7 +76,7 @@ appInsights.trackPageView(); // Manually call trackPageView to establish the cur
|
|||
|
||||
If your app does not use NPM, you can directly instrument your webpages with Application Insights by pasting this snippet at the top of each your pages. Preferably, it should be the first script in your `<head>` section so that it can monitor any potential issues with all of your dependencies.
|
||||
|
||||
The current version of the snippet is version 7, the version is identified by the "sv:" in the script.
|
||||
The current version of the snippet is version 8, the version is identified by the "sv:" in the script.
|
||||
|
||||
```html
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -956,7 +956,7 @@
|
|||
"node_modules/@rush-temp/applicationinsights-example-shared-worker": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "file:projects/applicationinsights-example-shared-worker.tgz",
|
||||
"integrity": "sha512-VrrfozxI9X33aXC6yGCBJH/LAGDpd4n+PB/9cq9n/6P2tpWbnSmwpVXXPBxF02wNqnyEoxuw8W4O3dYZDqnT8Q==",
|
||||
"integrity": "sha512-kX/MZZl8KKjBC7GLGTRVs2nniAR5uX/IT/C/gIoxo09C9NsURdZU1gpxBzPVuv1nwLkhqTK4LYTEcCcKcUrgHg==",
|
||||
"dependencies": {
|
||||
"@microsoft/dynamicproto-js": "^2.0.3",
|
||||
"@nevware21/grunt-eslint-ts": "^0.2.2",
|
||||
|
@ -1573,16 +1573,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.12.0.tgz",
|
||||
"integrity": "sha512-7F91fcbuDf/d3S8o21+r3ZncGIke/+eWk0EpO21LXhDfLahriZF9CGj4fbAetEjlaBdjdSm9a6VeXbpbT6Z40Q==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.13.1.tgz",
|
||||
"integrity": "sha512-kZqi+WZQaZfPKnsflLJQCz6Ze9FFSMfXrrIOcyargekQxG37ES7DJNpJUE9Q/X5n3yTIP/WPutVNzgknQ7biLg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.10.0",
|
||||
"@typescript-eslint/scope-manager": "7.12.0",
|
||||
"@typescript-eslint/type-utils": "7.12.0",
|
||||
"@typescript-eslint/utils": "7.12.0",
|
||||
"@typescript-eslint/visitor-keys": "7.12.0",
|
||||
"@typescript-eslint/scope-manager": "7.13.1",
|
||||
"@typescript-eslint/type-utils": "7.13.1",
|
||||
"@typescript-eslint/utils": "7.13.1",
|
||||
"@typescript-eslint/visitor-keys": "7.13.1",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.3.1",
|
||||
"natural-compare": "^1.4.0",
|
||||
|
@ -1606,15 +1606,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.12.0.tgz",
|
||||
"integrity": "sha512-dm/J2UDY3oV3TKius2OUZIFHsomQmpHtsV0FTh1WO8EKgHLQ1QCADUqscPgTpU+ih1e21FQSRjXckHn3txn6kQ==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.13.1.tgz",
|
||||
"integrity": "sha512-1ELDPlnLvDQ5ybTSrMhRTFDfOQEOXNM+eP+3HT/Yq7ruWpciQw+Avi73pdEbA4SooCawEWo3dtYbF68gN7Ed1A==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "7.12.0",
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/typescript-estree": "7.12.0",
|
||||
"@typescript-eslint/visitor-keys": "7.12.0",
|
||||
"@typescript-eslint/scope-manager": "7.13.1",
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"@typescript-eslint/typescript-estree": "7.13.1",
|
||||
"@typescript-eslint/visitor-keys": "7.13.1",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -1634,13 +1634,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.12.0.tgz",
|
||||
"integrity": "sha512-itF1pTnN6F3unPak+kutH9raIkL3lhH1YRPGgt7QQOh43DQKVJXmWkpb+vpc/TiDHs6RSd9CTbDsc/Y+Ygq7kg==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.13.1.tgz",
|
||||
"integrity": "sha512-adbXNVEs6GmbzaCpymHQ0MB6E4TqoiVbC0iqG3uijR8ZYfpAXMGttouQzF4Oat3P2GxDVIrg7bMI/P65LiQZdg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/visitor-keys": "7.12.0"
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"@typescript-eslint/visitor-keys": "7.13.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || >=20.0.0"
|
||||
|
@ -1651,13 +1651,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.12.0.tgz",
|
||||
"integrity": "sha512-lib96tyRtMhLxwauDWUp/uW3FMhLA6D0rJ8T7HmH7x23Gk1Gwwu8UZ94NMXBvOELn6flSPiBrCKlehkiXyaqwA==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.13.1.tgz",
|
||||
"integrity": "sha512-aWDbLu1s9bmgPGXSzNCxELu+0+HQOapV/y+60gPXafR8e2g1Bifxzevaa+4L2ytCWm+CHqpELq4CSoN9ELiwCg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "7.12.0",
|
||||
"@typescript-eslint/utils": "7.12.0",
|
||||
"@typescript-eslint/typescript-estree": "7.13.1",
|
||||
"@typescript-eslint/utils": "7.13.1",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.3.0"
|
||||
},
|
||||
|
@ -1678,9 +1678,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.12.0.tgz",
|
||||
"integrity": "sha512-o+0Te6eWp2ppKY3mLCU+YA9pVJxhUJE15FV7kxuD9jgwIAa+w/ycGJBMrYDTpVGUM/tgpa9SeMOugSabWFq7bg==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.13.1.tgz",
|
||||
"integrity": "sha512-7K7HMcSQIAND6RBL4kDl24sG/xKM13cA85dc7JnmQXw2cBDngg7c19B++JzvJHRG3zG36n9j1i451GBzRuHchw==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "^18.18.0 || >=20.0.0"
|
||||
|
@ -1691,13 +1691,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.12.0.tgz",
|
||||
"integrity": "sha512-5bwqLsWBULv1h6pn7cMW5dXX/Y2amRqLaKqsASVwbBHMZSnHqE/HN4vT4fE0aFsiwxYvr98kqOWh1a8ZKXalCQ==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.13.1.tgz",
|
||||
"integrity": "sha512-uxNr51CMV7npU1BxZzYjoVz9iyjckBduFBP0S5sLlh1tXYzHzgZ3BR9SVsNed+LmwKrmnqN3Kdl5t7eZ5TS1Yw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/visitor-keys": "7.12.0",
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"@typescript-eslint/visitor-keys": "7.13.1",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
|
@ -1755,15 +1755,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.12.0.tgz",
|
||||
"integrity": "sha512-Y6hhwxwDx41HNpjuYswYp6gDbkiZ8Hin9Bf5aJQn1bpTs3afYY4GX+MPYxma8jtoIV2GRwTM/UJm/2uGCVv+DQ==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.13.1.tgz",
|
||||
"integrity": "sha512-h5MzFBD5a/Gh/fvNdp9pTfqJAbuQC4sCN2WzuXme71lqFJsZtLbjxfSk4r3p02WIArOF9N94pdsLiGutpDbrXQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@typescript-eslint/scope-manager": "7.12.0",
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/typescript-estree": "7.12.0"
|
||||
"@typescript-eslint/scope-manager": "7.13.1",
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"@typescript-eslint/typescript-estree": "7.13.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || >=20.0.0"
|
||||
|
@ -1777,12 +1777,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.12.0.tgz",
|
||||
"integrity": "sha512-uZk7DevrQLL3vSnfFl5bj4sL75qC9D6EdjemIdbtkuUmIheWpuiiylSY01JxJE7+zGrOWDZrp1WxOuDntvKrHQ==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.13.1.tgz",
|
||||
"integrity": "sha512-k/Bfne7lrP7hcb7m9zSsgcBmo+8eicqqfNAJ7uUY+jkTFpKeH2FSkWpFRtimBxgkyvqfu9jTPRbYOvud6isdXA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"eslint-visitor-keys": "^3.4.3"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -1805,9 +1805,9 @@
|
|||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.11.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
|
||||
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
|
||||
"version": "8.12.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz",
|
||||
"integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
|
@ -2245,9 +2245,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001632",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001632.tgz",
|
||||
"integrity": "sha512-udx3o7yHJfUxMLkGohMlVHCvFvWmirKh9JAH/d7WOLPetlH+LTL5cocMZ0t7oZx/mdlOWXti97xLZWc8uURRHg==",
|
||||
"version": "1.0.30001636",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz",
|
||||
"integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
@ -2641,9 +2641,9 @@
|
|||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.4.796",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.796.tgz",
|
||||
"integrity": "sha512-NglN/xprcM+SHD2XCli4oC6bWe6kHoytcyLKCWXmRL854F0qhPhaYgUswUsglnPxYaNQIg2uMY4BvaomIf3kLA=="
|
||||
"version": "1.4.807",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.807.tgz",
|
||||
"integrity": "sha512-kSmJl2ZwhNf/bcIuCH/imtNOKlpkLDn2jqT5FJ+/0CXjhnFaOa9cOe9gHKKy71eM49izwuQjZhKk+lWQ1JxB7A=="
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "1.0.2",
|
||||
|
@ -2762,15 +2762,18 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-security": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-3.0.0.tgz",
|
||||
"integrity": "sha512-2Ij7PkmXIF2cKwoVkEgemwoXbOnxg5UfdhdcpNxZwJxC/10dbsdhHISrTyJ/n8DUkt3yiN6P1ywEgcMGjIwHIw==",
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-3.0.1.tgz",
|
||||
"integrity": "sha512-XjVGBhtDZJfyuhIxnQ/WMm385RbX3DBu7H1J7HNNhmB2tnGxMeqVSnYv79oAj992ayvIBZghsymwkYFS6cGH4Q==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"safe-regex": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-scope": {
|
||||
|
@ -3608,7 +3611,7 @@
|
|||
"version": "9.1.1",
|
||||
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-9.1.1.tgz",
|
||||
"integrity": "sha512-W+nOulP2tYd/ZG99WuZC/I5ljjQQ7EUw/jQGcIb9eu8mDlZxNY2SgcJXTLG9h5gRvqA3uJOe4hZXYsd3EqioMw==",
|
||||
"deprecated": "< 22.5.0 is no longer supported",
|
||||
"deprecated": "< 22.6.4 is no longer supported",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.1.0",
|
||||
|
@ -3644,9 +3647,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-qunit/node_modules/ws": {
|
||||
"version": "7.5.9",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
|
||||
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
|
||||
"version": "7.5.10",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
|
||||
"integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
|
||||
"engines": {
|
||||
"node": ">=8.3.0"
|
||||
},
|
||||
|
@ -3955,11 +3958,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.13.1",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
|
||||
"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
|
||||
"version": "2.14.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz",
|
||||
"integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==",
|
||||
"dependencies": {
|
||||
"hasown": "^2.0.0"
|
||||
"hasown": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
|
@ -5024,7 +5030,7 @@
|
|||
"version": "19.2.0",
|
||||
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-19.2.0.tgz",
|
||||
"integrity": "sha512-rhr5ery8htpOTikmm/wrDU707wtmJ7ccX2WLkBf0A8eYYpscck5/iz04/fHOiIRWMFfnYOvaO9wNb4jcO3Mjyg==",
|
||||
"deprecated": "< 22.5.0 is no longer supported",
|
||||
"deprecated": "< 22.6.4 is no longer supported",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"cosmiconfig": "7.0.1",
|
||||
|
@ -7099,7 +7105,7 @@
|
|||
},
|
||||
"@rush-temp/applicationinsights-example-shared-worker": {
|
||||
"version": "file:projects\\applicationinsights-example-shared-worker.tgz",
|
||||
"integrity": "sha512-VrrfozxI9X33aXC6yGCBJH/LAGDpd4n+PB/9cq9n/6P2tpWbnSmwpVXXPBxF02wNqnyEoxuw8W4O3dYZDqnT8Q==",
|
||||
"integrity": "sha512-kX/MZZl8KKjBC7GLGTRVs2nniAR5uX/IT/C/gIoxo09C9NsURdZU1gpxBzPVuv1nwLkhqTK4LYTEcCcKcUrgHg==",
|
||||
"requires": {
|
||||
"@microsoft/dynamicproto-js": "^2.0.3",
|
||||
"@nevware21/grunt-eslint-ts": "^0.2.2",
|
||||
|
@ -7675,16 +7681,16 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.12.0.tgz",
|
||||
"integrity": "sha512-7F91fcbuDf/d3S8o21+r3ZncGIke/+eWk0EpO21LXhDfLahriZF9CGj4fbAetEjlaBdjdSm9a6VeXbpbT6Z40Q==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.13.1.tgz",
|
||||
"integrity": "sha512-kZqi+WZQaZfPKnsflLJQCz6Ze9FFSMfXrrIOcyargekQxG37ES7DJNpJUE9Q/X5n3yTIP/WPutVNzgknQ7biLg==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@eslint-community/regexpp": "^4.10.0",
|
||||
"@typescript-eslint/scope-manager": "7.12.0",
|
||||
"@typescript-eslint/type-utils": "7.12.0",
|
||||
"@typescript-eslint/utils": "7.12.0",
|
||||
"@typescript-eslint/visitor-keys": "7.12.0",
|
||||
"@typescript-eslint/scope-manager": "7.13.1",
|
||||
"@typescript-eslint/type-utils": "7.13.1",
|
||||
"@typescript-eslint/utils": "7.13.1",
|
||||
"@typescript-eslint/visitor-keys": "7.13.1",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.3.1",
|
||||
"natural-compare": "^1.4.0",
|
||||
|
@ -7692,54 +7698,54 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.12.0.tgz",
|
||||
"integrity": "sha512-dm/J2UDY3oV3TKius2OUZIFHsomQmpHtsV0FTh1WO8EKgHLQ1QCADUqscPgTpU+ih1e21FQSRjXckHn3txn6kQ==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.13.1.tgz",
|
||||
"integrity": "sha512-1ELDPlnLvDQ5ybTSrMhRTFDfOQEOXNM+eP+3HT/Yq7ruWpciQw+Avi73pdEbA4SooCawEWo3dtYbF68gN7Ed1A==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/scope-manager": "7.12.0",
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/typescript-estree": "7.12.0",
|
||||
"@typescript-eslint/visitor-keys": "7.12.0",
|
||||
"@typescript-eslint/scope-manager": "7.13.1",
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"@typescript-eslint/typescript-estree": "7.13.1",
|
||||
"@typescript-eslint/visitor-keys": "7.13.1",
|
||||
"debug": "^4.3.4"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/scope-manager": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.12.0.tgz",
|
||||
"integrity": "sha512-itF1pTnN6F3unPak+kutH9raIkL3lhH1YRPGgt7QQOh43DQKVJXmWkpb+vpc/TiDHs6RSd9CTbDsc/Y+Ygq7kg==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.13.1.tgz",
|
||||
"integrity": "sha512-adbXNVEs6GmbzaCpymHQ0MB6E4TqoiVbC0iqG3uijR8ZYfpAXMGttouQzF4Oat3P2GxDVIrg7bMI/P65LiQZdg==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/visitor-keys": "7.12.0"
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"@typescript-eslint/visitor-keys": "7.13.1"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/type-utils": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.12.0.tgz",
|
||||
"integrity": "sha512-lib96tyRtMhLxwauDWUp/uW3FMhLA6D0rJ8T7HmH7x23Gk1Gwwu8UZ94NMXBvOELn6flSPiBrCKlehkiXyaqwA==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.13.1.tgz",
|
||||
"integrity": "sha512-aWDbLu1s9bmgPGXSzNCxELu+0+HQOapV/y+60gPXafR8e2g1Bifxzevaa+4L2ytCWm+CHqpELq4CSoN9ELiwCg==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/typescript-estree": "7.12.0",
|
||||
"@typescript-eslint/utils": "7.12.0",
|
||||
"@typescript-eslint/typescript-estree": "7.13.1",
|
||||
"@typescript-eslint/utils": "7.13.1",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/types": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.12.0.tgz",
|
||||
"integrity": "sha512-o+0Te6eWp2ppKY3mLCU+YA9pVJxhUJE15FV7kxuD9jgwIAa+w/ycGJBMrYDTpVGUM/tgpa9SeMOugSabWFq7bg==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.13.1.tgz",
|
||||
"integrity": "sha512-7K7HMcSQIAND6RBL4kDl24sG/xKM13cA85dc7JnmQXw2cBDngg7c19B++JzvJHRG3zG36n9j1i451GBzRuHchw==",
|
||||
"peer": true
|
||||
},
|
||||
"@typescript-eslint/typescript-estree": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.12.0.tgz",
|
||||
"integrity": "sha512-5bwqLsWBULv1h6pn7cMW5dXX/Y2amRqLaKqsASVwbBHMZSnHqE/HN4vT4fE0aFsiwxYvr98kqOWh1a8ZKXalCQ==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.13.1.tgz",
|
||||
"integrity": "sha512-uxNr51CMV7npU1BxZzYjoVz9iyjckBduFBP0S5sLlh1tXYzHzgZ3BR9SVsNed+LmwKrmnqN3Kdl5t7eZ5TS1Yw==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/visitor-keys": "7.12.0",
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"@typescript-eslint/visitor-keys": "7.13.1",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
|
@ -7775,24 +7781,24 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/utils": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.12.0.tgz",
|
||||
"integrity": "sha512-Y6hhwxwDx41HNpjuYswYp6gDbkiZ8Hin9Bf5aJQn1bpTs3afYY4GX+MPYxma8jtoIV2GRwTM/UJm/2uGCVv+DQ==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.13.1.tgz",
|
||||
"integrity": "sha512-h5MzFBD5a/Gh/fvNdp9pTfqJAbuQC4sCN2WzuXme71lqFJsZtLbjxfSk4r3p02WIArOF9N94pdsLiGutpDbrXQ==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@typescript-eslint/scope-manager": "7.12.0",
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/typescript-estree": "7.12.0"
|
||||
"@typescript-eslint/scope-manager": "7.13.1",
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"@typescript-eslint/typescript-estree": "7.13.1"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/visitor-keys": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.12.0.tgz",
|
||||
"integrity": "sha512-uZk7DevrQLL3vSnfFl5bj4sL75qC9D6EdjemIdbtkuUmIheWpuiiylSY01JxJE7+zGrOWDZrp1WxOuDntvKrHQ==",
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.13.1.tgz",
|
||||
"integrity": "sha512-k/Bfne7lrP7hcb7m9zSsgcBmo+8eicqqfNAJ7uUY+jkTFpKeH2FSkWpFRtimBxgkyvqfu9jTPRbYOvud6isdXA==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "7.12.0",
|
||||
"@typescript-eslint/types": "7.13.1",
|
||||
"eslint-visitor-keys": "^3.4.3"
|
||||
}
|
||||
},
|
||||
|
@ -7808,9 +7814,9 @@
|
|||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||
},
|
||||
"acorn": {
|
||||
"version": "8.11.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
|
||||
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
|
||||
"version": "8.12.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz",
|
||||
"integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==",
|
||||
"peer": true
|
||||
},
|
||||
"acorn-jsx": {
|
||||
|
@ -8105,9 +8111,9 @@
|
|||
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001632",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001632.tgz",
|
||||
"integrity": "sha512-udx3o7yHJfUxMLkGohMlVHCvFvWmirKh9JAH/d7WOLPetlH+LTL5cocMZ0t7oZx/mdlOWXti97xLZWc8uURRHg=="
|
||||
"version": "1.0.30001636",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz",
|
||||
"integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg=="
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
|
@ -8397,9 +8403,9 @@
|
|||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.4.796",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.796.tgz",
|
||||
"integrity": "sha512-NglN/xprcM+SHD2XCli4oC6bWe6kHoytcyLKCWXmRL854F0qhPhaYgUswUsglnPxYaNQIg2uMY4BvaomIf3kLA=="
|
||||
"version": "1.4.807",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.807.tgz",
|
||||
"integrity": "sha512-kSmJl2ZwhNf/bcIuCH/imtNOKlpkLDn2jqT5FJ+/0CXjhnFaOa9cOe9gHKKy71eM49izwuQjZhKk+lWQ1JxB7A=="
|
||||
},
|
||||
"encodeurl": {
|
||||
"version": "1.0.2",
|
||||
|
@ -8523,9 +8529,9 @@
|
|||
}
|
||||
},
|
||||
"eslint-plugin-security": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-3.0.0.tgz",
|
||||
"integrity": "sha512-2Ij7PkmXIF2cKwoVkEgemwoXbOnxg5UfdhdcpNxZwJxC/10dbsdhHISrTyJ/n8DUkt3yiN6P1ywEgcMGjIwHIw==",
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-3.0.1.tgz",
|
||||
"integrity": "sha512-XjVGBhtDZJfyuhIxnQ/WMm385RbX3DBu7H1J7HNNhmB2tnGxMeqVSnYv79oAj992ayvIBZghsymwkYFS6cGH4Q==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"safe-regex": "^2.1.1"
|
||||
|
@ -9188,9 +9194,9 @@
|
|||
}
|
||||
},
|
||||
"ws": {
|
||||
"version": "7.5.9",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
|
||||
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
|
||||
"version": "7.5.10",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
|
||||
"integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
|
||||
"requires": {}
|
||||
}
|
||||
}
|
||||
|
@ -9380,11 +9386,11 @@
|
|||
}
|
||||
},
|
||||
"is-core-module": {
|
||||
"version": "2.13.1",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
|
||||
"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
|
||||
"version": "2.14.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz",
|
||||
"integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==",
|
||||
"requires": {
|
||||
"hasown": "^2.0.0"
|
||||
"hasown": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"is-extglob": {
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
"@microsoft/applicationinsights-shims": "3.0.1",
|
||||
"@microsoft/dynamicproto-js": "^2.0.3",
|
||||
"@microsoft/applicationinsights-web": "3.2.2",
|
||||
"@microsoft/applicationinsights-web-snippet": "1.2.2",
|
||||
"@microsoft/applicationinsights-web-snippet": "1.2.0",
|
||||
"@microsoft/applicationinsights-core-js": "3.2.2",
|
||||
"@nevware21/ts-utils": ">= 0.11.1 < 2.x"
|
||||
}
|
||||
|
|
28
gruntfile.js
28
gruntfile.js
|
@ -27,7 +27,7 @@ module.exports = function (grunt) {
|
|||
|
||||
}
|
||||
|
||||
function generateNewSnippet(connString) {
|
||||
function generateNewSnippet(prefix) {
|
||||
var srcPath = "./tools/applicationinsights-web-snippet/dist-es5";
|
||||
return {
|
||||
files: [{
|
||||
|
@ -38,21 +38,16 @@ module.exports = function (grunt) {
|
|||
}],
|
||||
options: {
|
||||
replacements: function() {
|
||||
var prefix = "IKey";
|
||||
var snippetBuffer = grunt.file.read("./tools/applicationinsights-web-snippet/build/output/snippet.min.js");
|
||||
if (connString) {
|
||||
if (prefix === "ConnString") {
|
||||
snippetBuffer = snippetBuffer.replace(/connectionString:\s*".*?"/gms, " connectionString: \"YOUR_CONNECTION_STRING\"");
|
||||
snippetBuffer = snippetBuffer.replace(/connectionString:\s*".*?"/gms, " connectionString: \"YOUR_CONNECTION_STRING\"");
|
||||
prefix = "ConnString";
|
||||
} else {
|
||||
} else if (prefix === "IKey") {
|
||||
snippetBuffer = snippetBuffer.replace(/connectionString:\s*".*?"/gms, " connectionString: \"InstrumentationKey=INSTRUMENTATION_KEY\"");
|
||||
snippetBuffer = snippetBuffer.replace(/connectionString:\s*".*?"/gms, " connectionString: \"InstrumentationKey=INSTRUMENTATION_KEY\"");
|
||||
let snippetBuffer2 = "cfg:{connectionString:\"YOUR_CONNECTION_STRING\"";
|
||||
console.log("what is it doing", snippetBuffer2.replace(/^\s*connectionString:\s*\".*\"/gm, " connectionString: \"InstrumentationKey=INSTRUMENTATION_KEY\""));
|
||||
} else if (prefix === "Origin") {
|
||||
snippetBuffer = grunt.file.read("./tools/applicationinsights-web-snippet/build/output/originSnippet.min.js");
|
||||
}
|
||||
var snippetStr = _encodeStr(snippetBuffer.toString());
|
||||
var expectedStr = `##replace${prefix}Snippet##`;
|
||||
console.log("change expectedStr to " + expectedStr);
|
||||
return [{
|
||||
pattern: expectedStr,
|
||||
replacement: snippetStr
|
||||
|
@ -779,10 +774,16 @@ module.exports = function (grunt) {
|
|||
'string-replace': {
|
||||
'generate-expanded-JS': expandJS(),
|
||||
'generate-expanded-min': expandMin(),
|
||||
'generate-snippet-ikey': generateNewSnippet(false),
|
||||
'generate-snippet-connString': generateNewSnippet(true)
|
||||
'generate-snippet-ikey': generateNewSnippet("IKey"),
|
||||
'generate-snippet-connString': generateNewSnippet("ConnString"),
|
||||
'generate-snippet-origin': generateNewSnippet("Origin")
|
||||
},
|
||||
copy: {
|
||||
"originSnippet": {
|
||||
files: [
|
||||
{ src: "./tools/applicationinsights-web-snippet/build/output/snippet.min.js", dest: `./tools/applicationinsights-web-snippet/build/output/originSnippet.min.js` }
|
||||
]
|
||||
},
|
||||
"snippet": {
|
||||
files: [
|
||||
{ src: "./tools/applicationinsights-web-snippet/build/output/snippet.js", dest: `./tools/applicationinsights-web-snippet/dist-es5/snippet.js` },
|
||||
|
@ -917,7 +918,8 @@ module.exports = function (grunt) {
|
|||
|
||||
grunt.registerTask("websnippet", tsBuildActions("applicationinsights-web-snippet"));
|
||||
grunt.registerTask("snippetCopy", ["copy:snippet"]);
|
||||
grunt.registerTask("websnippetReplace", ["string-replace:generate-expanded-JS", "copy:web-snippet", "string-replace:generate-expanded-min", "string-replace:generate-snippet-ikey", "string-replace:generate-snippet-connString"]);
|
||||
grunt.registerTask("originSnippetCopy", ["copy:originSnippet"]);
|
||||
grunt.registerTask("websnippetReplace", ["string-replace:generate-expanded-JS", "copy:web-snippet", "string-replace:generate-expanded-min", "string-replace:generate-snippet-ikey", "string-replace:generate-snippet-connString", "string-replace:generate-snippet-origin"]);
|
||||
|
||||
grunt.registerTask("snippet-restore", restoreTasks("applicationinsights-web-snippet"));
|
||||
grunt.registerTask("websnippettests", tsTestActions("applicationinsights-web-snippet"));
|
||||
|
|
|
@ -21,14 +21,27 @@ Import the helper function from the package to easily get the snippet
|
|||
import { getSdkLoaderScript } from "@microsoft/applicationinsights-web-snippet";
|
||||
```
|
||||
|
||||
Configure the snippet with your connectionString.
|
||||
Configure the snippet with your connectionString or other customerized field:
|
||||
```
|
||||
let config = {connectionString: "InstrumentationKey=xxx"};
|
||||
// or let config = {instrumentationKey: key};
|
||||
let config = {connectionString: "InstrumentationKey=xxx", name: "myAppInsights"};
|
||||
// or let config = {instrumentationKey: key, sri: true};
|
||||
let theSnippet = getSdkLoaderScript(config);
|
||||
```
|
||||
|
||||
### Multiple Snippet Run Simutinously (available since v1.2.0)
|
||||
Configure two snippets with different name.
|
||||
```
|
||||
let firstConfig = {connectionString: "InstrumentationKey=xxx", name: "firstAppInsights"};
|
||||
let firstSnippet = getSdkLoaderScript(firstConfig);
|
||||
let secondConfig = {connectionString: "InstrumentationKey=xxx", name: "secondAppInsights"};
|
||||
let secondSnippet = getSdkLoaderScript(secondConfig);
|
||||
```
|
||||
|
||||
### Snippet Run With Integrity Check and Minified Loading Time (available since v1.2.0)
|
||||
Configure the snippet with sri enabled.
|
||||
```
|
||||
let config = {connectionString: "InstrumentationKey=xxx", sri: true};
|
||||
```
|
||||
|
||||
More details on web snippet, see [Web Snippet](https://github.com/microsoft/ApplicationInsights-JS#snippet-setup-ignore-if-using-npm-setup).
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@microsoft/applicationinsights-web-snippet",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.0",
|
||||
"description": "Microsoft Application Insights Web Snippet",
|
||||
"main": "dist/es5/node/applicationinsights-web-snippet.js",
|
||||
"module": "dist-es5/applicationinsights-web-snippet.js",
|
||||
|
@ -15,8 +15,9 @@
|
|||
"build": "npm run build:esm && npm run snippet-generate && npm run build:browser && npm run dtsgen",
|
||||
"build:esm": "grunt websnippet ",
|
||||
"dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights Web Snippet\"",
|
||||
"snippet-generate": "npm run build:snippet && npm run replace && npm run snippetCopy",
|
||||
"snippet-generate": "npm run build:snippet && npm run originSnippetCopy && npm run replace && npm run snippetCopy",
|
||||
"snippetCopy": "grunt snippetCopy",
|
||||
"originSnippetCopy": "grunt originSnippetCopy",
|
||||
"build:snippet": "rollup -c rollupSnippet.config.js --bundleConfigAsCjs",
|
||||
"replace": "grunt websnippetReplace",
|
||||
"build:browser": "rollup -c rollup.config.js --bundleConfigAsCjs",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { SdkLoaderConfig } from "./type";
|
||||
import { ISnippetConfig, SdkLoaderConfig } from "./type";
|
||||
|
||||
const originSnippet = "##replaceOriginSnippet##";
|
||||
const webSnippet = "##replaceIKeySnippet##";
|
||||
const webSnippetCs = "##replaceConnStringSnippet##";
|
||||
|
||||
|
@ -13,13 +14,27 @@ function webSnippetVersion() {
|
|||
}
|
||||
|
||||
function getSdkLoaderScript(config: SdkLoaderConfig) {
|
||||
let snippet: string = webSnippetCs;
|
||||
if (config && config.connectionString) {
|
||||
snippet = webSnippetCs.replace("YOUR_CONNECTION_STRING", config.connectionString);
|
||||
} else if (config && config.instrumentationKey) {
|
||||
snippet = webSnippet.replace("InstrumentationKey=INSTRUMENTATION_KEY", config.instrumentationKey);
|
||||
let snippetConfig: ISnippetConfig = {
|
||||
src: config.src? config.src : "https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js",
|
||||
crossOrigin: config.crossOrigin ? config.crossOrigin : "anonymous",
|
||||
cfg: {},
|
||||
name: config.name ? config.name : "appInsights",
|
||||
ld: config.ld,
|
||||
useXhr: config.useXhr,
|
||||
cr: config.cr,
|
||||
dle: config.dle,
|
||||
sri: config.sri
|
||||
};
|
||||
|
||||
if (config.instrumentationKey) {
|
||||
snippetConfig.cfg.instrumentationKey = config.instrumentationKey;
|
||||
} else if (config.connectionString) {
|
||||
snippetConfig.cfg.connectionString = config.connectionString;
|
||||
}
|
||||
return snippet;
|
||||
|
||||
let configString = JSON.stringify(snippetConfig);
|
||||
let userSnippet = `!(function (cfg){${originSnippet}})(\n${configString}\n);`;
|
||||
return userSnippet;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
import { IConfiguration } from "@microsoft/applicationinsights-web";
|
||||
|
||||
// in the future, we can add more fields here
|
||||
export interface SdkLoaderConfig {
|
||||
instrumentationKey?: string;
|
||||
connectionString?: string;
|
||||
src?: string;
|
||||
name?: string;
|
||||
ld?: number;
|
||||
useXhr?: boolean;
|
||||
crossOrigin?: string;
|
||||
cfg?: IConfiguration;
|
||||
cr?: boolean;
|
||||
dle?: boolean;
|
||||
sri?: boolean;
|
||||
}
|
||||
|
||||
export interface ISnippetConfig {
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
},
|
||||
"@microsoft/applicationinsights-web-snippet": {
|
||||
"package": "tools/applicationinsights-web-snippet/package.json",
|
||||
"release": "1.2.2"
|
||||
"release": "1.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче