Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/rspack/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "e2e/rspack/src",
"projectType": "library",
"implicitDependencies": ["@griffel/webpack-loader"],
"implicitDependencies": ["@griffel/webpack-plugin"],
"targets": {
"test": {
"executor": "nx:run-commands",
Expand Down
13 changes: 3 additions & 10 deletions e2e/rspack/src/assets/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @ts-check

const { GriffelCSSExtractionPlugin } = require('@griffel/webpack-extraction-plugin');
const path = require('path');
const { GriffelPlugin } = require('@griffel/webpack-plugin');

/**
* @type {import('@rspack/core').Configuration}
Expand All @@ -22,17 +21,11 @@ const config = {
{
test: /\.js$/,
exclude: /node_modules/,
use: [{ loader: GriffelCSSExtractionPlugin.loader }, { loader: '@griffel/webpack-loader' }],
use: [{ loader: '@griffel/webpack-plugin/loader' }],
},
],
},
plugins: [/** @type {any} */ (new GriffelCSSExtractionPlugin())],
resolve: {
alias: {
'fake-module': path.resolve(__dirname, 'src', 'Component.js'),
'fake-colors': path.resolve(__dirname, 'src', 'colors.js'),
},
},
plugins: [/** @type {any} */ (new GriffelPlugin())],
};

module.exports = config;
3 changes: 1 addition & 2 deletions e2e/rspack/src/assets/src/Component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { makeResetStyles, makeStyles } from '@griffel/react';
// @ts-expect-error It's a fake module resolved via aliases
import { colors } from 'fake-colors';
import { colors } from './colors.js';

const useClasses = makeStyles({
root: {
Expand Down
3 changes: 1 addition & 2 deletions e2e/rspack/src/assets/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-expect-error It's a fake module resolved via aliases
import { Component } from 'fake-module';
import { Component } from './Component.js';

console.log(Component);
6 changes: 3 additions & 3 deletions e2e/rspack/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ async function performTest() {
packLocalPackage(rootDir, tempDir, '@griffel/style-types'),
packLocalPackage(rootDir, tempDir, '@griffel/core'),
packLocalPackage(rootDir, tempDir, '@griffel/react'),
packLocalPackage(rootDir, tempDir, '@griffel/babel-preset'),
packLocalPackage(rootDir, tempDir, '@griffel/webpack-extraction-plugin'),
packLocalPackage(rootDir, tempDir, '@griffel/webpack-loader'),
packLocalPackage(rootDir, tempDir, '@griffel/transform-shaker'),
packLocalPackage(rootDir, tempDir, '@griffel/transform'),
packLocalPackage(rootDir, tempDir, '@griffel/webpack-plugin'),
]);

const rspackVersion = (await sh(`yarn rspack --version`, rootDir, true)).trim();
Expand Down
6 changes: 4 additions & 2 deletions packages/transform-shaker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"url": "https://github.com/microsoft/griffel"
},
"type": "module",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"exports": {
".": {
"node": "./transform-shaker.js",
"types": "./index.d.mts"
"types": "./src/index.d.ts",
"default": "./src/index.js"
},
"./package.json": "./package.json"
},
Expand Down
16 changes: 13 additions & 3 deletions packages/transform-shaker/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@
}
},
"build": {
"executor": "@nx/vite:build",
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/transform-shaker",
"compiler": "swc",
"format": ["esm"]
"tsConfig": "packages/transform-shaker/tsconfig.lib.json",
"skipTypeField": true,
"packageJson": "packages/transform-shaker/package.json",
"main": "packages/transform-shaker/src/index.ts",
"assets": [
"packages/transform-shaker/README.md",
{
"glob": "LICENSE.md",
"input": ".",
"output": "."
}
]
}
},
"type-check": {
Expand Down
2 changes: 2 additions & 0 deletions packages/transform-shaker/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
Expand Down
46 changes: 0 additions & 46 deletions packages/transform-shaker/vite.config.ts

This file was deleted.

20 changes: 20 additions & 0 deletions packages/transform-shaker/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from 'vitest/config';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/packages/transform-shaker',
plugins: [nxViteTsPaths()],
test: {
watch: false,
globals: true,
passWithNoTests: true,
environment: 'node',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/packages/transform-shaker',
provider: 'v8',
},
},
});
6 changes: 4 additions & 2 deletions packages/transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"url": "https://github.com/microsoft/griffel"
},
"type": "module",
"main": "./src/index.mjs",
"types": "./src/index.d.mts",
"exports": {
".": {
"node": "./transform.js",
"types": "./index.d.mts"
"types": "./src/index.d.mts",
"default": "./src/index.mjs"
},
"./package.json": "./package.json"
},
Expand Down
16 changes: 13 additions & 3 deletions packages/transform/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@
}
},
"build": {
"executor": "@nx/vite:build",
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/transform",
"compiler": "swc",
"format": ["esm"]
"tsConfig": "packages/transform/tsconfig.lib.json",
"skipTypeField": true,
"packageJson": "packages/transform/package.json",
"main": "packages/transform/src/index.mts",
"assets": [
"packages/transform/README.md",
{
"glob": "LICENSE.md",
"input": ".",
"output": "."
}
]
}
},
"type-check": {
Expand Down
2 changes: 2 additions & 0 deletions packages/transform/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node", "environment"]
Expand Down
49 changes: 0 additions & 49 deletions packages/transform/vite.config.ts

This file was deleted.

19 changes: 19 additions & 0 deletions packages/transform/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from 'vitest/config';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/packages/transform',
plugins: [nxViteTsPaths()],
test: {
watch: false,
globals: true,
environment: 'node',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/packages/transform',
provider: 'v8',
},
},
});
10 changes: 6 additions & 4 deletions packages/webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
"url": "https://github.com/microsoft/griffel"
},
"type": "module",
"main": "./src/index.mjs",
"types": "./src/index.d.mts",
"exports": {
".": {
"node": "./webpack-plugin.js",
"types": "./index.d.mts"
"types": "./src/index.d.mts",
"default": "./src/index.mjs"
},
"./loader": {
"node": "./webpack-loader.js",
"types": "./webpackLoader.d.mts"
"types": "./src/webpackLoader.d.mts",
"default": "./src/webpackLoader.mjs"
},
"./package.json": "./package.json"
},
Expand Down
21 changes: 18 additions & 3 deletions packages/webpack-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,27 @@
"outputs": ["{options.outputFile}"]
},
"build": {
"executor": "@nx/vite:build",
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/webpack-plugin",
"compiler": "swc",
"format": ["esm"]
"tsConfig": "packages/webpack-plugin/tsconfig.lib.json",
"skipTypeField": true,
"packageJson": "packages/webpack-plugin/package.json",
"main": "packages/webpack-plugin/src/index.mts",
"assets": [
"packages/webpack-plugin/README.md",
{
"glob": "LICENSE.md",
"input": ".",
"output": "."
},
{
"glob": "*",
"input": "packages/webpack-plugin/src/virtual-loader",
"output": "src/virtual-loader"
}
]
}
},
"type-check": {
Expand Down
Loading
Loading