Skip to content

Commit

Permalink
Complete Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Skn0tt committed Aug 6, 2020
1 parent 2cf3436 commit aee9893
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
3 changes: 1 addition & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"next": "9.5.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"superjson": "^1.1.0",
"superjson-with-next": "file:../"
"superjson": "^1.1.0"
},
"devDependencies": {
"@types/react": "^16.9.44",
Expand Down
8 changes: 1 addition & 7 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ babel-plugin-dynamic-import-node@^2.3.3:
dependencies:
object.assign "^4.1.0"

"babel-plugin-superjson-next@file:../":
"babel-plugin-superjson-next@file:..":
version "0.1.0"
dependencies:
"@babel/core" "^7.11.0"
Expand Down Expand Up @@ -7003,12 +7003,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.4.tgz#f665f25f5e299cf3d64654ab949a57c768b73fbe"
integrity sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q==

"superjson-with-next@file:..":
version "0.1.0"
dependencies:
"@babel/core" "^7.11.0"
"@babel/helper-module-imports" "^7.10.4"

superjson@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/superjson/-/superjson-1.1.0.tgz#61c99b416295a18b69a65ccb1fa2eca65efaa65a"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"typings": "dist/index.d.ts",
"files": [
"dist",
"src"
"src",
"tool.js"
],
"engines": {
"node": ">=10"
Expand Down Expand Up @@ -35,7 +36,7 @@
},
"name": "babel-plugin-superjson-next",
"author": "Simon Knott",
"module": "dist/superjson-with-next.esm.js",
"module": "dist/babel-plugin-superjson-next.esm.js",
"devDependencies": {
"@types/react": "^16.9.44",
"babel-plugin-tester": "^9.2.0",
Expand Down
12 changes: 10 additions & 2 deletions src/plugin.ts → src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,19 @@ function transformGetServerSideProps(
}

function addWithSuperJSONGSSPImport(path: NodePath<any>) {
return addNamedImport(path, 'withSuperJSONGSSP', 'superjson-with-next');
return addNamedImport(
path,
'withSuperJSONGSSP',
'babel-plugin-superjson-next/tools'
);
}

function addWithSuperJSONPageImport(path: NodePath<any>) {
return addNamedImport(path, 'withSuperJSONPage', 'superjson-with-next');
return addNamedImport(
path,
'withSuperJSONPage',
'babel-plugin-superjson-next/tools'
);
}

function superJsonWithNext(): PluginObj {
Expand Down
5 changes: 1 addition & 4 deletions src/index.tsx → src/tools.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import SuperJSON from 'superjson';
import { GetServerSideProps } from 'next';
import type { GetServerSideProps } from 'next';
import React from 'react';
import babelPlugin from './plugin';

type SuperJSONResult = any;

Expand All @@ -25,5 +24,3 @@ export function withSuperJSONPage<P>(
return <Page {...props} />;
};
}

export default babelPlugin;
4 changes: 2 additions & 2 deletions test/pages/class component/output.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withSuperJSONPage as _withSuperJSONPage } from 'superjson-with-next';
import { withSuperJSONGSSP as _withSuperJSONGSSP } from 'superjson-with-next';
import { withSuperJSONPage as _withSuperJSONPage } from 'babel-plugin-superjson-next/tools';
import { withSuperJSONGSSP as _withSuperJSONGSSP } from 'babel-plugin-superjson-next/tools';
export const getServerSideProps = _withSuperJSONGSSP(async () => {
const products = [
{
Expand Down
4 changes: 2 additions & 2 deletions test/pages/gSSP function declaration/output.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withSuperJSONPage as _withSuperJSONPage } from 'superjson-with-next';
import { withSuperJSONGSSP as _withSuperJSONGSSP } from 'superjson-with-next';
import { withSuperJSONPage as _withSuperJSONPage } from 'babel-plugin-superjson-next/tools';
import { withSuperJSONGSSP as _withSuperJSONGSSP } from 'babel-plugin-superjson-next/tools';
export const getServerSideProps = _withSuperJSONGSSP(
async function getServerSideProps() {
const products = [
Expand Down
4 changes: 2 additions & 2 deletions test/pages/separate export declaration/output.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withSuperJSONPage as _withSuperJSONPage } from 'superjson-with-next';
import { withSuperJSONGSSP as _withSuperJSONGSSP } from 'superjson-with-next';
import { withSuperJSONPage as _withSuperJSONPage } from 'babel-plugin-superjson-next/tools';
import { withSuperJSONGSSP as _withSuperJSONGSSP } from 'babel-plugin-superjson-next/tools';
export const getServerSideProps = _withSuperJSONGSSP(async () => {
const products = [
{
Expand Down
4 changes: 2 additions & 2 deletions test/pages/transforms a valid example/output.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withSuperJSONPage as _withSuperJSONPage } from 'superjson-with-next';
import { withSuperJSONGSSP as _withSuperJSONGSSP } from 'superjson-with-next';
import { withSuperJSONPage as _withSuperJSONPage } from 'babel-plugin-superjson-next/tools';
import { withSuperJSONGSSP as _withSuperJSONGSSP } from 'babel-plugin-superjson-next/tools';
export const getServerSideProps = _withSuperJSONGSSP(async () => {
const products = [
{
Expand Down
2 changes: 1 addition & 1 deletion test/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import superJsonWithNext from '../src/plugin';
import superJsonWithNext from '../src';
import pluginTester from 'babel-plugin-tester';
import * as path from 'path';

Expand Down
1 change: 1 addition & 0 deletions tools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("./dist/tools.js")
4 changes: 2 additions & 2 deletions tsdx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module.exports = {
return {
...config,
input: [
"src/plugin.ts",
"src/index.tsx"
"src/index.ts",
"src/tools.tsx"
],
output: {
...config.output,
Expand Down

0 comments on commit aee9893

Please sign in to comment.