-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e17abb3
commit 5958256
Showing
5 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { | ||
Component | ||
} from '@angular2/core'; | ||
import defaultMember from "module-name"; | ||
import * as name from "module-name "; | ||
import { member } from " module-name"; | ||
import { member as alias } from "module-name"; | ||
import { member1 , member2 } from "module-name"; | ||
import { member1 , member2 as alias2 , member3 as alias3 } from "module-name"; | ||
import { | ||
Component | ||
} from '@angular2/core'; | ||
import defaultMember from "$module-name"; | ||
import defaultMember, { member, member } from "module-name"; | ||
import defaultMember, * as name from "module-name"; | ||
|
||
import * as name from "module-name " | ||
import { member } from " module-name" | ||
import { member as alias } from "module-name" | ||
import { member1 , member2 } from "module-name" | ||
import { member1 , member2 as alias2 , member3 as alias3 } from "module-name" | ||
import { | ||
Component | ||
} from '@angular2/core' | ||
import defaultMember from "$module-name" | ||
import defaultMember, { member, member } from "module-name" | ||
import defaultMember, * as name from "module-name" | ||
|
||
import "module-name"; | ||
import React from "react" | ||
import { Field } from "redux-form" | ||
import "module-name"; | ||
|
||
import { | ||
PlaneBufferGeometry, | ||
OctahedronGeometry, | ||
TorusBufferGeometry | ||
} from '../geometries/Geometries.js'; | ||
|
||
import { | ||
PlaneBufferGeometry, | ||
OctahedronGeometry, | ||
TorusBufferGeometry | ||
} from '../geometries/Geometries.js' | ||
|
||
import("module-name/whatever.ts"); | ||
import("module-name/whatever.ts") | ||
|
||
import { Field } from "redux-form"; | ||
import MultiContentListView from "./views/ListView"; | ||
import MultiContentAddView from "./views/AddView"; | ||
import MultiContentEditView from "./views/EditView"; | ||
|
||
import { Field } from "redux-form" | ||
import MultiContentListView from "./views/ListView" | ||
import MultiContentAddView from "./views/AddView" | ||
import MultiContentEditView from "./views/EditView" | ||
|
||
|
||
<MenuItem value="^$" primaryText="Não exibir importados" /> | ||
<MenuItem value="\\w+" primaryText="Exibir importados" /> | ||
|
||
// *Add all needed dependency to this module | ||
// *app requires those import modules to function | ||
|
||
|
||
/** | ||
* | ||
*Add all needed dependency to this module | ||
*app requires those import modules to function | ||
* | ||
**/ | ||
|
||
let modules = []; | ||
|
||
|
||
import defaultExport from "module-name"; | ||
import * as name from "module-name"; | ||
import { export1 } from "module-name"; | ||
import { export1 as alias1 } from "module-name"; | ||
import { default as alias } from "module-name"; | ||
import { export1, export2 } from "module-name"; | ||
import { export1, export2 as alias2, /* … */ } from "module-name"; | ||
import { "string name" as alias } from "module-name"; | ||
import defaultExport, { export1, /* … */ } from "module-name"; | ||
import defaultExport, * as name from "module-name"; | ||
import "module-name"; | ||
import { "a-b" as a } from "/modules/my-module.ts"; | ||
import myDefault from "/modules/my-module.ts"; | ||
import myDefault, * as myModule from "/modules/my-module.ts"; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import * from '../nested/index.ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package deploy | ||
|
||
import ( | ||
"embed" | ||
"io" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/mock" | ||
"github.com/supabase/cli/internal/utils" | ||
) | ||
|
||
//go:embed testdata | ||
var testImports embed.FS | ||
|
||
type MockFS struct { | ||
mock.Mock | ||
} | ||
|
||
func (m *MockFS) ReadFile(srcPath string, w io.Writer) error { | ||
_ = m.Called(srcPath) | ||
data, err := testImports.ReadFile(srcPath) | ||
if err != nil { | ||
return err | ||
} | ||
if _, err := w.Write(data); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func TestImportPaths(t *testing.T) { | ||
t.Run("iterates all import paths", func(t *testing.T) { | ||
// Setup in-memory fs | ||
fsys := MockFS{} | ||
fsys.On("ReadFile", "/modules/my-module.ts").Once() | ||
fsys.On("ReadFile", "testdata/modules/imports.ts").Once() | ||
fsys.On("ReadFile", "testdata/geometries/Geometries.js").Once() | ||
// Run test | ||
im := utils.ImportMap{} | ||
err := walkImportPaths("testdata/modules/imports.ts", im, fsys.ReadFile) | ||
// Check error | ||
assert.NoError(t, err) | ||
fsys.AssertExpectations(t) | ||
}) | ||
|
||
t.Run("iterates wih import map", func(t *testing.T) { | ||
// Setup in-memory fs | ||
fsys := MockFS{} | ||
fsys.On("ReadFile", "/modules/my-module.ts").Once() | ||
fsys.On("ReadFile", "testdata/modules/imports.ts").Once() | ||
fsys.On("ReadFile", "testdata/geometries/Geometries.js").Once() | ||
fsys.On("ReadFile", "testdata/shared/whatever.ts").Once() | ||
fsys.On("ReadFile", "testdata/nested/index.ts").Once() | ||
// Run test | ||
im := utils.ImportMap{Imports: map[string]string{ | ||
"module-name/": "../shared/", | ||
}} | ||
err := walkImportPaths("testdata/modules/imports.ts", im, fsys.ReadFile) | ||
// Check error | ||
assert.NoError(t, err) | ||
fsys.AssertExpectations(t) | ||
}) | ||
} |