Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM and import fixes #41

Merged
merged 3 commits into from
Sep 19, 2022
Merged
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
6 changes: 6 additions & 0 deletions .changeset/silver-ties-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@dynamic-selectors/core': patch
'@dynamic-selectors/with-reselect': patch
---

Include esm-related fixes that were supposed to be in v1.1.0
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"____ INDIVIDUAL COMMANDS ___________________________________________": "",
"build": "pnpm run build:main && pnpm run size && pnpm run build:legacytypes",
"build:clean": "rimraf ./dist ./legacy-types",
"build:main": "pnpm run build:clean && tsup src/index.ts ./src/index.devOnly.ts --format esm,cjs && tsc -p ./tsconfig.build.json --declaration --emitDeclarationOnly",
"build:main": "pnpm run build:clean && tsup src/index.ts ./src/index.devOnly.ts --format cjs && tsc -p ./tsconfig.build.json",
"build:legacytypes": "pnpm run build:legacytypes:3.5 && pnpm run build:legacytypes:4.0 && pnpm run build:legacytypes:4.5",
"build:legacytypes:3.5": "downlevel-dts ./dist ./legacy-types/ts3.5 --to=3.5",
"build:legacytypes:4.0": "downlevel-dts ./dist ./legacy-types/ts4.0 --to=4.0",
Expand All @@ -88,11 +88,11 @@
"types": "tsc -p ./tsconfig.json --noEmit"
},
"dependencies": {
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"shallowequal": "^1.1.0"
},
"devDependencies": {
"@types/lodash": "4.14.185",
"@types/lodash-es": "4.17.6",
"@types/node": "18.7.18",
"@types/shallowequal": "1.1.1"
},
Expand Down
14 changes: 9 additions & 5 deletions packages/core/src/createDynamicSelector.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import get from 'lodash/get.js';
import { get } from 'lodash-es';
import shallowEqual from 'shallowequal';

import { dynamicSelectorForState } from './dynamicSelectorForState';
import type { DynamicSelectorResultCache, DynamicSelectorResultEntry } from './internals';
import { dynamicSelectorForState } from './dynamicSelectorForState.js';
import type { DynamicSelectorResultCache, DynamicSelectorResultEntry } from './internals/index.js';
import type {
DefaultStateType,
DynamicSelectorOptions,
DynamicSelectorStateOptions,
} from './types';
import { DynamicSelectorFnFromInnerFn, DynamicSelectorInnerFn, RemoveFirstElement } from './types';
} from './types.js';
import {
DynamicSelectorFnFromInnerFn,
DynamicSelectorInnerFn,
RemoveFirstElement,
} from './types.js';

/**
* Default cache for dynamic-selector call results
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/devOnlyUtils/DebugInfoCheckUtil.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* c8 ignore start */

import type { DynamicSelectorDebugInfo } from '../internals/debugInfo';
import type { DynamicSelectorDebugInfo } from '../internals/debugInfo.js';
import {
createDebugInfo,
debugAbortedRun,
Expand All @@ -9,8 +9,8 @@ import {
debugInvoked,
debugPhantomRun,
debugSkippedRun,
} from '../internals/debugInfo';
import type { AnyDynamicSelectorFn, DynamicSelectorParams } from '../types';
} from '../internals/debugInfo.js';
import type { AnyDynamicSelectorFn, DynamicSelectorParams } from '../types.js';

type ExpectedDebugInfoEntryType = 'depCheck' | 'invoked';
type ExpectedDebugInfoResultType = 'skipped' | 'phantom' | 'run' | 'aborted';
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/dynamicSelectorForState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
DynamicSelectorDebugInfo,
DynamicSelectorResultCache,
DynamicSelectorResultEntry,
} from './internals';
} from './internals/index.js';
import {
RESULT_ENTRY__STATE_OPTIONS,
RESULT_ENTRY__STATE,
Expand All @@ -29,7 +29,7 @@ import {
pushCallStackEntry,
validateOptions,
validateStateOptions,
} from './internals';
} from './internals/index.js';
import type {
DefaultExtraArgsType,
DefaultReturnType,
Expand All @@ -40,8 +40,8 @@ import type {
DynamicSelectorParams,
DynamicSelectorStateOptions,
StatePath,
} from './types';
import { DynamicSelectorFnFromInnerFn, RemoveFirstElement } from './types';
} from './types.js';
import { DynamicSelectorFnFromInnerFn, RemoveFirstElement } from './types.js';

const dynamicSelectorForState = <StateType = DefaultStateType>(
stateOptions: DynamicSelectorStateOptions<StateType>,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/index.devOnly.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './devOnlyUtils/DebugInfoCheckUtil';
export * from './types';
export * from './devOnlyUtils/DebugInfoCheckUtil.js';
export * from './types.js';
6 changes: 3 additions & 3 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './createDynamicSelector';
export * from './dynamicSelectorForState';
export * from './createDynamicSelector.js';
export * from './dynamicSelectorForState.js';

export * from './types';
export * from './types.js';
2 changes: 1 addition & 1 deletion packages/core/src/internals/callStack.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DynamicSelectorResultEntry } from './resultCache';
import type { DynamicSelectorResultEntry } from './resultCache.js';

/**
* The CallStack tracks Results which aren't yet finished: when any Dynamic Selector is run, its (pending) Result
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/internals/dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { popCallStackEntry, pushCallStackEntry } from './callStack';
import { popCallStackEntry, pushCallStackEntry } from './callStack.js';
import {
createDepCheckEntry,
RESULT_ENTRY__HAS_RETURN_VALUE,
RESULT_ENTRY__RETURN_VALUE,
} from './resultCache';
} from './resultCache.js';
import type {
DynamicSelectorFnFromTypes,
DynamicSelectorParams,
DynamicSelectorStateGetFn,
} from '../types';
} from '../types.js';

/**
* We track wo types of dependencies:
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/internals/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './callStack';
export * from './debugInfo';
export * from './dependencies';
export * from './resultCache';
export * from './validateOptions';
export * from './callStack.js';
export * from './debugInfo.js';
export * from './dependencies.js';
export * from './resultCache.js';
export * from './validateOptions.js';
10 changes: 5 additions & 5 deletions packages/core/src/internals/resultCache.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getTopCallStackEntry } from './callStack';
import type { DynamicSelectorDebugInfo } from './debugInfo';
import { createDebugInfo } from './debugInfo';
import { getTopCallStackEntry } from './callStack.js';
import type { DynamicSelectorDebugInfo } from './debugInfo.js';
import { createDebugInfo } from './debugInfo.js';
import type {
DynamicSelectorCallDependencies,
DynamicSelectorStateDependencies,
} from './dependencies';
import type { DynamicSelectorStateOptions } from '../types';
} from './dependencies.js';
import type { DynamicSelectorStateOptions } from '../types.js';

/**
* This is where things happen: this tracks everything about a single Dynamic Selector call: what was called,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/internals/validateOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DynamicSelectorOptions, DynamicSelectorStateOptions } from '../types';
import type { DynamicSelectorOptions, DynamicSelectorStateOptions } from '../types.js';

const validateOptions = (options: DynamicSelectorOptions) => {
/* c8 ignore start */
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
DynamicSelectorDebugInfo,
DynamicSelectorResultCache,
DynamicSelectorResultEntry,
} from './internals';
} from './internals/index.js';

type AnyPrimitive = boolean | number | string | null | undefined;

Expand Down
2 changes: 1 addition & 1 deletion packages/with-reselect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"____ INDIVIDUAL COMMANDS ___________________________________________": "",
"build": "pnpm run build:main && pnpm run size && pnpm run build:legacytypes",
"build:clean": "rimraf ./dist ./legacy-types",
"build:main": "pnpm run build:clean && tsup src/index.ts --format esm,cjs && tsc -p ./tsconfig.build.json --declaration --emitDeclarationOnly",
"build:main": "pnpm run build:clean && tsup src/index.ts --format cjs && tsc -p ./tsconfig.build.json",
"build:legacytypes": "pnpm run build:legacytypes:3.5 && pnpm run build:legacytypes:4.0 && pnpm run build:legacytypes:4.5",
"build:legacytypes:3.5": "downlevel-dts ./dist ./legacy-types/ts3.5 --to=3.5",
"build:legacytypes:4.0": "downlevel-dts ./dist ./legacy-types/ts4.0 --to=4.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/with-reselect/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './dynamicSelectorFromReselect';
export * from './reselectSelectorFromDynamic';
export * from './dynamicSelectorFromReselect.js';
export * from './reselectSelectorFromDynamic.js';
25 changes: 18 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion scripts/full-everything.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ source ./scripts/helpers/helpers.sh
echo "Going to doing everything: this will take a while..."
./scripts/clean-everything.sh
./scripts/setup-environment.sh
./scripts/full-ci.sh
./scripts/build-everything.sh

###################################################################################################
Expand Down