oc-template-react-compiler 5.2.2 → 6.0.1

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 (44) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +18 -0
  4. package/dist/lib/compile.d.ts +3 -0
  5. package/dist/lib/compile.js +23 -0
  6. package/dist/lib/reactOCProviderTemplate.d.ts +3 -0
  7. package/dist/lib/reactOCProviderTemplate.js +72 -0
  8. package/dist/utils/index.d.ts +1 -0
  9. package/dist/utils/index.js +17 -0
  10. package/dist/utils/useData.d.ts +7 -0
  11. package/dist/utils/useData.js +31 -0
  12. package/package.json +35 -47
  13. package/scaffold/src/.eslintrc.json +3 -0
  14. package/scaffold/src/package.json +29 -11
  15. package/scaffold/src/public/logo.png +0 -0
  16. package/scaffold/src/src/App.test.tsx +39 -0
  17. package/scaffold/src/src/App.tsx +52 -0
  18. package/scaffold/src/src/oc-app.d.ts +1 -0
  19. package/scaffold/src/src/server.ts +37 -0
  20. package/scaffold/src/src/setupTests.js +1 -0
  21. package/scaffold/src/src/styles.css +30 -0
  22. package/scaffold/src/src/types.ts +15 -0
  23. package/scaffold/src/tsconfig.json +26 -0
  24. package/scaffold/src/vite.config.ts +11 -0
  25. package/index.js +0 -11
  26. package/lib/compile.js +0 -26
  27. package/lib/compileServer.js +0 -100
  28. package/lib/compileView.js +0 -135
  29. package/lib/higherOrderServerTemplate.js +0 -32
  30. package/lib/reactOCProviderTemplate.js +0 -54
  31. package/lib/to-abstract-base-template-utils/font-family-unicode-parser.js +0 -25
  32. package/lib/to-abstract-base-template-utils/oc-webpack/index.js +0 -9
  33. package/lib/to-abstract-base-template-utils/oc-webpack/lib/compiler/index.js +0 -42
  34. package/lib/to-abstract-base-template-utils/oc-webpack/lib/configurator/client/index.js +0 -120
  35. package/lib/to-abstract-base-template-utils/oc-webpack/lib/configurator/createExcludeRegex.js +0 -6
  36. package/lib/to-abstract-base-template-utils/oc-webpack/lib/configurator/index.js +0 -9
  37. package/lib/to-abstract-base-template-utils/oc-webpack/lib/configurator/server/index.js +0 -93
  38. package/lib/viewTemplate.js +0 -35
  39. package/scaffold/src/app.js +0 -11
  40. package/scaffold/src/server.js +0 -4
  41. package/scaffold/src/styles.css +0 -4
  42. package/utils/index.js +0 -4
  43. package/utils/withDataProvider.js +0 -21
  44. package/utils/withSettingProvider.js +0 -21
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # oc-template-react-compiler - Compiler module
2
2
 
3
- OC template to compile components of type `oc-template-react`
3
+ OC template to compile components of type `oc-template-react`
@@ -0,0 +1,2 @@
1
+ export * from './lib/compile';
2
+ export * from 'oc-template-react';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/compile"), exports);
18
+ __exportStar(require("oc-template-react"), exports);
@@ -0,0 +1,3 @@
1
+ import { createCompile } from 'oc-generic-template-compiler';
2
+ export type CompilerOptions = ReturnType<typeof createCompile>;
3
+ export declare const compile: CompilerOptions;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.compile = void 0;
7
+ const oc_generic_template_compiler_1 = require("oc-generic-template-compiler");
8
+ const oc_statics_compiler_1 = __importDefault(require("oc-statics-compiler"));
9
+ const oc_template_react_1 = require("oc-template-react");
10
+ const oc_vite_compiler_1 = require("oc-vite-compiler");
11
+ const plugin_react_1 = __importDefault(require("@vitejs/plugin-react"));
12
+ const reactOCProviderTemplate_1 = __importDefault(require("./reactOCProviderTemplate"));
13
+ exports.compile = (0, oc_generic_template_compiler_1.createCompile)({
14
+ compileView: (options, cb) => (0, oc_vite_compiler_1.viteView)({
15
+ ...options,
16
+ plugins: [plugin_react_1.default()],
17
+ viewWrapper: reactOCProviderTemplate_1.default,
18
+ externals: (0, oc_template_react_1.getInfo)().externals
19
+ }, cb),
20
+ compileServer: oc_vite_compiler_1.viteServer,
21
+ compileStatics: oc_statics_compiler_1.default,
22
+ getInfo: oc_template_react_1.getInfo
23
+ });
@@ -0,0 +1,3 @@
1
+ export default function reactOCProviderTemplate({ viewPath }: {
2
+ viewPath: string;
3
+ }): string;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const removeExtension = (path) => path.replace(/\.(t|j)sx?$/, '');
4
+ function reactOCProviderTemplate({ viewPath }) {
5
+ return `
6
+ import React from 'react';
7
+ import View from '${removeExtension(viewPath)}';
8
+ import { DataProvider } from 'oc-template-react-compiler/dist/utils/useData'
9
+
10
+ class OCProvider extends React.Component {
11
+ componentDidMount(){
12
+ const { _staticPath, _baseUrl, _componentName, _componentVersion, ...rest } = (this.props as any);
13
+ (window as any).oc.events.fire('oc:componentDidMount', rest);
14
+ }
15
+
16
+ getData(providerProps: any, parameters: any, cb: (error: any, parameters?: any, props?: any) => void) {
17
+ return (window as any).oc.getData({
18
+ name: providerProps._componentName,
19
+ version: providerProps._componentVersion,
20
+ baseUrl: providerProps._baseUrl,
21
+ parameters
22
+ }, (err: any, data: any) => {
23
+ if (err) {
24
+ return cb(err);
25
+ }
26
+ const { _staticPath, _baseUrl, _componentName, _componentVersion, ...rest } = (data.component.props as any);
27
+ cb(null, rest, data.component.props);
28
+ });
29
+ }
30
+
31
+ getSetting(providerProps: any, setting: string) {
32
+ const settingHash = {
33
+ name: providerProps._componentName,
34
+ version: providerProps._componentVersion,
35
+ baseUrl: providerProps._baseUrl,
36
+ staticPath: providerProps._staticPath
37
+ };
38
+ return (settingHash as any)[setting];
39
+ }
40
+
41
+ render() {
42
+ const { _staticPath, _baseUrl, _componentName, _componentVersion, ...rest } = (this.props as any);
43
+ (rest as any).getData = (parameters: any, cb: (error: any, parameters?: any, props?: any) => void) => this.getData(this.props, parameters, cb);
44
+ (rest as any).getSetting = (setting: string) => this.getSetting(this.props, setting);
45
+ return (
46
+ <DataProvider value={{...rest}}>
47
+ <View { ...rest } />
48
+ </DataProvider>
49
+ );
50
+ }
51
+ }
52
+
53
+ function renderer(props, element, ssr) {
54
+ if (window.ReactDOM.createRoot) {
55
+ if (ssr) {
56
+ window.ReactDOM.hydrateRoot(element, <OCProvider {...props} />);
57
+ } else {
58
+ window.ReactDOM.createRoot(element).render(<OCProvider {...props} />);
59
+ }
60
+ } else {
61
+ if (ssr) {
62
+ window.ReactDOM.hydrate(<OCProvider {...props} />, element);
63
+ } else {
64
+ window.ReactDOM.render(<OCProvider {...props} />, element);
65
+ }
66
+ }
67
+ }
68
+
69
+ export default renderer;
70
+ `;
71
+ }
72
+ exports.default = reactOCProviderTemplate;
@@ -0,0 +1 @@
1
+ export * from './useData';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./useData"), exports);
@@ -0,0 +1,7 @@
1
+ type PromiseData<T = any> = T & {
2
+ getData<O = any>(parameters?: Partial<T>): Promise<O>;
3
+ getSetting(setting: 'name' | 'version' | 'baseUrl' | 'staticPath'): string;
4
+ };
5
+ export declare const DataProvider: ({ children, ...props }: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function useData<T = any>(): PromiseData<T>;
7
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useData = exports.DataProvider = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = __importDefault(require("react"));
9
+ const DataContext = react_1.default.createContext({});
10
+ const DataProvider = ({ children, ...props }) => {
11
+ return (0, jsx_runtime_1.jsx)(DataContext.Provider, { value: props, children: children });
12
+ };
13
+ exports.DataProvider = DataProvider;
14
+ function useData() {
15
+ const { value: { getData, ...rest } } = react_1.default.useContext(DataContext);
16
+ const asyncGetData = react_1.default.useCallback((data) => {
17
+ return new Promise((resolve, reject) => {
18
+ // @ts-ignore
19
+ getData({ ...rest, ...data }, (err, newData) => {
20
+ if (err) {
21
+ reject(err);
22
+ }
23
+ else {
24
+ resolve(newData);
25
+ }
26
+ });
27
+ });
28
+ }, []);
29
+ return { getData: asyncGetData, ...rest };
30
+ }
31
+ exports.useData = useData;
package/package.json CHANGED
@@ -1,16 +1,22 @@
1
1
  {
2
2
  "name": "oc-template-react-compiler",
3
- "version": "5.2.2",
4
- "description": "OC-Template-REACT-Compiler",
5
- "main": "index.js",
3
+ "version": "6.0.1",
4
+ "description": "Compiler for the React OC template",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "prepare": "npm run build",
10
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
11
+ },
6
12
  "repository": {
7
13
  "type": "git",
8
- "url": "https://github.com/opencomponents/oc-template-react.git"
14
+ "url": "https://github.com/opencomponents/vite-templates.git"
9
15
  },
10
16
  "bugs": {
11
- "url": "https://github.com/opencomponents/oc-template-react/issues"
17
+ "url": "https://github.com/opencomponents/vite-templates/issues"
12
18
  },
13
- "homepage": "https://github.com/opencomponents/oc-template-react#readme",
19
+ "homepage": "https://github.com/opencomponents/vite-templates#readme",
14
20
  "keywords": [
15
21
  "oc",
16
22
  "opencomponents",
@@ -18,49 +24,31 @@
18
24
  "oc-template"
19
25
  ],
20
26
  "author": {
21
- "name": "Nick Balestra",
22
- "email": "nick@balestra.ch"
27
+ "name": "Ricardo Devis Agullo",
28
+ "email": "mkredz@gmail.com"
23
29
  },
24
30
  "license": "MIT",
25
31
  "dependencies": {
26
- "async": "2.6.3",
27
- "autoprefixer": "9.6.2",
28
- "babel-loader": "7.1.5",
29
- "babel-minify-webpack-plugin": "0.3.1",
30
- "babel-plugin-transform-object-rest-spread": "6.26.0",
31
- "babel-preset-env": "1.7.0",
32
- "babel-preset-react": "6.24.1",
33
- "css-loader": "1.0.1",
34
- "fs-extra": "8.1.0",
35
- "infinite-loop-loader": "1.0.6",
36
- "lodash": "4.17.19",
37
- "memory-fs": "0.4.1",
38
- "mini-css-extract-plugin": "0.8.0",
39
- "node-dir": "0.1.17",
40
- "oc-external-dependencies-handler": "1.0.8",
41
- "oc-generic-template-compiler": "2.0.5",
42
- "oc-get-unix-utc-timestamp": "1.0.2",
43
- "oc-hash-builder": "1.0.2",
44
- "oc-minify-file": "1.0.15",
45
- "oc-react-component-wrapper": "1.0.2",
46
- "oc-statics-compiler": "2.0.11",
47
- "oc-template-react": "2.1.0",
48
- "oc-templates-messages": "1.0.2",
49
- "oc-view-wrapper": "1.0.3",
50
- "postcss-extend": "1.0.5",
51
- "postcss-icss-values": "2.0.2",
52
- "postcss-import": "12.0.1",
53
- "postcss-loader": "3.0.0",
54
- "prop-types": "15.7.2",
55
- "react": "16.9.0",
56
- "webpack": "4.41.0"
32
+ "@vitejs/plugin-react": "^4.0.0",
33
+ "chalk": "^3.0.0",
34
+ "immer": "^9.0.6",
35
+ "oc-generic-template-compiler": "2.1.0",
36
+ "oc-statics-compiler": "2.1.1",
37
+ "oc-template-react": "^4.0.0",
38
+ "oc-vite-compiler": "^3.1.1",
39
+ "react": "18.2.0",
40
+ "react-dom": "18.2.0",
41
+ "resolve": "^1.20.0"
57
42
  },
58
43
  "files": [
59
- "index.js",
60
- "lib",
61
- "utils",
62
- "scaffold",
63
- "README.md",
64
- "LICENSE"
65
- ]
66
- }
44
+ "dist/**",
45
+ "scaffold"
46
+ ],
47
+ "devDependencies": {
48
+ "@types/react": "^18.0.28",
49
+ "@types/react-dom": "^18.0.11",
50
+ "lodash": "^4.17.4",
51
+ "prettier": "^2.3.2",
52
+ "prettier-config-guestline": "2.0.0"
53
+ }
54
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["react-app"]
3
+ }
@@ -2,25 +2,43 @@
2
2
  "name": "base-component-react",
3
3
  "description": "",
4
4
  "version": "1.0.0",
5
+ "scripts": {
6
+ "lint": "eslint --max-warnings 0 --ext .js,.jsx,.ts,.tsx src",
7
+ "build": "tsc --noEmit && oc package .",
8
+ "test": "vitest"
9
+ },
5
10
  "oc": {
6
11
  "files": {
7
- "data": "server.js",
12
+ "data": "src/server.ts",
8
13
  "template": {
9
- "src": "app.js",
14
+ "src": "src/App.tsx",
10
15
  "type": "oc-template-react"
11
- }
16
+ },
17
+ "static": [
18
+ "public"
19
+ ]
12
20
  },
13
21
  "parameters": {
14
- "name": {
15
- "default": "World",
16
- "description": "Your name",
17
- "example": "Jane Doe",
18
- "mandatory": false,
19
- "type": "string"
22
+ "userId": {
23
+ "default": 1,
24
+ "description": "The user id from the user database",
25
+ "example": 1,
26
+ "mandatory": true,
27
+ "type": "number"
20
28
  }
21
29
  }
22
30
  },
31
+ "dependencies": {},
23
32
  "devDependencies": {
24
- "oc-template-react-compiler": "*"
33
+ "@testing-library/react": "^14.0.0",
34
+ "@testing-library/user-event": "^14.4.3",
35
+ "@types/react": "^18.0.28",
36
+ "jsdom": "^21.1.1",
37
+ "oc-server": "*",
38
+ "oc-template-react-compiler": "6.0.0",
39
+ "react": "18.2.0",
40
+ "react-dom": "18.2.0",
41
+ "typescript": "5.1.3",
42
+ "vitest": "^0.32.2"
25
43
  }
26
- }
44
+ }
Binary file
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { describe, it, afterEach, beforeEach, expect, vi } from 'vitest';
3
+ import { render, screen } from '@testing-library/react';
4
+ import { DataProvider } from 'oc-template-react-compiler/dist/utils/useData';
5
+
6
+ import App from './App';
7
+
8
+ const getData = vi.fn();
9
+ const getSetting = vi.fn();
10
+
11
+ describe('App - Page', () => {
12
+ beforeEach(() => {
13
+ window.oc = { events: { on: vi.fn(), fire: vi.fn() } } as any;
14
+ });
15
+ afterEach(() => {
16
+ vi.restoreAllMocks();
17
+ });
18
+
19
+ it('Gets more data when clicking the button', () => {
20
+ getData.mockImplementationOnce(() => Promise.resolve({}));
21
+ getSetting.mockImplementationOnce(() => ({}));
22
+ render(
23
+ <DataProvider
24
+ value={{
25
+ firstName: 'firstName',
26
+ lastName: 'lastName',
27
+ userId: 0,
28
+ getData,
29
+ getSetting
30
+ }}
31
+ >
32
+ <App firstName="firstName" lastName="lastName" userId={0} />
33
+ </DataProvider>
34
+ );
35
+
36
+ const extraInfoButton = screen.getByText(/Get extra information/i);
37
+ expect(extraInfoButton).toBeTruthy();
38
+ });
39
+ });
@@ -0,0 +1,52 @@
1
+ import { useState } from 'react';
2
+ import { useData } from 'oc-template-react-compiler/dist/utils/useData';
3
+ import { serverClient } from 'oc-server';
4
+ import styles from './styles.css';
5
+ import logo from '../public/logo.png';
6
+ import type { AdditionalData, ClientProps } from './types';
7
+
8
+ interface AppProps extends ClientProps {
9
+ getMoreData?: boolean;
10
+ }
11
+
12
+ const App: React.FC<ClientProps> = () => {
13
+ const { firstName, lastName, userId, getData } = useData<AppProps>();
14
+ const [additionalData, setAdditionalData] = useState<AdditionalData | null>(null);
15
+ const [error, setError] = useState('');
16
+
17
+ const fetchMoreData = async () => {
18
+ setError('');
19
+ try {
20
+ const data = await serverClient.getMoreData({ userId });
21
+ setAdditionalData(data);
22
+ } catch (err) {
23
+ setError(String(err));
24
+ }
25
+ };
26
+
27
+ if (error) {
28
+ return <div>Something wrong happened!</div>;
29
+ }
30
+
31
+ return (
32
+ <div className={styles.container}>
33
+ <img width="50" height="50" src={logo} alt="Logo" />
34
+ <h1 style={{ margin: '0 0 20px 0' }}>
35
+ Hello, <span style={{ textDecoration: 'underline' }}>{firstName}</span> {lastName}
36
+ </h1>
37
+ {additionalData && (
38
+ <div className={styles.info}>
39
+ <div className={styles.block}>Age: {additionalData.age}</div>
40
+ <div className={styles.block}>
41
+ Hobbies: {additionalData.hobbies.map((x) => x.toLowerCase()).join(', ')}
42
+ </div>
43
+ </div>
44
+ )}
45
+ <button className={styles.button} onClick={fetchMoreData}>
46
+ Get extra information
47
+ </button>
48
+ </div>
49
+ );
50
+ };
51
+
52
+ export default App;
@@ -0,0 +1 @@
1
+ /// <reference types="oc-vite/client" />
@@ -0,0 +1,37 @@
1
+ import { Server } from 'oc-server';
2
+ import { AdditionalData, ClientProps, OcParameters } from './types';
3
+
4
+ const database = [
5
+ { name: 'John Doe', age: 34, hobbies: ['Swimming', 'Basketball'] },
6
+ { name: 'Jane Doe', age: 35, hobbies: ['Running', 'Rugby'] }
7
+ ];
8
+
9
+ async function getUser(userId: number) {
10
+ return database[userId];
11
+ }
12
+
13
+ export const server = new Server(async (params: OcParameters): Promise<ClientProps> => {
14
+ const { userId } = params;
15
+ const user = await getUser(userId);
16
+ const [firstName, lastName] = user.name.split(/\s+/);
17
+
18
+ return {
19
+ userId,
20
+ firstName,
21
+ lastName
22
+ };
23
+ }).action('getMoreData', async (params: OcParameters): Promise<AdditionalData> => {
24
+ const { userId } = params;
25
+ const user = await getUser(userId);
26
+
27
+ return {
28
+ age: user.age,
29
+ hobbies: user.hobbies
30
+ };
31
+ });
32
+
33
+ declare module 'oc-server' {
34
+ interface Register {
35
+ server: typeof server;
36
+ }
37
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,30 @@
1
+ .container {
2
+ background-color: #3b246c;
3
+ color: #fff;
4
+ font-family: sans-serif;
5
+ padding: 40px;
6
+ }
7
+
8
+ .button {
9
+ background-color: #a97613;
10
+ border: none;
11
+ padding: 15px 32px;
12
+ text-align: center;
13
+ font-size: 16px;
14
+ text-decoration: none;
15
+ display: inline-block;
16
+ color: inherit;
17
+ cursor: pointer;
18
+ }
19
+
20
+ .info {
21
+ margin-bottom: 20px;
22
+ }
23
+
24
+ .block {
25
+ margin: 6px 0;
26
+ }
27
+
28
+ .button:hover {
29
+ background-color: #c79535;
30
+ }
@@ -0,0 +1,15 @@
1
+ export interface OcParameters {
2
+ userId: number;
3
+ getMoreData?: boolean;
4
+ }
5
+
6
+ export interface AdditionalData {
7
+ hobbies: string[];
8
+ age: number;
9
+ }
10
+
11
+ export interface ClientProps extends Partial<AdditionalData> {
12
+ userId: number;
13
+ firstName: string;
14
+ lastName: string;
15
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ // These are suggested values and will be set when not present in the
4
+ // tsconfig.json
5
+ // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()
6
+ "target": "es5",
7
+ "lib": ["dom", "dom.iterable", "esnext"],
8
+ "strict": true,
9
+ "allowJs": true,
10
+ "skipLibCheck": true,
11
+ "esModuleInterop": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "noFallthroughCasesInSwitch": true,
15
+
16
+ // These values are required and cannot be changed by the user
17
+ // Keep this in sync with the rollup config
18
+ "module": "ESNext",
19
+ "moduleResolution": "Node",
20
+ "resolveJsonModule": true,
21
+ "isolatedModules": true,
22
+ "jsx": "react-jsx"
23
+ },
24
+ "include": ["src"],
25
+ "exclude": ["src/_package"]
26
+ }
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'vite';
2
+
3
+ // https://vitejs.dev/config/
4
+ export default defineConfig({
5
+ // Add your own plugins here for thinkgs like eslint or typecheckers
6
+ plugins: [],
7
+ // @ts-ignore Missing test property
8
+ test: {
9
+ environment: 'jsdom'
10
+ }
11
+ });
package/index.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- const compile = require("./lib/compile");
4
- const template = require("oc-template-react");
5
-
6
- module.exports = {
7
- compile,
8
- getCompiledTemplate: template.getCompiledTemplate,
9
- getInfo: template.getInfo,
10
- render: template.render
11
- };
package/lib/compile.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- const createCompile = require("oc-generic-template-compiler").createCompile;
4
- const compileStatics = require("oc-statics-compiler");
5
- const getInfo = require("oc-template-react").getInfo;
6
-
7
- const compileServer = require("./compileServer");
8
- const compileView = require("./compileView");
9
-
10
- // OPTIONS
11
- // =======
12
- // componentPath
13
- // componentPackage,
14
- // logger,
15
- // minify
16
- // ocPackage
17
- // publishPath
18
- // verbose,
19
- // watch,
20
- // production
21
- module.exports = createCompile({
22
- compileServer,
23
- compileStatics,
24
- compileView,
25
- getInfo
26
- });