Skip to content

Commit 7ac914b

Browse files
authored
Update publishing.md
1 parent a528b22 commit 7ac914b

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

design/publishing.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
This design document focuses on the following -
1+
##### This design document focuses on the following -
22
1. Separate entry points for node and browser.
33
2. Specifying the browser field in package.json
44
3. Changes in the bundling process
55

6-
Terms -
6+
##### Terms -
77

88
bundler - Module bundlers are tools frontend developers used to bundle JavaScript modules into a single JavaScript files that can be executed in the browser.
99

@@ -14,7 +14,7 @@ package.json fields -
1414

1515
* browser - If your module is meant to be used client-side the browser field should be used instead of the main field.
1616

17-
Current set up -
17+
##### Current set up -
1818

1919
1.
2020
TypeScript Source Code
@@ -26,11 +26,30 @@ Current set up -
2626
module - `lib/src/es/index.js`
2727

2828
3. Rollup bundling output
29-
* graph-js-sdk.js - IIFE bundled file. This file can be directly used in the browser with a `<script>` tag.
29+
* graph-js-sdk.js - IIFE bundled minified file. This file can be directly used in the browser with a `<script>` tag.
3030
* graph-es-sdk.js - ES bundled file.
3131
4. Entry point for rollup - `lib/es/browser/index.js`.
32-
5.
3332

34-
Upcoming changes -
35-
36-
1. Bundle the authproviders serately as they are optional.
33+
##### Difference between src/index.js and src/browser/index.js
34+
1. src/browser/index.js does not export 'RedirectHandler' and 'RedirectHandlerOptions'. Redirection is handled by the browser.
35+
2. src/index.js exports-> src/ImplicitMsalProvider and src/browser/index.js exports src/browser/ImplicitMsalProvider.
36+
3. Only difference in the implementation is that src/browser/ImplicitMsalProvider does not import or require 'msal' dependency.
37+
38+
Presently, some browser applications importing the npm package like Graph Explorer use lib/es/src/index.js and not the browser/index.js.
39+
40+
##### Upcoming changes -
41+
42+
1. Use the browser field for the following -
43+
44+
* We currently have two entry files, src/index.ts and src/browser/index.ts.
45+
Use the browser field to indicate the browser entry point.
46+
Example -
47+
"browser":
48+
{ "lib/es/index.node.js": "lib/es/index.browser.js" }
49+
Currently, we have the main and "module field in the package.json. This will remain the same.
50+
2. Better way to handle environment specific implementation. For example, using the browser field we can indicate as follows -
51+
"browser":
52+
{ "stream": "stream-browserify" }
53+
3. Maintain a separate entry point for the rollup process.
54+
4. Continue rolling up the src/browser/ImplicitMsalProvider as we currently do and not introduce breaking changes here as we are planning to deprecate this.
55+
5. Bundle the authproviders separately as they are optional.

0 commit comments

Comments
 (0)