@coherent.js/build-tools 1.0.0-beta.3

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Coherent.js Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @coherent.js/build-tools
2
+
3
+ Build tool integrations for Coherent.js, providing seamless integration with popular bundlers and build systems.
4
+
5
+ ## Supported Build Tools
6
+
7
+ - **Vite** - Plugin and configuration helpers
8
+ - **Webpack** - Loader and plugin integration
9
+ - **Rollup** - Plugin for component bundling
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @coherent.js/build-tools
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ### Vite Integration
20
+
21
+ ```js
22
+ import { createVitePlugin } from '@coherent.js/build-tools/vite';
23
+
24
+ export default {
25
+ plugins: [
26
+ createVitePlugin()
27
+ ]
28
+ };
29
+ ```
30
+
31
+ ### Webpack Integration
32
+
33
+ ```js
34
+ import { CoherentLoader } from '@coherent.js/build-tools/webpack';
35
+
36
+ export default {
37
+ module: {
38
+ rules: [
39
+ {
40
+ test: /\.coherent\.js$/,
41
+ use: 'coherent-loader'
42
+ }
43
+ ]
44
+ }
45
+ };
46
+ ```
47
+
48
+ ### Rollup Integration
49
+
50
+ ```js
51
+ import { createRollupPlugin } from '@coherent.js/build-tools/rollup';
52
+
53
+ export default {
54
+ plugins: [
55
+ createRollupPlugin()
56
+ ]
57
+ };
58
+ ```
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@coherent.js/build-tools",
3
+ "version": "1.0.0-beta.3",
4
+ "description": "Build tools and bundler integrations for Coherent.js (Vite, Webpack, Rollup)",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "types": "./types/index.d.ts",
8
+ "exports": {
9
+ ".": "./src/index.js",
10
+ "./vite": "./src/vite.js",
11
+ "./webpack": "./src/webpack.js",
12
+ "./rollup": "./src/rollup.js",
13
+ "./loader": "./src/coherent-loader.js"
14
+ },
15
+ "files": [
16
+ "src/",
17
+ "types/",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "keywords": [
22
+ "build",
23
+ "bundler",
24
+ "vite",
25
+ "webpack",
26
+ "rollup",
27
+ "coherent",
28
+ "ssr"
29
+ ],
30
+ "author": "Coherent.js Team",
31
+ "license": "MIT",
32
+ "devDependencies": {
33
+ "vitest": "^4.0.8"
34
+ },
35
+ "peerDependencies": {
36
+ "vite": "^7.2.2",
37
+ "webpack": "^5.102.1",
38
+ "rollup": "^4.53.2"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "vite": {
42
+ "optional": true
43
+ },
44
+ "webpack": {
45
+ "optional": true
46
+ },
47
+ "rollup": {
48
+ "optional": true
49
+ }
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/Tomdrouv1/coherent.js.git"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public",
57
+ "registry": "https://registry.npmjs.org/"
58
+ },
59
+ "scripts": {
60
+ "build": "node build.mjs",
61
+ "test": "vitest"
62
+ }
63
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Coherent.js Webpack Loader
3
+ */
4
+
5
+ export function coherentLoader(source) {
6
+ const callback = this.async();
7
+
8
+ try {
9
+ // Process Coherent.js component files
10
+ const transformed = transformCoherentComponent(source);
11
+ callback(null, transformed);
12
+ } catch (error) {
13
+ callback(error);
14
+ }
15
+ }
16
+
17
+ function transformCoherentComponent(source) {
18
+ // Transform logic for Coherent.js components
19
+ return source;
20
+ }
package/src/index.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Coherent.js Build Tools
3
+ * Bundler integrations and build utilities
4
+ */
5
+
6
+ export { createVitePlugin } from './vite.js';
7
+ export { createWebpackPlugin } from './webpack.js';
8
+ export { createRollupPlugin } from './rollup.js';
9
+ export { coherentLoader } from './coherent-loader.js';
10
+ export * from './utils.js';
package/src/rollup.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Rollup Plugin for Coherent.js
3
+ */
4
+
5
+ export function createRollupPlugin(_options = {}) {
6
+ return {
7
+ name: 'coherent',
8
+ buildStart() {
9
+ // Initialize plugin
10
+ },
11
+ resolveId(id) {
12
+ if (id.endsWith('.coherent.js')) {
13
+ return id;
14
+ }
15
+ },
16
+ load(id) {
17
+ if (id.endsWith('.coherent.js')) {
18
+ // Load and process Coherent.js files
19
+ return null;
20
+ }
21
+ },
22
+ transform(code, id) {
23
+ if (id.includes('.coherent.js')) {
24
+ // Transform Coherent.js components
25
+ return {
26
+ code,
27
+ map: null
28
+ };
29
+ }
30
+ }
31
+ };
32
+ }
package/src/utils.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Build Utilities for Coherent.js
3
+ */
4
+
5
+ export function optimizeComponents(components) {
6
+ // Component optimization logic
7
+ return components;
8
+ }
9
+
10
+ export function generateManifest(components) {
11
+ return {
12
+ components: Object.keys(components),
13
+ version: '1.1.1',
14
+ build: Date.now()
15
+ };
16
+ }
17
+
18
+ export function createAssetMap(assets) {
19
+ const map = new Map();
20
+ for (const asset of assets) {
21
+ map.set(asset.id, asset);
22
+ }
23
+ return map;
24
+ }
package/src/vite.js ADDED
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Vite Plugin for Coherent.js
3
+ */
4
+
5
+
6
+ export function createVitePlugin(_options = {}) {
7
+ return {
8
+ name: 'coherent',
9
+ configResolved(_config) {
10
+ // Add Coherent.js specific configuration
11
+ },
12
+ load(id) {
13
+ if (id.endsWith('.coherent.js')) {
14
+ // Handle Coherent.js component files
15
+ return null;
16
+ }
17
+ },
18
+ transform(code, id) {
19
+ if (id.includes('.coherent.js')) {
20
+ // Transform Coherent.js components
21
+ return {
22
+ code,
23
+ map: null
24
+ };
25
+ }
26
+ }
27
+ };
28
+ }
29
+
30
+ export function createSSRPlugin(_options = {}) {
31
+ return {
32
+ name: 'coherent-ssr',
33
+ generateBundle() {
34
+ // SSR bundle generation logic
35
+ }
36
+ };
37
+ }
package/src/webpack.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Webpack Plugin for Coherent.js
3
+ */
4
+
5
+ export class CoherentWebpackPlugin {
6
+ constructor(options = {}) {
7
+ this.options = options;
8
+ }
9
+
10
+ apply(compiler) {
11
+ compiler.hooks.compilation.tap('CoherentPlugin', (_compilation) => {
12
+ // Add Coherent.js specific compilation logic
13
+ });
14
+ }
15
+ }
16
+
17
+ export function createWebpackPlugin(options = {}) {
18
+ return new CoherentWebpackPlugin(options);
19
+ }