@wrdagency/react-islands 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ import { WebpackOptionsNormalized, Compiler } from 'webpack';
2
+
3
+ declare class ReactIslandsWebpackPlugin {
4
+ createSubCompiler(dir: string, entry: Record<string, any>, options: WebpackOptionsNormalized): Compiler;
5
+ apply(compiler: Compiler): Promise<void>;
6
+ }
7
+ declare function createIsland(name: string, Component: React.FC): void;
8
+
9
+ export { ReactIslandsWebpackPlugin, createIsland };
@@ -0,0 +1,9 @@
1
+ import { WebpackOptionsNormalized, Compiler } from 'webpack';
2
+
3
+ declare class ReactIslandsWebpackPlugin {
4
+ createSubCompiler(dir: string, entry: Record<string, any>, options: WebpackOptionsNormalized): Compiler;
5
+ apply(compiler: Compiler): Promise<void>;
6
+ }
7
+ declare function createIsland(name: string, Component: React.FC): void;
8
+
9
+ export { ReactIslandsWebpackPlugin, createIsland };
package/dist/index.js ADDED
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var __async = (__this, __arguments, generator) => {
30
+ return new Promise((resolve, reject) => {
31
+ var fulfilled = (value) => {
32
+ try {
33
+ step(generator.next(value));
34
+ } catch (e) {
35
+ reject(e);
36
+ }
37
+ };
38
+ var rejected = (value) => {
39
+ try {
40
+ step(generator.throw(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
46
+ step((generator = generator.apply(__this, __arguments)).next());
47
+ });
48
+ };
49
+
50
+ // src/index.ts
51
+ var src_exports = {};
52
+ __export(src_exports, {
53
+ ReactIslandsWebpackPlugin: () => ReactIslandsWebpackPlugin,
54
+ createIsland: () => createIsland
55
+ });
56
+ module.exports = __toCommonJS(src_exports);
57
+ var import_webpack = require("webpack");
58
+ var import_tmp = __toESM(require("tmp"));
59
+ var import_server = require("react-dom/server");
60
+ var import_client = require("react-dom/client");
61
+ import_tmp.default.setGracefulCleanup();
62
+ var ReactIslandsWebpackPlugin = class _ReactIslandsWebpackPlugin {
63
+ createSubCompiler(dir, entry, options) {
64
+ const plugins = options.plugins.filter(
65
+ (plugin) => !(plugin instanceof _ReactIslandsWebpackPlugin)
66
+ );
67
+ const compilerOptions = {
68
+ mode: "development",
69
+ target: "node",
70
+ context: process.cwd(),
71
+ entry,
72
+ output: {
73
+ libraryTarget: "commonjs",
74
+ path: dir,
75
+ filename: "[name].js"
76
+ },
77
+ module: options.module,
78
+ stats: false,
79
+ devtool: false,
80
+ optimization: {
81
+ minimize: false
82
+ },
83
+ plugins
84
+ };
85
+ return (0, import_webpack.webpack)(compilerOptions);
86
+ }
87
+ apply(compiler) {
88
+ return __async(this, null, function* () {
89
+ let components = [];
90
+ const options = compiler.options;
91
+ const entry = typeof options.entry === "function" ? yield options.entry() : options.entry;
92
+ const { name: dir } = import_tmp.default.dirSync();
93
+ const { RawSource } = compiler.webpack.sources;
94
+ compiler.hooks.run.tapAsync(
95
+ "ReactIslandsWebpackPlugin",
96
+ (compiler2, callback) => {
97
+ components = Object.keys(entry);
98
+ const subCompiler = this.createSubCompiler(dir, entry, options);
99
+ subCompiler.run((err, stats) => {
100
+ if (err) {
101
+ console.error(err);
102
+ throw new Error("ReactIslandsWebpackPlugin: Error during compile.");
103
+ }
104
+ if (stats == null ? void 0 : stats.hasErrors()) {
105
+ console.log(stats == null ? void 0 : stats.toString());
106
+ throw new Error("ReactIslandsWebpackPlugin: Failed to compile.");
107
+ }
108
+ callback();
109
+ console.log("ReactIslandsWebpackPlugin: Compilation complete.");
110
+ });
111
+ }
112
+ );
113
+ compiler.hooks.thisCompilation.tap(
114
+ "ReactIslandsWebpackPlugin",
115
+ (compilation) => {
116
+ for (const name of components) {
117
+ const file = `${dir}/${name}.js`;
118
+ const { default: component } = require(file);
119
+ const markup = (0, import_server.renderToStaticMarkup)(component());
120
+ compilation.emitAsset(`${name}.html`, new RawSource(markup));
121
+ }
122
+ }
123
+ );
124
+ });
125
+ }
126
+ };
127
+ function createIsland(name, Component) {
128
+ const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
129
+ if (isBrowser) {
130
+ document.querySelectorAll(`[data-react-component="${name}"]`).forEach((element) => {
131
+ const propsJSON = element.getAttribute("data-react-props") || "{}";
132
+ const props = JSON.parse(propsJSON);
133
+ (0, import_client.hydrateRoot)(element, Component(props));
134
+ });
135
+ }
136
+ }
137
+ // Annotate the CommonJS export names for ESM import in node:
138
+ 0 && (module.exports = {
139
+ ReactIslandsWebpackPlugin,
140
+ createIsland
141
+ });
142
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n\tCompilation,\n\tCompiler,\n\tConfiguration,\n\tWebpackOptionsNormalized,\n\twebpack,\n} from \"webpack\";\nimport tmp from \"tmp\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport { hydrateRoot } from \"react-dom/client\";\n\ntmp.setGracefulCleanup();\n\nexport class ReactIslandsWebpackPlugin {\n\tcreateSubCompiler(\n\t\tdir: string,\n\t\tentry: Record<string, any>,\n\t\toptions: WebpackOptionsNormalized\n\t): Compiler {\n\t\tconst plugins = options.plugins.filter(\n\t\t\t(plugin) => !(plugin instanceof ReactIslandsWebpackPlugin)\n\t\t);\n\n\t\tconst compilerOptions: Configuration = {\n\t\t\tmode: \"development\",\n\t\t\ttarget: \"node\",\n\t\t\tcontext: process.cwd(),\n\t\t\tentry,\n\t\t\toutput: {\n\t\t\t\tlibraryTarget: \"commonjs\",\n\t\t\t\tpath: dir,\n\t\t\t\tfilename: \"[name].js\",\n\t\t\t},\n\t\t\tmodule: options.module,\n\t\t\tstats: false,\n\t\t\tdevtool: false,\n\t\t\toptimization: {\n\t\t\t\tminimize: false,\n\t\t\t},\n\t\t\tplugins,\n\t\t};\n\n\t\treturn webpack(compilerOptions);\n\t}\n\n\tasync apply(compiler: Compiler) {\n\t\tlet components: string[] = [];\n\n\t\tconst options = compiler.options;\n\n\t\tconst entry =\n\t\t\ttypeof options.entry === \"function\"\n\t\t\t\t? await options.entry()\n\t\t\t\t: options.entry;\n\n\t\tconst { name: dir } = tmp.dirSync();\n\n\t\tconst { RawSource } = compiler.webpack.sources;\n\n\t\tcompiler.hooks.run.tapAsync(\n\t\t\t\"ReactIslandsWebpackPlugin\",\n\t\t\t(compiler: Compiler, callback) => {\n\t\t\t\tcomponents = Object.keys(entry);\n\n\t\t\t\tconst subCompiler = this.createSubCompiler(dir, entry, options);\n\n\t\t\t\tsubCompiler.run((err, stats) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\tthrow new Error(\"ReactIslandsWebpackPlugin: Error during compile.\");\n\t\t\t\t\t}\n\n\t\t\t\t\tif (stats?.hasErrors()) {\n\t\t\t\t\t\tconsole.log(stats?.toString());\n\t\t\t\t\t\tthrow new Error(\"ReactIslandsWebpackPlugin: Failed to compile.\");\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback();\n\t\t\t\t\tconsole.log(\"ReactIslandsWebpackPlugin: Compilation complete.\");\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\n\t\tcompiler.hooks.thisCompilation.tap(\n\t\t\t\"ReactIslandsWebpackPlugin\",\n\t\t\t(compilation: Compilation) => {\n\t\t\t\tfor (const name of components) {\n\t\t\t\t\tconst file = `${dir}/${name}.js`;\n\t\t\t\t\tconst { default: component } = require(file);\n\n\t\t\t\t\tconst markup = renderToStaticMarkup(component());\n\n\t\t\t\t\tcompilation.emitAsset(`${name}.html`, new RawSource(markup));\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n}\n\nexport function createIsland(name: string, Component: React.FC) {\n\tconst isBrowser =\n\t\ttypeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\n\tif (isBrowser) {\n\t\tdocument\n\t\t\t.querySelectorAll(`[data-react-component=\"${name}\"]`)\n\t\t\t.forEach((element) => {\n\t\t\t\tconst propsJSON = element.getAttribute(\"data-react-props\") || \"{}\";\n\t\t\t\tconst props = JSON.parse(propsJSON);\n\t\t\t\thydrateRoot(element, Component(props));\n\t\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAMO;AACP,iBAAgB;AAChB,oBAAqC;AACrC,oBAA4B;AAE5B,WAAAA,QAAI,mBAAmB;AAEhB,IAAM,4BAAN,MAAM,2BAA0B;AAAA,EACtC,kBACC,KACA,OACA,SACW;AACX,UAAM,UAAU,QAAQ,QAAQ;AAAA,MAC/B,CAAC,WAAW,EAAE,kBAAkB;AAAA,IACjC;AAEA,UAAM,kBAAiC;AAAA,MACtC,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,SAAS,QAAQ,IAAI;AAAA,MACrB;AAAA,MACA,QAAQ;AAAA,QACP,eAAe;AAAA,QACf,MAAM;AAAA,QACN,UAAU;AAAA,MACX;AAAA,MACA,QAAQ,QAAQ;AAAA,MAChB,OAAO;AAAA,MACP,SAAS;AAAA,MACT,cAAc;AAAA,QACb,UAAU;AAAA,MACX;AAAA,MACA;AAAA,IACD;AAEA,eAAO,wBAAQ,eAAe;AAAA,EAC/B;AAAA,EAEM,MAAM,UAAoB;AAAA;AAC/B,UAAI,aAAuB,CAAC;AAE5B,YAAM,UAAU,SAAS;AAEzB,YAAM,QACL,OAAO,QAAQ,UAAU,aACtB,MAAM,QAAQ,MAAM,IACpB,QAAQ;AAEZ,YAAM,EAAE,MAAM,IAAI,IAAI,WAAAA,QAAI,QAAQ;AAElC,YAAM,EAAE,UAAU,IAAI,SAAS,QAAQ;AAEvC,eAAS,MAAM,IAAI;AAAA,QAClB;AAAA,QACA,CAACC,WAAoB,aAAa;AACjC,uBAAa,OAAO,KAAK,KAAK;AAE9B,gBAAM,cAAc,KAAK,kBAAkB,KAAK,OAAO,OAAO;AAE9D,sBAAY,IAAI,CAAC,KAAK,UAAU;AAC/B,gBAAI,KAAK;AACR,sBAAQ,MAAM,GAAG;AACjB,oBAAM,IAAI,MAAM,kDAAkD;AAAA,YACnE;AAEA,gBAAI,+BAAO,aAAa;AACvB,sBAAQ,IAAI,+BAAO,UAAU;AAC7B,oBAAM,IAAI,MAAM,+CAA+C;AAAA,YAChE;AAEA,qBAAS;AACT,oBAAQ,IAAI,kDAAkD;AAAA,UAC/D,CAAC;AAAA,QACF;AAAA,MACD;AAEA,eAAS,MAAM,gBAAgB;AAAA,QAC9B;AAAA,QACA,CAAC,gBAA6B;AAC7B,qBAAW,QAAQ,YAAY;AAC9B,kBAAM,OAAO,GAAG,GAAG,IAAI,IAAI;AAC3B,kBAAM,EAAE,SAAS,UAAU,IAAI,QAAQ,IAAI;AAE3C,kBAAM,aAAS,oCAAqB,UAAU,CAAC;AAE/C,wBAAY,UAAU,GAAG,IAAI,SAAS,IAAI,UAAU,MAAM,CAAC;AAAA,UAC5D;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA;AACD;AAEO,SAAS,aAAa,MAAc,WAAqB;AAC/D,QAAM,YACL,OAAO,WAAW,eAAe,OAAO,OAAO,aAAa;AAE7D,MAAI,WAAW;AACd,aACE,iBAAiB,0BAA0B,IAAI,IAAI,EACnD,QAAQ,CAAC,YAAY;AACrB,YAAM,YAAY,QAAQ,aAAa,kBAAkB,KAAK;AAC9D,YAAM,QAAQ,KAAK,MAAM,SAAS;AAClC,qCAAY,SAAS,UAAU,KAAK,CAAC;AAAA,IACtC,CAAC;AAAA,EACH;AACD;","names":["tmp","compiler"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,116 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+ var __async = (__this, __arguments, generator) => {
9
+ return new Promise((resolve, reject) => {
10
+ var fulfilled = (value) => {
11
+ try {
12
+ step(generator.next(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var rejected = (value) => {
18
+ try {
19
+ step(generator.throw(value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ };
24
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
25
+ step((generator = generator.apply(__this, __arguments)).next());
26
+ });
27
+ };
28
+
29
+ // src/index.ts
30
+ import {
31
+ webpack
32
+ } from "webpack";
33
+ import tmp from "tmp";
34
+ import { renderToStaticMarkup } from "react-dom/server";
35
+ import { hydrateRoot } from "react-dom/client";
36
+ tmp.setGracefulCleanup();
37
+ var ReactIslandsWebpackPlugin = class _ReactIslandsWebpackPlugin {
38
+ createSubCompiler(dir, entry, options) {
39
+ const plugins = options.plugins.filter(
40
+ (plugin) => !(plugin instanceof _ReactIslandsWebpackPlugin)
41
+ );
42
+ const compilerOptions = {
43
+ mode: "development",
44
+ target: "node",
45
+ context: process.cwd(),
46
+ entry,
47
+ output: {
48
+ libraryTarget: "commonjs",
49
+ path: dir,
50
+ filename: "[name].js"
51
+ },
52
+ module: options.module,
53
+ stats: false,
54
+ devtool: false,
55
+ optimization: {
56
+ minimize: false
57
+ },
58
+ plugins
59
+ };
60
+ return webpack(compilerOptions);
61
+ }
62
+ apply(compiler) {
63
+ return __async(this, null, function* () {
64
+ let components = [];
65
+ const options = compiler.options;
66
+ const entry = typeof options.entry === "function" ? yield options.entry() : options.entry;
67
+ const { name: dir } = tmp.dirSync();
68
+ const { RawSource } = compiler.webpack.sources;
69
+ compiler.hooks.run.tapAsync(
70
+ "ReactIslandsWebpackPlugin",
71
+ (compiler2, callback) => {
72
+ components = Object.keys(entry);
73
+ const subCompiler = this.createSubCompiler(dir, entry, options);
74
+ subCompiler.run((err, stats) => {
75
+ if (err) {
76
+ console.error(err);
77
+ throw new Error("ReactIslandsWebpackPlugin: Error during compile.");
78
+ }
79
+ if (stats == null ? void 0 : stats.hasErrors()) {
80
+ console.log(stats == null ? void 0 : stats.toString());
81
+ throw new Error("ReactIslandsWebpackPlugin: Failed to compile.");
82
+ }
83
+ callback();
84
+ console.log("ReactIslandsWebpackPlugin: Compilation complete.");
85
+ });
86
+ }
87
+ );
88
+ compiler.hooks.thisCompilation.tap(
89
+ "ReactIslandsWebpackPlugin",
90
+ (compilation) => {
91
+ for (const name of components) {
92
+ const file = `${dir}/${name}.js`;
93
+ const { default: component } = __require(file);
94
+ const markup = renderToStaticMarkup(component());
95
+ compilation.emitAsset(`${name}.html`, new RawSource(markup));
96
+ }
97
+ }
98
+ );
99
+ });
100
+ }
101
+ };
102
+ function createIsland(name, Component) {
103
+ const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
104
+ if (isBrowser) {
105
+ document.querySelectorAll(`[data-react-component="${name}"]`).forEach((element) => {
106
+ const propsJSON = element.getAttribute("data-react-props") || "{}";
107
+ const props = JSON.parse(propsJSON);
108
+ hydrateRoot(element, Component(props));
109
+ });
110
+ }
111
+ }
112
+ export {
113
+ ReactIslandsWebpackPlugin,
114
+ createIsland
115
+ };
116
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n\tCompilation,\n\tCompiler,\n\tConfiguration,\n\tWebpackOptionsNormalized,\n\twebpack,\n} from \"webpack\";\nimport tmp from \"tmp\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport { hydrateRoot } from \"react-dom/client\";\n\ntmp.setGracefulCleanup();\n\nexport class ReactIslandsWebpackPlugin {\n\tcreateSubCompiler(\n\t\tdir: string,\n\t\tentry: Record<string, any>,\n\t\toptions: WebpackOptionsNormalized\n\t): Compiler {\n\t\tconst plugins = options.plugins.filter(\n\t\t\t(plugin) => !(plugin instanceof ReactIslandsWebpackPlugin)\n\t\t);\n\n\t\tconst compilerOptions: Configuration = {\n\t\t\tmode: \"development\",\n\t\t\ttarget: \"node\",\n\t\t\tcontext: process.cwd(),\n\t\t\tentry,\n\t\t\toutput: {\n\t\t\t\tlibraryTarget: \"commonjs\",\n\t\t\t\tpath: dir,\n\t\t\t\tfilename: \"[name].js\",\n\t\t\t},\n\t\t\tmodule: options.module,\n\t\t\tstats: false,\n\t\t\tdevtool: false,\n\t\t\toptimization: {\n\t\t\t\tminimize: false,\n\t\t\t},\n\t\t\tplugins,\n\t\t};\n\n\t\treturn webpack(compilerOptions);\n\t}\n\n\tasync apply(compiler: Compiler) {\n\t\tlet components: string[] = [];\n\n\t\tconst options = compiler.options;\n\n\t\tconst entry =\n\t\t\ttypeof options.entry === \"function\"\n\t\t\t\t? await options.entry()\n\t\t\t\t: options.entry;\n\n\t\tconst { name: dir } = tmp.dirSync();\n\n\t\tconst { RawSource } = compiler.webpack.sources;\n\n\t\tcompiler.hooks.run.tapAsync(\n\t\t\t\"ReactIslandsWebpackPlugin\",\n\t\t\t(compiler: Compiler, callback) => {\n\t\t\t\tcomponents = Object.keys(entry);\n\n\t\t\t\tconst subCompiler = this.createSubCompiler(dir, entry, options);\n\n\t\t\t\tsubCompiler.run((err, stats) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\tthrow new Error(\"ReactIslandsWebpackPlugin: Error during compile.\");\n\t\t\t\t\t}\n\n\t\t\t\t\tif (stats?.hasErrors()) {\n\t\t\t\t\t\tconsole.log(stats?.toString());\n\t\t\t\t\t\tthrow new Error(\"ReactIslandsWebpackPlugin: Failed to compile.\");\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback();\n\t\t\t\t\tconsole.log(\"ReactIslandsWebpackPlugin: Compilation complete.\");\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\n\t\tcompiler.hooks.thisCompilation.tap(\n\t\t\t\"ReactIslandsWebpackPlugin\",\n\t\t\t(compilation: Compilation) => {\n\t\t\t\tfor (const name of components) {\n\t\t\t\t\tconst file = `${dir}/${name}.js`;\n\t\t\t\t\tconst { default: component } = require(file);\n\n\t\t\t\t\tconst markup = renderToStaticMarkup(component());\n\n\t\t\t\t\tcompilation.emitAsset(`${name}.html`, new RawSource(markup));\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n}\n\nexport function createIsland(name: string, Component: React.FC) {\n\tconst isBrowser =\n\t\ttypeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\n\tif (isBrowser) {\n\t\tdocument\n\t\t\t.querySelectorAll(`[data-react-component=\"${name}\"]`)\n\t\t\t.forEach((element) => {\n\t\t\t\tconst propsJSON = element.getAttribute(\"data-react-props\") || \"{}\";\n\t\t\t\tconst props = JSON.parse(propsJSON);\n\t\t\t\thydrateRoot(element, Component(props));\n\t\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EAKC;AAAA,OACM;AACP,OAAO,SAAS;AAChB,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAE5B,IAAI,mBAAmB;AAEhB,IAAM,4BAAN,MAAM,2BAA0B;AAAA,EACtC,kBACC,KACA,OACA,SACW;AACX,UAAM,UAAU,QAAQ,QAAQ;AAAA,MAC/B,CAAC,WAAW,EAAE,kBAAkB;AAAA,IACjC;AAEA,UAAM,kBAAiC;AAAA,MACtC,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,SAAS,QAAQ,IAAI;AAAA,MACrB;AAAA,MACA,QAAQ;AAAA,QACP,eAAe;AAAA,QACf,MAAM;AAAA,QACN,UAAU;AAAA,MACX;AAAA,MACA,QAAQ,QAAQ;AAAA,MAChB,OAAO;AAAA,MACP,SAAS;AAAA,MACT,cAAc;AAAA,QACb,UAAU;AAAA,MACX;AAAA,MACA;AAAA,IACD;AAEA,WAAO,QAAQ,eAAe;AAAA,EAC/B;AAAA,EAEM,MAAM,UAAoB;AAAA;AAC/B,UAAI,aAAuB,CAAC;AAE5B,YAAM,UAAU,SAAS;AAEzB,YAAM,QACL,OAAO,QAAQ,UAAU,aACtB,MAAM,QAAQ,MAAM,IACpB,QAAQ;AAEZ,YAAM,EAAE,MAAM,IAAI,IAAI,IAAI,QAAQ;AAElC,YAAM,EAAE,UAAU,IAAI,SAAS,QAAQ;AAEvC,eAAS,MAAM,IAAI;AAAA,QAClB;AAAA,QACA,CAACA,WAAoB,aAAa;AACjC,uBAAa,OAAO,KAAK,KAAK;AAE9B,gBAAM,cAAc,KAAK,kBAAkB,KAAK,OAAO,OAAO;AAE9D,sBAAY,IAAI,CAAC,KAAK,UAAU;AAC/B,gBAAI,KAAK;AACR,sBAAQ,MAAM,GAAG;AACjB,oBAAM,IAAI,MAAM,kDAAkD;AAAA,YACnE;AAEA,gBAAI,+BAAO,aAAa;AACvB,sBAAQ,IAAI,+BAAO,UAAU;AAC7B,oBAAM,IAAI,MAAM,+CAA+C;AAAA,YAChE;AAEA,qBAAS;AACT,oBAAQ,IAAI,kDAAkD;AAAA,UAC/D,CAAC;AAAA,QACF;AAAA,MACD;AAEA,eAAS,MAAM,gBAAgB;AAAA,QAC9B;AAAA,QACA,CAAC,gBAA6B;AAC7B,qBAAW,QAAQ,YAAY;AAC9B,kBAAM,OAAO,GAAG,GAAG,IAAI,IAAI;AAC3B,kBAAM,EAAE,SAAS,UAAU,IAAI,UAAQ,IAAI;AAE3C,kBAAM,SAAS,qBAAqB,UAAU,CAAC;AAE/C,wBAAY,UAAU,GAAG,IAAI,SAAS,IAAI,UAAU,MAAM,CAAC;AAAA,UAC5D;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA;AACD;AAEO,SAAS,aAAa,MAAc,WAAqB;AAC/D,QAAM,YACL,OAAO,WAAW,eAAe,OAAO,OAAO,aAAa;AAE7D,MAAI,WAAW;AACd,aACE,iBAAiB,0BAA0B,IAAI,IAAI,EACnD,QAAQ,CAAC,YAAY;AACrB,YAAM,YAAY,QAAQ,aAAa,kBAAkB,KAAK;AAC9D,YAAM,QAAQ,KAAK,MAAM,SAAS;AAClC,kBAAY,SAAS,UAAU,KAAK,CAAC;AAAA,IACtC,CAAC;AAAA,EACH;AACD;","names":["compiler"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrdagency/react-islands",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -19,14 +19,16 @@
19
19
  "@types/react-dom": "^18.2.23",
20
20
  "@types/tmp": "^0.2.6",
21
21
  "@types/webpack": "^5.28.5",
22
- "react-dom": "^18.2.0",
23
- "tmp": "^0.2.3",
24
22
  "tsup": "^8.0.2",
25
- "typescript": "^5.4.3",
26
- "webpack": "^5.91.0"
23
+ "typescript": "^5.4.3"
27
24
  },
28
25
  "repository": {
29
26
  "type": "git",
30
27
  "url": "https://github.com/kyletcooper/react-islands"
28
+ },
29
+ "dependencies": {
30
+ "react-dom": "^18.2.0",
31
+ "tmp": "^0.2.3",
32
+ "webpack": "^5.91.0"
31
33
  }
32
34
  }
package/tsup.config.ts CHANGED
@@ -7,12 +7,4 @@ export default defineConfig({
7
7
  splitting: false,
8
8
  sourcemap: true,
9
9
  clean: true,
10
- external: [
11
- "@swc/core",
12
- "uglify-js",
13
- "esbuild",
14
- "./processChild",
15
- "./minify",
16
- "watchpack",
17
- ],
18
10
  });