@batijs/cli 0.0.261 → 0.0.262

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.
Files changed (34) hide show
  1. package/dist/boilerplates/@batijs/plain-sentry/files/$package.json.js +117 -0
  2. package/dist/boilerplates/@batijs/plain-sentry/files/pages/sentry/+Page.js +19 -0
  3. package/dist/boilerplates/@batijs/plain-sentry/files/pages/sentry/+client.js +37 -0
  4. package/dist/boilerplates/@batijs/plain-sentry/files/sentry.browser.config.ts +25 -0
  5. package/dist/boilerplates/@batijs/plain-sentry/files/vite-env.d.ts +1 -0
  6. package/dist/boilerplates/@batijs/plain-sentry/types/pages/sentry/+Page.d.ts +1 -0
  7. package/dist/boilerplates/@batijs/plain-sentry/types/pages/sentry/+client.d.ts +6 -0
  8. package/dist/boilerplates/@batijs/plain-sentry/types/sentry.browser.config.d.ts +1 -0
  9. package/dist/boilerplates/@batijs/prettier/files/.prettierignore +3 -0
  10. package/dist/boilerplates/@batijs/react-sentry/files/$package.json.js +101 -0
  11. package/dist/boilerplates/@batijs/react-sentry/files/pages/sentry/+Page.tsx +43 -0
  12. package/dist/boilerplates/@batijs/react-sentry/files/sentry.browser.config.ts +22 -0
  13. package/dist/boilerplates/@batijs/react-sentry/types/pages/sentry/+Page.d.ts +1 -0
  14. package/dist/boilerplates/@batijs/react-sentry/types/sentry.browser.config.d.ts +1 -0
  15. package/dist/boilerplates/@batijs/sentry/files/$.env.js +22 -0
  16. package/dist/boilerplates/@batijs/sentry/files/$README.md.js +31 -0
  17. package/dist/boilerplates/@batijs/sentry/files/$package.json.js +86 -0
  18. package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +18 -0
  19. package/dist/boilerplates/@batijs/sentry/files/.env.sentry-build-plugin +8 -0
  20. package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +23 -0
  21. package/dist/boilerplates/@batijs/shared/files/.gitignore +3 -0
  22. package/dist/boilerplates/@batijs/solid-sentry/files/$package.json.js +99 -0
  23. package/dist/boilerplates/@batijs/solid-sentry/files/pages/sentry/+Page.tsx +47 -0
  24. package/dist/boilerplates/@batijs/solid-sentry/files/sentry.browser.config.ts +22 -0
  25. package/dist/boilerplates/@batijs/solid-sentry/types/pages/sentry/+Page.d.ts +1 -0
  26. package/dist/boilerplates/@batijs/solid-sentry/types/sentry.browser.config.d.ts +1 -0
  27. package/dist/boilerplates/@batijs/vue/files/layouts/LayoutDefault.vue +3 -0
  28. package/dist/boilerplates/@batijs/vue-sentry/files/$package.json.js +93 -0
  29. package/dist/boilerplates/@batijs/vue-sentry/files/pages/sentry/+Page.vue +33 -0
  30. package/dist/boilerplates/@batijs/vue-sentry/files/sentry.browser.config.ts +25 -0
  31. package/dist/boilerplates/@batijs/vue-sentry/types/sentry.browser.config.d.ts +1 -0
  32. package/dist/boilerplates/boilerplates.json +88 -0
  33. package/dist/index.js +1 -1
  34. package/package.json +5 -5
@@ -0,0 +1,117 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // package.json
28
+ var require_package = __commonJS({
29
+ "package.json"(exports, module) {
30
+ module.exports = {
31
+ name: "@batijs/plain-sentry",
32
+ private: true,
33
+ version: "0.0.1",
34
+ description: "",
35
+ type: "module",
36
+ scripts: {
37
+ "check-types": "tsc --noEmit",
38
+ build: "bati-compile-boilerplate"
39
+ },
40
+ keywords: [],
41
+ author: "",
42
+ license: "MIT",
43
+ devDependencies: {
44
+ "@batijs/compile": "workspace:*",
45
+ "@batijs/sentry": "workspace:*",
46
+ "@sentry/browser": "^8.27.0",
47
+ "@types/node": "^18.19.14",
48
+ vite: "^5.4.2"
49
+ },
50
+ dependencies: {
51
+ "@batijs/core": "workspace:*"
52
+ },
53
+ files: [
54
+ "dist/"
55
+ ],
56
+ bati: {
57
+ if: {
58
+ $and: [
59
+ {
60
+ flag: "sentry"
61
+ },
62
+ {
63
+ flag: {
64
+ $not: {
65
+ $in: [
66
+ "react",
67
+ "vue",
68
+ "solid",
69
+ "svelte",
70
+ "preact",
71
+ "angular"
72
+ ]
73
+ }
74
+ }
75
+ }
76
+ ]
77
+ }
78
+ },
79
+ exports: {
80
+ "./sentry.browser.config": {
81
+ types: "./dist/types/sentry.browser.config.d.ts"
82
+ },
83
+ "./pages/sentry/+Page": {
84
+ types: "./dist/types/pages/sentry/+Page.d.ts"
85
+ },
86
+ "./pages/sentry/+client": {
87
+ types: "./dist/types/pages/sentry/+client.d.ts"
88
+ }
89
+ },
90
+ typesVersions: {
91
+ "*": {
92
+ "sentry.browser.config": [
93
+ "./dist/types/sentry.browser.config.d.ts"
94
+ ],
95
+ "pages/sentry/+Page": [
96
+ "./dist/types/pages/sentry/+Page.d.ts"
97
+ ],
98
+ "pages/sentry/+client": [
99
+ "./dist/types/pages/sentry/+client.d.ts"
100
+ ]
101
+ }
102
+ }
103
+ };
104
+ }
105
+ });
106
+
107
+ // files/$package.json.ts
108
+ import { addDependency, loadAsJson } from "@batijs/core";
109
+ async function getPackageJson(props) {
110
+ const packageJson = await loadAsJson(props);
111
+ return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
112
+ dependencies: ["@sentry/browser"]
113
+ });
114
+ }
115
+ export {
116
+ getPackageJson as default
117
+ };
@@ -0,0 +1,19 @@
1
+ export { Page };
2
+
3
+ function Page() {
4
+ // language=HTML
5
+ return `
6
+ <h1>Sentry Test Page</h1>
7
+ <p id="sentry_state" style="color:red">
8
+ Sentry Client is not initialized! Vite Mode: ${import.meta.env.PROD ? "PROD" : "DEV"}
9
+ </p>
10
+ <p id="sentry_dsn" style="color:red">
11
+ Sentry Client DSN is missing! Vite Mode: ${import.meta.env.PROD ? "PROD" : "DEV"}
12
+ </p>
13
+ <div>
14
+ <button id="errorButton">
15
+ Throw JavaScript Error
16
+ </button>
17
+ </div>
18
+ `;
19
+ }
@@ -0,0 +1,37 @@
1
+ import "../+client";
2
+ /**
3
+ * @typedef {Object} SentryClient
4
+ * @property {function(): SentryOptions} getOptions
5
+ */
6
+
7
+ /**
8
+ * @typedef {Object} SentryOptions
9
+ * @property {string} dsn
10
+ */
11
+
12
+ /**
13
+ * @type {Window & { Sentry?: { getClient: () => SentryClient } }}
14
+ */
15
+ const globalWindow = globalThis?.window;
16
+
17
+ if (typeof window !== "undefined") {
18
+ const window = globalThis?.window;
19
+
20
+ window.onload = function () {
21
+ const options = globalWindow?.Sentry?.getClient()?.getOptions();
22
+ if (options) {
23
+ const elmSentryState = document?.getElementById("sentry_state");
24
+ if (elmSentryState) elmSentryState.hidden = true;
25
+ if (options?.dsn?.length > 1) {
26
+ const elmSentryDSN = document?.getElementById("sentry_dsn");
27
+ if (elmSentryDSN) elmSentryDSN.hidden = true;
28
+ }
29
+ }
30
+
31
+ const elmSentryButton = document?.getElementById("errorButton");
32
+ if (elmSentryButton)
33
+ elmSentryButton.addEventListener("click", function () {
34
+ throw new Error("This is a SENTRY Browser Test!");
35
+ });
36
+ };
37
+ }
@@ -0,0 +1,25 @@
1
+ import * as Sentry from "@sentry/browser";
2
+
3
+ export const sentryBrowserConfig = () => {
4
+ // eslint-disable-next-line
5
+ import.meta.env.PROD === true &&
6
+ Sentry.init({
7
+ dsn: import.meta.env.PUBLIC_ENV__SENTRY_DSN,
8
+ environment: "production-frontend",
9
+ //enabled: import.meta.env.DEV ? false : true,
10
+ integrations: [Sentry.replayIntegration()],
11
+ autoSessionTracking: globalThis?.window?.document ? true : false, // disable autoSessionTracking in SSR
12
+ // Set tracesSampleRate to 1.0 to capture 100%
13
+ // of transactions for tracing.
14
+ tracesSampleRate: 1.0,
15
+ // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
16
+ tracePropagationTargets: [/^\//, /^https:\/\/yourserver\.io\/api/],
17
+ // Capture Replay for 10% of all sessions,
18
+ // plus for 100% of sessions with an error
19
+ replaysSessionSampleRate: 0.1,
20
+ replaysOnErrorSampleRate: 1.0,
21
+ });
22
+
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ (window as any).Sentry = Sentry;
25
+ };
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1 @@
1
+ export function Page(): string;
@@ -0,0 +1,6 @@
1
+ export type SentryClient = {
2
+ getOptions: () => SentryOptions;
3
+ };
4
+ export type SentryOptions = {
5
+ dsn: string;
6
+ };
@@ -0,0 +1 @@
1
+ export declare const sentryBrowserConfig: () => void;
@@ -133,3 +133,6 @@ dist
133
133
 
134
134
  # Cloudflare
135
135
  .wrangler/
136
+
137
+ # Sentry Vite Plugin
138
+ .env.sentry-build-plugin
@@ -0,0 +1,101 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // package.json
28
+ var require_package = __commonJS({
29
+ "package.json"(exports, module) {
30
+ module.exports = {
31
+ name: "@batijs/react-sentry",
32
+ private: true,
33
+ version: "0.0.1",
34
+ description: "",
35
+ type: "module",
36
+ scripts: {
37
+ "check-types": "tsc --noEmit",
38
+ build: "bati-compile-boilerplate"
39
+ },
40
+ keywords: [],
41
+ author: "",
42
+ license: "MIT",
43
+ devDependencies: {
44
+ "@batijs/compile": "workspace:*",
45
+ "@sentry/react": "^8.27.0",
46
+ "@types/node": "^18.19.14",
47
+ "@types/react": "^18.3.4",
48
+ "@types/react-dom": "^18.3.0",
49
+ react: "^18.3.1",
50
+ "react-dom": "^18.3.1",
51
+ vite: "^5.4.2"
52
+ },
53
+ dependencies: {
54
+ "@batijs/core": "workspace:*"
55
+ },
56
+ files: [
57
+ "dist/"
58
+ ],
59
+ bati: {
60
+ if: {
61
+ flag: {
62
+ $all: [
63
+ "react",
64
+ "sentry"
65
+ ]
66
+ }
67
+ }
68
+ },
69
+ exports: {
70
+ "./sentry.browser.config": {
71
+ types: "./dist/types/sentry.browser.config.d.ts"
72
+ },
73
+ "./pages/sentry/+Page": {
74
+ types: "./dist/types/pages/sentry/+Page.d.ts"
75
+ }
76
+ },
77
+ typesVersions: {
78
+ "*": {
79
+ "sentry.browser.config": [
80
+ "./dist/types/sentry.browser.config.d.ts"
81
+ ],
82
+ "pages/sentry/+Page": [
83
+ "./dist/types/pages/sentry/+Page.d.ts"
84
+ ]
85
+ }
86
+ }
87
+ };
88
+ }
89
+ });
90
+
91
+ // files/$package.json.ts
92
+ import { addDependency, loadAsJson } from "@batijs/core";
93
+ async function getPackageJson(props) {
94
+ const packageJson = await loadAsJson(props);
95
+ return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
96
+ dependencies: ["@sentry/react"]
97
+ });
98
+ }
99
+ export {
100
+ getPackageJson as default
101
+ };
@@ -0,0 +1,43 @@
1
+ import React, { useEffect } from "react";
2
+ import * as Sentry from "@sentry/react";
3
+
4
+ export default function ReactSentryErrorPage() {
5
+ const [sentryClientStatus, setSentryClientStatus] = React.useState({
6
+ client_not_loaded: false,
7
+ enabled: true,
8
+ dsn_missing: false,
9
+ });
10
+ useEffect(() => {
11
+ const options = Sentry?.getClient()?.getOptions();
12
+ setSentryClientStatus({
13
+ client_not_loaded: !options,
14
+ dsn_missing: (options?.dsn?.length ?? 0) < 2,
15
+ enabled: (options?.enabled ?? true) !== false,
16
+ });
17
+ console.log("Sentry DSN: ", options?.dsn);
18
+ }, []);
19
+
20
+ return (
21
+ <>
22
+ <h1>Sentry Test Page</h1>
23
+ {(sentryClientStatus.client_not_loaded || sentryClientStatus.dsn_missing || !sentryClientStatus.enabled) && (
24
+ <p style={{ color: "red" }}>
25
+ <b>Sentry Config Error:</b>
26
+ {sentryClientStatus.client_not_loaded ? "Client not loaded!" : ""}{" "}
27
+ {!sentryClientStatus.client_not_loaded && sentryClientStatus.dsn_missing ? "DSN is missing! " : ""}
28
+ {!sentryClientStatus.client_not_loaded && !sentryClientStatus.enabled ? "Client is not enabled! " : ""} Vite
29
+ Mode: {import.meta.env.PROD ? "PROD" : "DEV"}
30
+ </p>
31
+ )}
32
+ <div>
33
+ <button
34
+ onClick={() => {
35
+ throw new Error(`This is a React SENTRY Browser Test! [${import.meta.env.DEV ? "DEV Mode" : "PROD Mode"}]`);
36
+ }}
37
+ >
38
+ Throw Javascript Error
39
+ </button>
40
+ </div>
41
+ </>
42
+ );
43
+ }
@@ -0,0 +1,22 @@
1
+ import * as Sentry from "@sentry/react";
2
+
3
+ export const sentryBrowserConfig = () => {
4
+ // eslint-disable-next-line
5
+ import.meta.env.PROD === true &&
6
+ Sentry.init({
7
+ dsn: import.meta.env.PUBLIC_ENV__SENTRY_DSN,
8
+ environment: "production-frontend",
9
+ //enabled: import.meta.env.DEV ? false : true,
10
+ integrations: [Sentry.replayIntegration()],
11
+ autoSessionTracking: globalThis?.window?.document ? true : false, // disable autoSessionTracking in SSR
12
+ // Set tracesSampleRate to 1.0 to capture 100%
13
+ // of transactions for tracing.
14
+ tracesSampleRate: 1.0,
15
+ // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
16
+ tracePropagationTargets: [/^\//, /^https:\/\/yourserver\.io\/api/],
17
+ // Capture Replay for 10% of all sessions,
18
+ // plus for 100% of sessions with an error
19
+ replaysSessionSampleRate: 0.1,
20
+ replaysOnErrorSampleRate: 1.0,
21
+ });
22
+ };
@@ -0,0 +1 @@
1
+ export default function ReactSentryErrorPage(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const sentryBrowserConfig: () => void;
@@ -0,0 +1,22 @@
1
+ // files/$.env.ts
2
+ import { appendToEnv } from "@batijs/core";
3
+ async function getServerlessEnv(props) {
4
+ const sentryDNS = process.env.TEST_SENTRY_DSN;
5
+ let envContent = await props.readfile?.();
6
+ envContent = appendToEnv(
7
+ envContent,
8
+ "SENTRY_DSN",
9
+ sentryDNS ?? "",
10
+ "Sentry DNS. Used for Error Reporting on the Server"
11
+ );
12
+ envContent = appendToEnv(
13
+ envContent,
14
+ "PUBLIC_ENV__SENTRY_DSN",
15
+ "",
16
+ "Sentry DNS. Used for Error Reporting in the Browser"
17
+ );
18
+ return envContent;
19
+ }
20
+ export {
21
+ getServerlessEnv as default
22
+ };
@@ -0,0 +1,31 @@
1
+ // files/$README.md.ts
2
+ import { loadReadme } from "@batijs/core";
3
+ async function getReadme(props) {
4
+ const content = await loadReadme(props);
5
+ const about = `
6
+
7
+ ## Sentry Browser / Error Tracking & Performance Monitoring
8
+
9
+ This app is integrated with [Sentry](https://sentry.io) for error tracking.
10
+
11
+ Add your Sentry DSN to \`.env\` file.
12
+ You can configure [Sentry for the browser](` + (props.meta.BATI.has("react") ? "https://docs.sentry.io/platforms/javascript/guides/react/" : props.meta.BATI.has("solid") ? "https://docs.sentry.io/platforms/javascript/guides/solid/" : props.meta.BATI.has("vue") ? "https://docs.sentry.io/platforms/javascript/guides/vue/" : "https://docs.sentry.io/platforms/javascript/") + `) in \`sentry.browser.config.ts\`.
13
+
14
+ Upload of source maps to Sentry is handled by the [\`sentryVitePlugin\`](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/vite/) in \`vite.config.ts\`.
15
+ You have to configure \`SENTRY_ORG\`, \`SENTRY_PROJECT\` and \`SENTRY_AUTH_TOKEN\` in the \`.env.sentry-build-plugin\` file with the values from your Sentry account.
16
+
17
+ > [!NOTE]
18
+ > Sentry Error Tracking is **only activated in production** (\`import.meta.env.PROD === true\`)!
19
+
20
+ **Testing Sentry** receiving Errors:
21
+ 1. Build & Start the app \`pnpm build && pnpm preview\`.
22
+ 2. open Testpage in browser: http://localhost:3000/sentry.
23
+ 3. check your [Sentry Dashboard](https://sentry.io) for new Errors.
24
+
25
+ `;
26
+ content.addAbout(about);
27
+ return content.finalize();
28
+ }
29
+ export {
30
+ getReadme as default
31
+ };
@@ -0,0 +1,86 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // package.json
28
+ var require_package = __commonJS({
29
+ "package.json"(exports, module) {
30
+ module.exports = {
31
+ name: "@batijs/sentry",
32
+ private: true,
33
+ version: "0.0.1",
34
+ description: "",
35
+ type: "module",
36
+ scripts: {
37
+ "check-types": "tsc --noEmit",
38
+ build: "bati-compile-boilerplate"
39
+ },
40
+ keywords: [],
41
+ author: "",
42
+ license: "MIT",
43
+ devDependencies: {
44
+ "@batijs/compile": "workspace:*",
45
+ "@sentry/vite-plugin": "^2.22.3",
46
+ "@types/node": "^18.19.44",
47
+ vite: "^5.4.2"
48
+ },
49
+ dependencies: {
50
+ "@batijs/core": "workspace:*"
51
+ },
52
+ files: [
53
+ "dist/"
54
+ ],
55
+ bati: {
56
+ if: {
57
+ flag: "sentry"
58
+ }
59
+ },
60
+ exports: {
61
+ "./sentry.browser.config copy": {
62
+ types: "./dist/types/sentry.browser.config copy.d.ts"
63
+ }
64
+ },
65
+ typesVersions: {
66
+ "*": {
67
+ "sentry.browser.config copy": [
68
+ "./dist/types/sentry.browser.config copy.d.ts"
69
+ ]
70
+ }
71
+ }
72
+ };
73
+ }
74
+ });
75
+
76
+ // files/$package.json.ts
77
+ import { addDependency, loadAsJson } from "@batijs/core";
78
+ async function getPackageJson(props) {
79
+ const packageJson = await loadAsJson(props);
80
+ return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
81
+ devDependencies: ["@sentry/vite-plugin"]
82
+ });
83
+ }
84
+ export {
85
+ getPackageJson as default
86
+ };
@@ -0,0 +1,18 @@
1
+ // files/$vite.config.ts.ts
2
+ import { addVitePlugin, loadAsMagicast, deepMergeObject } from "@batijs/core";
3
+ async function getViteConfig(props) {
4
+ const mod = await loadAsMagicast(props);
5
+ addVitePlugin(mod, {
6
+ from: "@sentry/vite-plugin",
7
+ constructor: "sentryVitePlugin",
8
+ imported: "sentryVitePlugin",
9
+ options: {
10
+ sourcemaps: { disable: false }
11
+ }
12
+ });
13
+ deepMergeObject(mod.exports.default.$args[0], { build: { sourcemap: true } });
14
+ return mod.generate().code;
15
+ }
16
+ export {
17
+ getViteConfig as default
18
+ };
@@ -0,0 +1,8 @@
1
+ # Sentry Organization Slug. Used for Upload of Source Maps
2
+ SENTRY_ORG=
3
+
4
+ # Sentry Project Slug. Used for Upload of Source Maps
5
+ SENTRY_PROJECT=
6
+
7
+ # Sentry Auth Token. Used for Upload of Source Maps
8
+ SENTRY_AUTH_TOKEN=
@@ -0,0 +1,23 @@
1
+ // files/pages/$+client.ts.ts
2
+ import { builders, generateCode, loadAsMagicast, parseModule } from "@batijs/core";
3
+ async function getViteConfig(props) {
4
+ let mod;
5
+ try {
6
+ mod = await loadAsMagicast(props);
7
+ } catch {
8
+ mod = parseModule("");
9
+ }
10
+ if (!props.meta.BATI.has("vue")) {
11
+ mod.imports.$prepend({
12
+ from: "../sentry.browser.config",
13
+ imported: "sentryBrowserConfig"
14
+ });
15
+ const e = builders.functionCall("sentryBrowserConfig");
16
+ const c = generateCode(e).code;
17
+ mod.$ast.body.splice(mod.$ast.body.length - 1, 0, c);
18
+ }
19
+ return mod.generate().code;
20
+ }
21
+ export {
22
+ getViteConfig as default
23
+ };
@@ -133,3 +133,6 @@ dist
133
133
 
134
134
  # Cloudflare
135
135
  .wrangler/
136
+
137
+ # Sentry Vite Plugin
138
+ .env.sentry-build-plugin
@@ -0,0 +1,99 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // package.json
28
+ var require_package = __commonJS({
29
+ "package.json"(exports, module) {
30
+ module.exports = {
31
+ name: "@batijs/solid-sentry",
32
+ private: true,
33
+ version: "0.0.1",
34
+ description: "",
35
+ type: "module",
36
+ scripts: {
37
+ "check-types": "tsc --noEmit",
38
+ build: "bati-compile-boilerplate"
39
+ },
40
+ keywords: [],
41
+ author: "",
42
+ license: "MIT",
43
+ devDependencies: {
44
+ "@batijs/compile": "workspace:*",
45
+ "@sentry/solid": "^8.27.0",
46
+ "@types/node": "^18.19.14",
47
+ "solid-js": "^1.8.22",
48
+ "vike-solid": "^0.7.3",
49
+ vite: "^5.4.2"
50
+ },
51
+ dependencies: {
52
+ "@batijs/core": "workspace:*"
53
+ },
54
+ files: [
55
+ "dist/"
56
+ ],
57
+ bati: {
58
+ if: {
59
+ flag: {
60
+ $all: [
61
+ "solid",
62
+ "sentry"
63
+ ]
64
+ }
65
+ }
66
+ },
67
+ exports: {
68
+ "./sentry.browser.config": {
69
+ types: "./dist/types/sentry.browser.config.d.ts"
70
+ },
71
+ "./pages/sentry/+Page": {
72
+ types: "./dist/types/pages/sentry/+Page.d.ts"
73
+ }
74
+ },
75
+ typesVersions: {
76
+ "*": {
77
+ "sentry.browser.config": [
78
+ "./dist/types/sentry.browser.config.d.ts"
79
+ ],
80
+ "pages/sentry/+Page": [
81
+ "./dist/types/pages/sentry/+Page.d.ts"
82
+ ]
83
+ }
84
+ }
85
+ };
86
+ }
87
+ });
88
+
89
+ // files/$package.json.ts
90
+ import { addDependency, loadAsJson } from "@batijs/core";
91
+ async function getPackageJson(props) {
92
+ const packageJson = await loadAsJson(props);
93
+ return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
94
+ dependencies: ["@sentry/solid"]
95
+ });
96
+ }
97
+ export {
98
+ getPackageJson as default
99
+ };
@@ -0,0 +1,47 @@
1
+ import * as Sentry from "@sentry/solid";
2
+ import { createSignal, onMount } from "solid-js";
3
+
4
+ export default function SolidSentryErrorPage() {
5
+ const [sentryClientStatus, setSentryClientStatus] = createSignal({
6
+ client_not_loaded: false,
7
+ enabled: true,
8
+ dsn_missing: false,
9
+ });
10
+
11
+ onMount(() => {
12
+ const options = Sentry?.getClient()?.getOptions();
13
+ setSentryClientStatus({
14
+ client_not_loaded: !options,
15
+ dsn_missing: (options?.dsn?.length ?? 0) < 2,
16
+ enabled: (options?.enabled ?? true) !== false,
17
+ });
18
+ console.log("Sentry DSN: ", options?.dsn);
19
+ });
20
+
21
+ return (
22
+ <>
23
+ <h1>Sentry Test Page</h1>
24
+ {(sentryClientStatus().client_not_loaded ||
25
+ sentryClientStatus().dsn_missing ||
26
+ !sentryClientStatus().enabled) && (
27
+ <p style={{ color: "red" }}>
28
+ <b>Sentry Config Error:</b> {sentryClientStatus().client_not_loaded ? "Client not loaded!" : ""}{" "}
29
+ {!sentryClientStatus().client_not_loaded && sentryClientStatus().dsn_missing ? "DSN is missing! " : ""}
30
+ {!sentryClientStatus().client_not_loaded && !sentryClientStatus().enabled
31
+ ? "Client is not enabled! "
32
+ : ""}{" "}
33
+ Vite Mode: {import.meta.env.PROD ? "PROD" : "DEV"}
34
+ </p>
35
+ )}
36
+ <div>
37
+ <button
38
+ onClick={() => {
39
+ throw new Error(`This is a Solid SENTRY Browser Test! [${import.meta.env.DEV ? "DEV Mode" : "PROD Mode"}]`);
40
+ }}
41
+ >
42
+ Throw Javascript Error
43
+ </button>
44
+ </div>
45
+ </>
46
+ );
47
+ }
@@ -0,0 +1,22 @@
1
+ import * as Sentry from "@sentry/solid";
2
+
3
+ export const sentryBrowserConfig = () => {
4
+ // eslint-disable-next-line
5
+ import.meta.env.PROD === true &&
6
+ Sentry.init({
7
+ dsn: import.meta.env.PUBLIC_ENV__SENTRY_DSN,
8
+ environment: "production-frontend",
9
+ //enabled: import.meta.env.DEV ? false : true,
10
+ integrations: [Sentry.replayIntegration()],
11
+ autoSessionTracking: globalThis?.window?.document ? true : false, // disable autoSessionTracking in SSR
12
+ // Set tracesSampleRate to 1.0 to capture 100%
13
+ // of transactions for tracing.
14
+ tracesSampleRate: 1.0,
15
+ // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
16
+ tracePropagationTargets: [/^\//, /^https:\/\/yourserver\.io\/api/],
17
+ // Capture Replay for 10% of all sessions,
18
+ // plus for 100% of sessions with an error
19
+ replaysSessionSampleRate: 0.1,
20
+ replaysOnErrorSampleRate: 1.0,
21
+ });
22
+ };
@@ -0,0 +1 @@
1
+ export default function SolidSentryErrorPage(): import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const sentryBrowserConfig: () => void;
@@ -17,6 +17,9 @@ import Content from "../components/Content.vue";
17
17
  import Link from "../components/Link.vue";
18
18
  import Logo from "../components/Logo.vue";
19
19
  import Sidebar from "../components/Sidebar.vue";
20
+ import { sentryBrowserConfig } from "../sentry.browser.config";
21
+ //# BATI.has("sentry")
22
+ sentryBrowserConfig();
20
23
  </script>
21
24
 
22
25
  <style>
@@ -0,0 +1,93 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // package.json
28
+ var require_package = __commonJS({
29
+ "package.json"(exports, module) {
30
+ module.exports = {
31
+ name: "@batijs/vue-sentry",
32
+ private: true,
33
+ version: "0.0.1",
34
+ description: "",
35
+ type: "module",
36
+ scripts: {
37
+ "check-types": "tsc --noEmit",
38
+ build: "bati-compile-boilerplate"
39
+ },
40
+ keywords: [],
41
+ author: "",
42
+ license: "MIT",
43
+ devDependencies: {
44
+ "@batijs/compile": "workspace:*",
45
+ "@sentry/vue": "^8.27.0",
46
+ "@types/node": "^18.19.14",
47
+ "vike-vue": "^0.8.3",
48
+ vite: "^5.4.2",
49
+ vue: "^3.4.38"
50
+ },
51
+ dependencies: {
52
+ "@batijs/core": "workspace:*"
53
+ },
54
+ files: [
55
+ "dist/"
56
+ ],
57
+ bati: {
58
+ if: {
59
+ flag: {
60
+ $all: [
61
+ "vue",
62
+ "sentry"
63
+ ]
64
+ }
65
+ }
66
+ },
67
+ exports: {
68
+ "./sentry.browser.config": {
69
+ types: "./dist/types/sentry.browser.config.d.ts"
70
+ }
71
+ },
72
+ typesVersions: {
73
+ "*": {
74
+ "sentry.browser.config": [
75
+ "./dist/types/sentry.browser.config.d.ts"
76
+ ]
77
+ }
78
+ }
79
+ };
80
+ }
81
+ });
82
+
83
+ // files/$package.json.ts
84
+ import { addDependency, loadAsJson } from "@batijs/core";
85
+ async function getPackageJson(props) {
86
+ const packageJson = await loadAsJson(props);
87
+ return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
88
+ dependencies: ["@sentry/vue"]
89
+ });
90
+ }
91
+ export {
92
+ getPackageJson as default
93
+ };
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div>
3
+ <h1>Sentry Test Page</h1>
4
+ <div v-if="!isSentryClientInitialized" style="color: red">
5
+ Sentry Client is not initialized! Vite Mode: {{ isProdMode ? "PROD" : "DEV" }}
6
+ </div>
7
+
8
+ <div>
9
+ <button @click="throwError">Throw Javascript Error</button>
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import * as Sentry from "@sentry/vue";
16
+ export default {
17
+ data() {
18
+ return {
19
+ isSentryClientInitialized: false,
20
+ isProdMode: import.meta.env.PROD,
21
+ };
22
+ },
23
+ mounted() {
24
+ this.isSentryClientInitialized = !!Sentry.getClient();
25
+ },
26
+ methods: {
27
+ throwError() {
28
+ const mode = import.meta.env.DEV ? "DEV Mode" : "PROD Mode";
29
+ throw new Error(`This is a Vue SENTRY Browser Vue Test! [${mode}]`);
30
+ },
31
+ },
32
+ };
33
+ </script>
@@ -0,0 +1,25 @@
1
+ import * as Sentry from "@sentry/vue";
2
+ import { usePageContext } from "vike-vue/usePageContext";
3
+
4
+ export const sentryBrowserConfig = () => {
5
+ // eslint-disable-next-line
6
+ import.meta.env.PROD === true &&
7
+ Sentry.init({
8
+ // @ts-ignore
9
+ app: usePageContext().app,
10
+ dsn: import.meta.env.PUBLIC_ENV__SENTRY_DSN,
11
+ environment: "production-frontend",
12
+ //enabled: import.meta.env.DEV ? false : true,
13
+ integrations: [Sentry.replayIntegration()],
14
+ autoSessionTracking: globalThis?.window?.document ? true : false, // disable autoSessionTracking in SSR
15
+ // Set tracesSampleRate to 1.0 to capture 100%
16
+ // of transactions for tracing.
17
+ tracesSampleRate: 1.0,
18
+ // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
19
+ tracePropagationTargets: [/^\//, /^https:\/\/yourserver\.io\/api/],
20
+ // Capture Replay for 10% of all sessions,
21
+ // plus for 100% of sessions with an error
22
+ replaysSessionSampleRate: 0.1,
23
+ replaysOnErrorSampleRate: 1.0,
24
+ });
25
+ };
@@ -0,0 +1 @@
1
+ export declare const sentryBrowserConfig: () => void;
@@ -243,6 +243,35 @@
243
243
  "files"
244
244
  ]
245
245
  },
246
+ {
247
+ "config": {
248
+ "if": {
249
+ "$and": [
250
+ {
251
+ "flag": "sentry"
252
+ },
253
+ {
254
+ "flag": {
255
+ "$not": {
256
+ "$in": [
257
+ "react",
258
+ "vue",
259
+ "solid",
260
+ "svelte",
261
+ "preact",
262
+ "angular"
263
+ ]
264
+ }
265
+ }
266
+ }
267
+ ]
268
+ }
269
+ },
270
+ "folder": "@batijs/plain-sentry",
271
+ "subfolders": [
272
+ "files"
273
+ ]
274
+ },
246
275
  {
247
276
  "config": {
248
277
  "if": {
@@ -308,6 +337,33 @@
308
337
  "files"
309
338
  ]
310
339
  },
340
+ {
341
+ "config": {
342
+ "if": {
343
+ "flag": {
344
+ "$all": [
345
+ "react",
346
+ "sentry"
347
+ ]
348
+ }
349
+ }
350
+ },
351
+ "folder": "@batijs/react-sentry",
352
+ "subfolders": [
353
+ "files"
354
+ ]
355
+ },
356
+ {
357
+ "config": {
358
+ "if": {
359
+ "flag": "sentry"
360
+ }
361
+ },
362
+ "folder": "@batijs/sentry",
363
+ "subfolders": [
364
+ "files"
365
+ ]
366
+ },
311
367
  {
312
368
  "config": {
313
369
  "enforce": "pre"
@@ -446,6 +502,22 @@
446
502
  "files"
447
503
  ]
448
504
  },
505
+ {
506
+ "config": {
507
+ "if": {
508
+ "flag": {
509
+ "$all": [
510
+ "solid",
511
+ "sentry"
512
+ ]
513
+ }
514
+ }
515
+ },
516
+ "folder": "@batijs/solid-sentry",
517
+ "subfolders": [
518
+ "files"
519
+ ]
520
+ },
449
521
  {
450
522
  "config": {
451
523
  "if": {
@@ -563,5 +635,21 @@
563
635
  "subfolders": [
564
636
  "files"
565
637
  ]
638
+ },
639
+ {
640
+ "config": {
641
+ "if": {
642
+ "flag": {
643
+ "$all": [
644
+ "vue",
645
+ "sentry"
646
+ ]
647
+ }
648
+ }
649
+ },
650
+ "folder": "@batijs/vue-sentry",
651
+ "subfolders": [
652
+ "files"
653
+ ]
566
654
  }
567
655
  ]
package/dist/index.js CHANGED
@@ -1677,7 +1677,7 @@ var createDefaultQueryTester = function(query, options) {
1677
1677
  // package.json
1678
1678
  var package_default = {
1679
1679
  name: "@batijs/cli",
1680
- version: "0.0.261",
1680
+ version: "0.0.262",
1681
1681
  type: "module",
1682
1682
  scripts: {
1683
1683
  "check-types": "tsc --noEmit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.261",
3
+ "version": "0.0.262",
4
4
  "type": "module",
5
5
  "keywords": [],
6
6
  "description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
@@ -20,12 +20,12 @@
20
20
  "typescript": "^5.5.4",
21
21
  "unplugin-purge-polyfills": "^0.0.5",
22
22
  "vite": "^5.4.2",
23
- "@batijs/compile": "0.0.261",
24
- "@batijs/build": "0.0.261"
23
+ "@batijs/build": "0.0.262",
24
+ "@batijs/compile": "0.0.262"
25
25
  },
26
26
  "dependencies": {
27
- "@batijs/core": "0.0.261",
28
- "@batijs/features": "0.0.261"
27
+ "@batijs/core": "0.0.262",
28
+ "@batijs/features": "0.0.262"
29
29
  },
30
30
  "bin": "./dist/index.js",
31
31
  "exports": {