Skip to content

Commit

Permalink
seperate package
Browse files Browse the repository at this point in the history
  • Loading branch information
deanshub committed Jul 1, 2023
1 parent 31df4f5 commit 22ec3c5
Show file tree
Hide file tree
Showing 18 changed files with 191 additions and 52 deletions.
File renamed without changes.
4 changes: 4 additions & 0 deletions packages/legacy-in-it-stats-plugin/cjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "index.js",
"type": "commonjs"
}
File renamed without changes.
4 changes: 4 additions & 0 deletions packages/legacy-in-it-stats-plugin/esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"module": "index.js",
"type":"module"
}
89 changes: 89 additions & 0 deletions packages/legacy-in-it-stats-plugin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"name": "legacy-in-it-stats-plugin",
"version": "1.0.42",
"description": "webpack plugin to generate in-it stats",
"type": "module",
"keywords": [
"in-it",
"in-it-stats",
"webapck-bundle-analyzer",
"performance optimization",
"bundle tracking",
"bundle diffing",
"bundle analysis",
"code size optimization",
"webpack optimization",
"performance monitoring",
"code delivery optimization",
"bundle size tracking",
"dependency analysis",
"tree-shaking analysis",
"code splitting",
"performance insights",
"bundle visualization",
"code packaging optimization",
"build optimization",
"size monitoring",
"module analysis",
"performance profiling"
],
"main": "dist/cjs/index.js",
"exports": {
".": {
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts"
},
"./cjs": {
"require": "./dist/cjs/index.js",
"types": "./dist/cjs/index.d.ts"
},
"./esm": {
"import": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts"
}
},
"author": "Dean Shub <[email protected]>",
"license": "ISC",
"scripts": {
"clean": "rm -rf dist/",
"build": "npm run clean && npm run build:cjs && npm run build:esm",
"build:cjs": "tsc -p tsconfig.json && cp cjs/* dist/cjs/",
"build:esm": "tsc -p tsconfig.esm.json && cp esm/* dist/esm/",
"watch": "npm run clean && tsc -p tsconfig.json -w",
"test": "vitest run --passWithNoTests",
"npm:publish": "npm publish --access public"
},
"devDependencies": {
"@types/bytes": "^3.1.1",
"@types/filesize": "^5.0.0",
"@types/fs-extra": "^11.0.1",
"@types/is-ci": "^3.0.0",
"@types/node-fetch": "^2.6.4",
"@types/terminal-link": "^1.2.0",
"@types/webpack-bundle-analyzer": "^4.6.0",
"in-it-shared-types": "1.0.42",
"next": "^13.4.2",
"typescript": "^5.0.4",
"vitest": "^0.30.1"
},
"dependencies": {
"bytes": "^3.1.2",
"cosmiconfig": "^8.1.3",
"filesize": "^9.0.0",
"form-data": "^4.0.0",
"fs-extra": "^11.1.1",
"globby": "^11.0.0",
"is-ci": "^3.0.1",
"multimatch": "^5.0.0",
"node-fetch": "^2.0.0",
"picocolors": "^1.0.0",
"read-pkg-up": "^7.0.0",
"simple-git": "^3.19.0",
"terminal-link": "^2.0.0",
"webpack-bundle-analyzer": "^4.8.0"
},
"peerDependencies": {
"next": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { getDirname } from './getDirname.js';
import type { PostStatsResponse } from 'in-it-shared-types';
import type { Compiler } from 'webpack';

interface InItStatsWebpackPluginOptions {
export interface InItLegacyStatsWebpackPluginOptions {
reportFilename: string;
serverUrl: string;
buildId: string;
Expand All @@ -32,10 +32,10 @@ const pluginName = 'InItStatsWebpackPlugin';

// const log = (...args: any[]) => console.log(...args.map((a) => pc.bold(pc.gray(a))));

export default class InItStatsWebpackPlugin {
export default class InItLegacyStatsWebpackPlugin {
bundleAnalyzerPlugin: BundleAnalyzerPlugin;

constructor(private options: InItStatsWebpackPluginOptions) {
constructor(private options: InItLegacyStatsWebpackPluginOptions) {
this.bundleAnalyzerPlugin = new BundleAnalyzerPlugin({
// analyzerMode: 'static',
// openAnalyzer: true,
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions packages/legacy-in-it-stats-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import LegacyInItStatsPlugin from './InItStatsWebpackPlugin.js';
export default LegacyInItStatsPlugin;
export { LegacyInItStatsPlugin };

// @ts-expect-error-next-line
export = LegacyInItStatsPlugin;
13 changes: 13 additions & 0 deletions packages/legacy-in-it-stats-plugin/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["vitest", "vitest/globals"],
"module": "NodeNext",
"target": "esnext",
"moduleResolution": "NodeNext",
"rootDir": "src",
"outDir": "dist/esm",
"composite": true
},
"exclude":["vitest.config.ts", "dist", "node_modules", "cjs/*", "esm/*"]
}
14 changes: 14 additions & 0 deletions packages/legacy-in-it-stats-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["vitest", "vitest/globals"],
"module": "commonjs",
"target": "ES2015",
"rootDir": "./src",
"outDir": "dist/cjs",
"allowSyntheticDefaultImports": true,
"allowJs": true,
"composite": true
},
"exclude":["vitest.config.ts", "dist", "node_modules", "cjs/*", "esm/*"]
}
8 changes: 8 additions & 0 deletions packages/legacy-in-it-stats-plugin/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
},
});
22 changes: 1 addition & 21 deletions packages/next-in-it-stats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,13 @@
"npm:publish": "npm publish --access public"
},
"devDependencies": {
"@types/bytes": "^3.1.1",
"@types/filesize": "^5.0.0",
"@types/fs-extra": "^11.0.1",
"@types/is-ci": "^3.0.0",
"@types/node-fetch": "^2.6.4",
"@types/terminal-link": "^1.2.0",
"@types/webpack-bundle-analyzer": "^4.6.0",
"in-it-shared-types": "1.0.42",
"next": "^13.4.2",
"typescript": "^5.0.4",
"vitest": "^0.30.1"
},
"dependencies": {
"bytes": "^3.1.2",
"cosmiconfig": "^8.1.3",
"filesize": "^9.0.0",
"form-data": "^4.0.0",
"fs-extra": "^11.1.1",
"globby": "^11.0.0",
"is-ci": "^3.0.1",
"multimatch": "^5.0.0",
"node-fetch": "^2.0.0",
"picocolors": "^1.0.0",
"read-pkg-up": "^7.0.0",
"simple-git": "^3.19.0",
"terminal-link": "^2.0.0",
"webpack-bundle-analyzer": "^4.8.0"
"legacy-in-it-stats-plugin": "1.0.42"
},
"peerDependencies": {
"next": "*"
Expand Down
4 changes: 2 additions & 2 deletions packages/next-in-it-stats/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from 'path';
import InItStatsWebpackPlugin from './InItStatsWebpackPlugin.js';
import { LegacyInItStatsPlugin } from 'legacy-in-it-stats-plugin';
import type { NextStatsPluginOptions } from 'in-it-shared-types';
import type { NextConfig } from 'next';

Expand Down Expand Up @@ -40,7 +40,7 @@ function nextInItStats({
// const InItStatsWebpackPlugin = (await import('./InItStatsWebpackPlugin.js')).default;

config.plugins.push(
new InItStatsWebpackPlugin({
new LegacyInItStatsPlugin({
serverUrl,
reportFilename,
buildId: options.buildId,
Expand Down
9 changes: 6 additions & 3 deletions packages/next-in-it-stats/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"target": "esnext",
"moduleResolution": "NodeNext",
"rootDir": "src",
"outDir": "dist/esm"

"outDir": "dist/esm",
"composite": true
},
"exclude":["vitest.config.ts", "dist", "node_modules", "cjs/*", "esm/*"]
"exclude":["vitest.config.ts", "dist", "node_modules", "cjs/*", "esm/*"],
"references": [{
"path": "../legacy-in-it-stats-plugin"
}]
}
8 changes: 6 additions & 2 deletions packages/next-in-it-stats/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"rootDir": "./src",
"outDir": "dist/cjs",
"allowSyntheticDefaultImports": true,
"allowJs": true
"allowJs": true,
"composite": true
},
"exclude":["vitest.config.ts", "dist", "node_modules", "cjs/*", "esm/*"]
"exclude":["vitest.config.ts", "dist", "node_modules", "cjs/*", "esm/*"],
"references": [{
"path": "../legacy-in-it-stats-plugin"
}]
}
56 changes: 35 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6546,6 +6546,40 @@ __metadata:
languageName: node
linkType: hard

"[email protected], legacy-in-it-stats-plugin@workspace:packages/legacy-in-it-stats-plugin":
version: 0.0.0-use.local
resolution: "legacy-in-it-stats-plugin@workspace:packages/legacy-in-it-stats-plugin"
dependencies:
"@types/bytes": ^3.1.1
"@types/filesize": ^5.0.0
"@types/fs-extra": ^11.0.1
"@types/is-ci": ^3.0.0
"@types/node-fetch": ^2.6.4
"@types/terminal-link": ^1.2.0
"@types/webpack-bundle-analyzer": ^4.6.0
bytes: ^3.1.2
cosmiconfig: ^8.1.3
filesize: ^9.0.0
form-data: ^4.0.0
fs-extra: ^11.1.1
globby: ^11.0.0
in-it-shared-types: 1.0.42
is-ci: ^3.0.1
multimatch: ^5.0.0
next: ^13.4.2
node-fetch: ^2.0.0
picocolors: ^1.0.0
read-pkg-up: ^7.0.0
simple-git: ^3.19.0
terminal-link: ^2.0.0
typescript: ^5.0.4
vitest: ^0.30.1
webpack-bundle-analyzer: ^4.8.0
peerDependencies:
next: "*"
languageName: unknown
linkType: soft

"levn@npm:^0.4.1":
version: 0.4.1
resolution: "levn@npm:0.4.1"
Expand Down Expand Up @@ -7710,31 +7744,11 @@ __metadata:
version: 0.0.0-use.local
resolution: "next-in-it-stats@workspace:packages/next-in-it-stats"
dependencies:
"@types/bytes": ^3.1.1
"@types/filesize": ^5.0.0
"@types/fs-extra": ^11.0.1
"@types/is-ci": ^3.0.0
"@types/node-fetch": ^2.6.4
"@types/terminal-link": ^1.2.0
"@types/webpack-bundle-analyzer": ^4.6.0
bytes: ^3.1.2
cosmiconfig: ^8.1.3
filesize: ^9.0.0
form-data: ^4.0.0
fs-extra: ^11.1.1
globby: ^11.0.0
in-it-shared-types: 1.0.42
is-ci: ^3.0.1
multimatch: ^5.0.0
legacy-in-it-stats-plugin: 1.0.42
next: ^13.4.2
node-fetch: ^2.0.0
picocolors: ^1.0.0
read-pkg-up: ^7.0.0
simple-git: ^3.19.0
terminal-link: ^2.0.0
typescript: ^5.0.4
vitest: ^0.30.1
webpack-bundle-analyzer: ^4.8.0
peerDependencies:
next: "*"
languageName: unknown
Expand Down

0 comments on commit 22ec3c5

Please sign in to comment.